From: Thomas Vander Stichele Date: Wed, 21 Jul 2004 09:20:55 +0000 (+0000) Subject: don't needlessly do stuff X-Git-Tag: RELEASE-0_8_2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e38fff6ecfea9a314ea481a48c87bb920c825dd1;p=platform%2Fupstream%2Fgst-libav.git don't needlessly do stuff Original commit message from CVS: don't needlessly do stuff --- diff --git a/ChangeLog b/ChangeLog index ece1c7e..35d99ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2004-07-21 Thomas Vander Stichele + * ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain): + no point in doing any chaining if the pad we want to push from + isn't usable. + + +2004-07-21 Thomas Vander Stichele + * configure.ac: bump nano === gst-ffmpeg 0.8.1 === diff --git a/configure.ac b/configure.ac index a15cff3..6124e97 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ AM_MAINTAINER_MODE dnl when going to/from release please set the nano (fourth number) right ! dnl releases only do Wall, cvs and prerelease does Werror too -AS_VERSION(gst-ffmpeg, GST_FFMPEG_VERSION, 0, 8, 1, 0, GST_CVS="no", GST_CVS="yes") +AS_VERSION(gst-ffmpeg, GST_FFMPEG_VERSION, 0, 8, 1, 1, GST_CVS="no", GST_CVS="yes") dnl we cheat here so we don't have to change the actual configure code bit GST_PLUGINS_VERSION_NANO=$GST_FFMPEG_VERSION_NANO diff --git a/ext/ffmpeg/gstffmpegcolorspace.c b/ext/ffmpeg/gstffmpegcolorspace.c index 635851a..3f3d2e1 100644 --- a/ext/ffmpeg/gstffmpegcolorspace.c +++ b/ext/ffmpeg/gstffmpegcolorspace.c @@ -329,6 +329,11 @@ gst_ffmpegcsp_chain (GstPad * pad, GstData * data) g_return_if_fail (space != NULL); g_return_if_fail (GST_IS_FFMPEGCSP (space)); + if (!GST_PAD_IS_USABLE (space->srcpad)) { + gst_buffer_unref (inbuf); + return; + } + if (space->from_pixfmt == PIX_FMT_NB || space->to_pixfmt == PIX_FMT_NB) { GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL), ("attempting to convert colorspaces between unknown formats")); diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index c36cfb1..d79d0ed 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -47,6 +47,8 @@ struct _GstFFMpegDec AVCodecContext *context; AVFrame *picture; gboolean opened; + + GValue *par; /* pixel aspect ratio of incoming data */ }; typedef struct _GstFFMpegDecClass GstFFMpegDecClass; @@ -254,6 +256,8 @@ gst_ffmpegdec_connect (GstPad * pad, const GstCaps * caps) GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) (gst_pad_get_parent (pad)); GstFFMpegDecClass *oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); + GstStructure *structure; + const GValue *par; /* close old session */ gst_ffmpegdec_close (ffmpegdec); @@ -271,6 +275,15 @@ gst_ffmpegdec_connect (GstPad * pad, const GstCaps * caps) gst_ffmpeg_caps_with_codecid (oclass->in_plugin->id, oclass->in_plugin->type, caps, ffmpegdec->context); + /* get pixel aspect ratio if it's set */ + structure = gst_caps_get_structure (caps, 0); + par = gst_structure_get_value (structure, "pixel-aspect-ratio"); + if (par) { + GST_DEBUG_OBJECT (ffmpegdec, "sink caps have pixel-aspect-ratio"); + ffmpegdec->par = g_new0 (GValue, 1); + gst_value_init_and_copy (ffmpegdec->par, par); + } + /* we dont send complete frames - FIXME: we need a 'framed' property * in caps */ if (oclass->in_plugin->capabilities & CODEC_CAP_TRUNCATED && @@ -470,6 +483,16 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data) caps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, ffmpegdec->context); ffmpegdec->context->pix_fmt = orig_fmt; + + /* add in pixel-aspect-ratio if we have it */ + if (caps && ffmpegdec->par) { + GST_DEBUG_OBJECT (ffmpegdec, "setting pixel-aspect-ratio"); + gst_structure_set (gst_caps_get_structure (caps, 0), + "pixel-aspect-ratio", GST_TYPE_FRACTION, + gst_value_get_fraction_numerator (ffmpegdec->par), + gst_value_get_fraction_denominator (ffmpegdec->par), + NULL); + } if (caps == NULL || !gst_pad_set_explicit_caps (ffmpegdec->srcpad, caps)) { GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),