mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 10:40:34 +00:00
ext/ffmpeg/gstffmpegenc.c: Fix return values from the setcaps function.
Original commit message from CVS: * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video), (gst_ffmpegenc_change_state): Fix return values from the setcaps function.
This commit is contained in:
parent
3a81f04d60
commit
0c53925656
2 changed files with 25 additions and 13 deletions
|
@ -1,3 +1,9 @@
|
|||
2005-08-19 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_setcaps),
|
||||
(gst_ffmpegenc_chain_video), (gst_ffmpegenc_change_state):
|
||||
Fix return values from the setcaps function.
|
||||
|
||||
2005-08-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame),
|
||||
|
|
|
@ -397,7 +397,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
|||
avcodec_close (ffmpegenc->context);
|
||||
GST_DEBUG ("ffenc_%s: Failed to open FFMPEG codec",
|
||||
oclass->in_plugin->name);
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* is the colourspace correct? */
|
||||
|
@ -405,7 +405,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
|||
avcodec_close (ffmpegenc->context);
|
||||
GST_DEBUG ("ffenc_%s: AV wants different colourspace (%d given, %d wanted)",
|
||||
oclass->in_plugin->name, pix_fmt, ffmpegenc->context->pix_fmt);
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* some codecs support more than one format, first auto-choose one */
|
||||
|
@ -420,7 +420,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
|||
if (!other_caps) {
|
||||
avcodec_close (ffmpegenc->context);
|
||||
GST_DEBUG ("Unsupported codec - no caps found");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
icaps = gst_caps_intersect (allowed_caps, other_caps);
|
||||
|
@ -428,7 +428,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
|||
gst_caps_unref (other_caps);
|
||||
if (gst_caps_is_empty (icaps)) {
|
||||
gst_caps_unref (icaps);
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gst_caps_get_size (icaps) > 1) {
|
||||
|
@ -444,14 +444,14 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
|||
if (!gst_pad_set_caps (ffmpegenc->srcpad, icaps)) {
|
||||
avcodec_close (ffmpegenc->context);
|
||||
gst_caps_unref (icaps);
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
return FALSE;
|
||||
}
|
||||
gst_caps_unref (icaps);
|
||||
|
||||
/* success! */
|
||||
ffmpegenc->opened = TRUE;
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -463,8 +463,6 @@ gst_ffmpegenc_chain_video (GstPad * pad, GstBuffer * inbuf)
|
|||
(GstFFMpegEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc));
|
||||
gint ret_size = 0, frame_size;
|
||||
|
||||
/* FIXME: events (discont (flush!) and eos (close down) etc.) */
|
||||
|
||||
GST_DEBUG_OBJECT (ffmpegenc,
|
||||
"Received buffer of time %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (inbuf)));
|
||||
|
@ -499,6 +497,8 @@ gst_ffmpegenc_chain_video (GstPad * pad, GstBuffer * inbuf)
|
|||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegenc->srcpad));
|
||||
|
||||
gst_buffer_unref (inbuf);
|
||||
|
||||
return gst_pad_push (ffmpegenc->srcpad, outbuf);
|
||||
}
|
||||
|
||||
|
@ -660,6 +660,14 @@ gst_ffmpegenc_change_state (GstElement * element)
|
|||
{
|
||||
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) element;
|
||||
gint transition = GST_STATE_TRANSITION (element);
|
||||
GstElementStateReturn result;
|
||||
|
||||
switch (transition) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
result = GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
|
@ -672,12 +680,10 @@ gst_ffmpegenc_change_state (GstElement * element)
|
|||
ffmpegenc->cache = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||
|
||||
return GST_STATE_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
Loading…
Reference in a new issue