ext/ffmpeg/gstffmpegenc.c: Negotiation fixes.
authorDavid Schleef <ds@schleef.org>
Fri, 2 Jan 2004 23:11:41 +0000 (23:11 +0000)
committerDavid Schleef <ds@schleef.org>
Fri, 2 Jan 2004 23:11:41 +0000 (23:11 +0000)
Original commit message from CVS:
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_init),
(gst_ffmpegenc_connect):  Negotiation fixes.
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_negotiate_format):
Remove inappropriate gst_caps_free().
* sys/ximage/ximagesink.c: (gst_ximagesink_sinkconnect):
Reenable Ronald's internal resize code, since the core handles
it correctly now.

ext/ffmpeg/gstffmpegenc.c

index b10826b..467fe84 100644 (file)
@@ -241,6 +241,7 @@ gst_ffmpegenc_init(GstFFMpegEnc *ffmpegenc)
   ffmpegenc->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
   gst_pad_set_link_function (ffmpegenc->sinkpad, gst_ffmpegenc_connect);
   ffmpegenc->srcpad = gst_pad_new_from_template (oclass->srctempl, "src");
+  gst_pad_use_explicit_caps (ffmpegenc->srcpad);
 
   gst_element_add_pad (GST_ELEMENT (ffmpegenc), ffmpegenc->sinkpad);
   gst_element_add_pad (GST_ELEMENT (ffmpegenc), ffmpegenc->srcpad);
@@ -344,11 +345,11 @@ gst_ffmpegenc_connect (GstPad  *pad,
     return GST_PAD_LINK_REFUSED;
   }
 
-  if ((ret = gst_pad_try_set_caps (ffmpegenc->srcpad, other_caps)) <= 0) {
+  /* FIXME set_explicit_caps is not supposed to be used in a pad link
+   * function. */
+  if (!gst_pad_set_explicit_caps (ffmpegenc->srcpad, other_caps)) {
     avcodec_close (ffmpegenc->context);
-    GST_DEBUG ("Failed to set caps on next element for ffmpeg encoder (%s)",
-               oclass->in_plugin->name);
-    return ret;
+    return GST_PAD_LINK_REFUSED;
   }
 
   /* success! */