MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ScanFunc

Function ScanFunc

libhb/scan.c:132–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132static void ScanFunc( void * _data )
133{
134 hb_scan_t * data = (hb_scan_t *) _data;
135 hb_title_t * title;
136 int i;
137 int feature = 0;
138
139 data->bd = NULL;
140 data->dvd = NULL;
141 data->stream = NULL;
142
143 char *single_path = NULL;
144 if (hb_list_count(data->paths) == 1)
145 {
146 single_path = hb_list_item(data->paths, 0);
147 }
148
149 /* Try to open the path as a DVD. If it fails, try as a file */
150 if( single_path != NULL && !is_known_filetype(single_path) && ( data->bd = hb_bd_init( data->h, single_path, data->keep_duplicate_titles ) ) )
151 {
152 hb_log( "scan: BD has %d title(s)",
153 hb_bd_title_count( data->bd ) );
154 if( data->title_index )
155 {
156 /* Scan this title only */
157 hb_list_add( data->title_set->list_title,
158 hb_bd_title_scan( data->bd,
159 data->title_index, 0, 0 ) );
160 }
161 else
162 {
163 /* Scan all titles */
164 for( i = 0; i < hb_bd_title_count( data->bd ); i++ )
165 {
166 UpdateState1(data, i + 1);
167 hb_list_add( data->title_set->list_title,
168 hb_bd_title_scan( data->bd,
169 i + 1, data->min_title_duration, data->max_title_duration ) );
170 }
171 feature = hb_bd_main_feature( data->bd,
172 data->title_set->list_title );
173 }
174 }
175 else if( single_path != NULL && !is_known_filetype(single_path) && ( data->dvd = hb_dvd_init( data->h, single_path ) ) )
176 {
177 hb_log( "scan: DVD has %d title(s)",
178 hb_dvd_title_count( data->dvd ) );
179 if( data->title_index )
180 {
181 /* Scan this title only */
182 hb_list_add( data->title_set->list_title,
183 hb_dvd_title_scan( data->dvd,
184 data->title_index, 0, 0 ) );
185 }
186 else
187 {
188 /* Scan all titles */
189 for( i = 0; i < hb_dvd_title_count( data->dvd ); i++ )

Callers

nothing calls this directly

Calls 15

hb_list_countFunction · 0.85
hb_list_itemFunction · 0.85
is_known_filetypeFunction · 0.85
hb_bd_initFunction · 0.85
hb_logFunction · 0.85
hb_bd_title_countFunction · 0.85
hb_list_addFunction · 0.85
hb_bd_title_scanFunction · 0.85
UpdateState1Function · 0.85
hb_bd_main_featureFunction · 0.85
hb_dvd_initFunction · 0.85
hb_dvd_title_countFunction · 0.85

Tested by

no test coverage detected