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

Function decavcodecvInfo

libhb/decavcodec.c:2381–2453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2379}
2380
2381static int decavcodecvInfo( hb_work_object_t *w, hb_work_info_t *info )
2382{
2383 hb_work_private_t *pv = w->private_data;
2384
2385 int clock_min, clock_max, clock;
2386 hb_video_framerate_get_limits(&clock_min, &clock_max, &clock);
2387
2388 memset( info, 0, sizeof(*info) );
2389
2390 if (pv->context == NULL || pv->context->codec == NULL)
2391 return 0;
2392
2393 info->bitrate = pv->context->bit_rate;
2394 if (w->title->rotation == HB_ROTATION_90 ||
2395 w->title->rotation == HB_ROTATION_270)
2396 {
2397 // HandBrake's video pipeline uses yuv420 color. This means all
2398 // dimensions must be even. So we must adjust the dimensions
2399 // of incoming video if not even.
2400 info->geometry.width = pv->context->height & ~1;
2401 info->geometry.height = pv->context->width & ~1;
2402
2403 info->geometry.par.num = pv->context->sample_aspect_ratio.den;
2404 info->geometry.par.den = pv->context->sample_aspect_ratio.num;
2405 }
2406 else
2407 {
2408 // HandBrake's video pipeline uses yuv420 color. This means all
2409 // dimensions must be even. So we must adjust the dimensions
2410 // of incoming video if not even.
2411 info->geometry.width = pv->context->width & ~1;
2412 info->geometry.height = pv->context->height & ~1;
2413
2414 info->geometry.par.num = pv->context->sample_aspect_ratio.num;
2415 info->geometry.par.den = pv->context->sample_aspect_ratio.den;
2416 }
2417
2418 compute_frame_duration( pv );
2419 info->rate.num = clock;
2420 info->rate.den = pv->duration * (clock / 90000.);
2421
2422 info->profile = pv->context->profile;
2423 info->level = pv->context->level;
2424 info->name = pv->context->codec->name;
2425
2426 info->pix_fmt = pv->context->sw_pix_fmt != AV_PIX_FMT_NONE ? pv->context->sw_pix_fmt : pv->context->pix_fmt;
2427 info->color_prim = pv->context->color_primaries;
2428 info->color_transfer = pv->context->color_trc;
2429 info->color_matrix = pv->context->colorspace;
2430 info->color_range = pv->context->color_range;
2431 info->chroma_location = pv->context->chroma_sample_location;
2432
2433 info->video_decode_support = HB_DECODE_SW;
2434
2435#if HB_PROJECT_FEATURE_QSV
2436 if (hb_qsv_available())
2437 {
2438 if (hb_qsv_decode_is_codec_supported(hb_qsv_get_adapter_index(), pv->context->codec_id,

Callers

nothing calls this directly

Calls 6

compute_frame_durationFunction · 0.85
hb_qsv_availableFunction · 0.85
hb_qsv_get_adapter_indexFunction · 0.85

Tested by

no test coverage detected