From d2d3aefa94a80f895645ba5407c54b920e7938b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 21 May 2010 10:54:57 +0200 Subject: [PATCH] [MOVED FROM BAD 031/134] vp8dec: Only enable postprocessing if the decoder supports it --- ext/vp8/gstvp8dec.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ext/vp8/gstvp8dec.c b/ext/vp8/gstvp8dec.c index bc8fb68..9d6e1d9 100644 --- a/ext/vp8/gstvp8dec.c +++ b/ext/vp8/gstvp8dec.c @@ -431,6 +431,7 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) if (!dec->decoder_inited) { int flags = 0; vpx_codec_stream_info_t stream_info; + vpx_codec_caps_t caps; memset (&stream_info, 0, sizeof (stream_info)); stream_info.sz = sizeof (stream_info); @@ -451,8 +452,16 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) decoder->state.format = GST_VIDEO_FORMAT_I420; gst_vp8_dec_send_tags (dec); - if (dec->post_processing) - flags |= VPX_CODEC_USE_POSTPROC; + caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo); + + if (dec->post_processing) { + if (!(caps & VPX_CODEC_CAP_POSTPROC)) { + GST_WARNING_OBJECT (decoder, + "Decoder does not support post processing"); + } else { + flags |= VPX_CODEC_USE_POSTPROC; + } + } status = vpx_codec_dec_init (&dec->decoder, &vpx_codec_vp8_dx_algo, NULL, flags); @@ -463,7 +472,7 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) return GST_FLOW_ERROR; } - if (dec->post_processing) { + if ((caps & VPX_CODEC_CAP_POSTPROC) && dec->post_processing) { vp8_postproc_cfg_t pp_cfg = { 0, }; pp_cfg.post_proc_flag = dec->post_processing_flags; -- 2.7.4