From: gb Date: Mon, 3 May 2010 22:02:41 +0000 (+0000) Subject: Extract framerate information from caps. X-Git-Tag: 1.19.3~503^2~3451 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=edae9f068c54a6e65ee911e31bb2d93cb4fe58e4;p=platform%2Fupstream%2Fgstreamer.git Extract framerate information from caps. --- diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index 12d79dc..16feb4d 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -156,40 +156,32 @@ static void set_caps(GstVaapiDecoder *decoder, GstCaps *caps) { GstVaapiDecoderPrivate * const priv = decoder->priv; - GstStructure *structure; + GstStructure * const structure = gst_caps_get_structure(caps, 0); GstVaapiProfile profile; const GValue *v_codec_data; - gint width, height; + gint v1, v2; - if (priv->caps) { - gst_caps_unref(priv->caps); - priv->caps = NULL; - } + profile = gst_vaapi_profile_from_caps(caps); + if (!profile) + return; + + priv->codec = gst_vaapi_profile_get_codec(profile); + if (!priv->codec) + return; - if (caps) { - structure = gst_caps_get_structure(caps, 0); - if (!structure) - return; - - profile = gst_vaapi_profile_from_caps(caps); - if (!profile) - return; - - priv->codec = gst_vaapi_profile_get_codec(profile); - if (!priv->codec) - return; - - if (!gst_structure_get_int(structure, "width", &width)) - width = 0; - if (!gst_structure_get_int(structure, "height", &height)) - height = 0; - priv->width = width; - priv->height = height; - - v_codec_data = gst_structure_get_value(structure, "codec_data"); - if (v_codec_data) - set_codec_data(decoder, gst_value_get_buffer(v_codec_data)); + if (gst_structure_get_int(structure, "width", &v1)) + priv->width = v1; + if (gst_structure_get_int(structure, "height", &v2)) + priv->height = v2; + + if (gst_structure_get_fraction(structure, "framerate", &v1, &v2)) { + priv->fps_n = v1; + priv->fps_d = v2; } + + v_codec_data = gst_structure_get_value(structure, "codec_data"); + if (v_codec_data) + set_codec_data(decoder, gst_value_get_buffer(v_codec_data)); } static void @@ -205,7 +197,6 @@ gst_vaapi_decoder_finalize(GObject *object) GstVaapiDecoder * const decoder = GST_VAAPI_DECODER(object); GstVaapiDecoderPrivate * const priv = decoder->priv; - set_caps(decoder, NULL); set_codec_data(decoder, NULL); if (priv->context) { @@ -318,7 +309,6 @@ gst_vaapi_decoder_init(GstVaapiDecoder *decoder) decoder->priv = priv; priv->context = NULL; - priv->caps = NULL; priv->codec = 0; priv->codec_data = NULL; priv->width = 0; diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h index c824188..2b30cf3 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h @@ -112,7 +112,6 @@ G_BEGIN_DECLS struct _GstVaapiDecoderPrivate { GstVaapiDisplay *display; GstVaapiContext *context; - GstCaps *caps; GstVaapiCodec codec; GstBuffer *codec_data; guint width;