don't needlessly do stuff

Original commit message from CVS:
don't needlessly do stuff
This commit is contained in:
Thomas Vander Stichele 2004-07-21 09:20:55 +00:00
parent a5a3be3bb7
commit e38fff6ecf
4 changed files with 36 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2004-07-21 Thomas Vander Stichele <thomas at apestaart dot org>
* 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 <thomas at apestaart dot org>
* configure.ac: bump nano

View file

@ -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

View file

@ -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"));

View file

@ -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),