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

Function UpdateSearchState

libhb/sync.c:3231–3296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3229}
3230
3231static void UpdateSearchState( sync_common_t * common, int64_t start,
3232 int frame_count )
3233{
3234 hb_job_t * job = common->job;
3235 hb_state_t state;
3236 uint64_t now;
3237 double avg;
3238
3239 if (job->indepth_scan)
3240 {
3241 // Progress for indepth scan is handled by reader
3242 // frame_count is used during indepth_scan
3243 // to find start & end points.
3244 return;
3245 }
3246
3247 now = hb_get_date();
3248 if (frame_count == 0)
3249 {
3250 common->st_first = now;
3251 }
3252
3253 hb_get_state2(job->h, &state);
3254 state.state = HB_STATE_SEARCHING;
3255
3256#define p state.param.working
3257 if (common->wait_for_frame)
3258 p.progress = (float)frame_count / job->frame_to_start;
3259 else if (common->wait_for_pts)
3260 p.progress = (float) start / common->pts_to_start;
3261 else
3262 p.progress = 0;
3263 if (p.progress > 1.0)
3264 {
3265 p.progress = 1.0;
3266 }
3267 if (now > common->st_first)
3268 {
3269 int eta = 0;
3270
3271 if (common->wait_for_frame)
3272 {
3273 avg = 1000.0 * frame_count / (now - common->st_first);
3274 eta = (job->frame_to_start - frame_count ) / avg;
3275 }
3276 else if (common->wait_for_pts)
3277 {
3278 avg = 1000.0 * start / (now - common->st_first);
3279 eta = (common->pts_to_start - start) / avg;
3280 }
3281 p.eta_seconds = eta;
3282 p.hours = eta / 3600;
3283 p.minutes = (eta % 3600) / 60;
3284 p.seconds = eta % 60;
3285 }
3286 else
3287 {
3288 p.rate_avg = 0.0;

Callers 1

OutputBufferFunction · 0.85

Calls 3

hb_get_dateFunction · 0.85
hb_get_state2Function · 0.85
hb_set_stateFunction · 0.85

Tested by

no test coverage detected