1
0
Fork 0

h264: populate AVCodecContext with SPS values during codec init

This allows user code to properly detect HW decoding compat before decoding actually starts.
This commit is contained in:
Hendrik Leppkes 2011-07-29 17:44:14 +02:00
parent 17ee3fe6a7
commit c1d6075033
Signed by: hendrik
GPG Key ID: 846079A4B0A7C1B5
3 changed files with 18 additions and 0 deletions

View File

@ -909,6 +909,11 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
return ff_get_format(h->avctx, pix_fmts);
}
enum AVPixelFormat ff_h264_get_pixel_format(H264Context *h)
{
return get_pixel_format(h, 1);
}
/* export coded and cropped frame dimensions to AVCodecContext */
static void init_dimensions(H264Context *h)
{

View File

@ -419,6 +419,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
if (h->ps.sps) {
h->avctx->colorspace = h->ps.sps->vui.matrix_coeffs;
h->avctx->pix_fmt = ff_h264_get_pixel_format(h);
if (h->avctx->pix_fmt < 0)
h->avctx->pix_fmt = AV_PIX_FMT_NONE;
h->avctx->profile = ff_h264_get_profile(h->ps.sps);
h->avctx->level = h->ps.sps->level_idc;
h->avctx->refs = h->ps.sps->ref_frame_count;
}
if (h->ps.sps && h->ps.sps->bitstream_restriction_flag &&
h->avctx->has_b_frames < h->ps.sps->num_reorder_frames) {
h->avctx->has_b_frames = h->ps.sps->num_reorder_frames;

View File

@ -699,4 +699,6 @@ void ff_h264_free_tables(H264Context *h);
void ff_h264_set_erpic(ERPicture *dst, const H264Picture *src);
enum AVPixelFormat ff_h264_get_pixel_format(H264Context *h);
#endif /* AVCODEC_H264DEC_H */