summaryrefslogtreecommitdiff
path: root/ext/xvid/gstxvidenc.c
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-06-23 18:01:18 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-06-23 18:28:51 +0200
commitda11b1672fcd03717ca445b8ff300dc2527c0b87 (patch)
treec711d3216e79bb2cf8cdb1620d86cab953ab71be /ext/xvid/gstxvidenc.c
parent6ba122834a4972e0bd1e9950eeed8ea127ea3fb4 (diff)
downloadgstreamer-plugins-bad-da11b1672fcd03717ca445b8ff300dc2527c0b87.tar.gz
xvidenc: also allow video/mpeg on output caps. Fixes #377784.
Diffstat (limited to 'ext/xvid/gstxvidenc.c')
-rw-r--r--ext/xvid/gstxvidenc.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c
index 40b5be22c..c5598595d 100644
--- a/ext/xvid/gstxvidenc.c
+++ b/ext/xvid/gstxvidenc.c
@@ -60,6 +60,11 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-xvid, "
"width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], " "framerate = (fraction) [ 0/1, MAX ]; "
+ "video/mpeg, "
+ "mpegversion = (int) 4, "
+ "systemstream = (boolean) FALSE, "
+ "width = (int) [ 0, MAX ], "
"height = (int) [ 0, MAX ], " "framerate = (fraction) [ 0/1, MAX ]")
);
@@ -731,31 +736,37 @@ gst_xvidenc_setcaps (GstPad * pad, GstCaps * vscaps)
xvidenc->xframe_cache = NULL;
if (gst_xvidenc_setup (xvidenc)) {
- GstPadLinkReturn ret;
- GstCaps *new_caps;
- GstPad *peer;
+ gboolean ret = FALSE;
+ GstCaps *new_caps = NULL, *allowed_caps;
+
+ /* please downstream with preferred caps */
+ allowed_caps = gst_pad_get_allowed_caps (xvidenc->srcpad);
+ GST_DEBUG_OBJECT (xvidenc, "allowed caps: %" GST_PTR_FORMAT, allowed_caps);
+
+ if (allowed_caps && !gst_caps_is_empty (allowed_caps)) {
+ new_caps = gst_caps_copy_nth (allowed_caps, 0);
+ } else {
+ new_caps = gst_caps_new_simple ("video/x-xvid", NULL);
+ }
+ if (allowed_caps)
+ gst_caps_unref (allowed_caps);
- new_caps = gst_caps_new_simple ("video/x-xvid",
+ gst_caps_set_simple (new_caps,
"width", G_TYPE_INT, w, "height", G_TYPE_INT, h,
"framerate", GST_TYPE_FRACTION, xvidenc->fbase, xvidenc->fincr,
"pixel-aspect-ratio", GST_TYPE_FRACTION,
xvidenc->par_width, xvidenc->par_height, NULL);
+ /* just to be sure */
+ gst_pad_fixate_caps (xvidenc->srcpad, new_caps);
+
/* src pad should accept anyway */
ret = gst_pad_set_caps (xvidenc->srcpad, new_caps);
- if (!ret)
- goto exit;
- /* will peer accept */
- peer = gst_pad_get_peer (xvidenc->srcpad);
- if (peer)
- ret &= gst_pad_accept_caps (peer, new_caps);
- gst_object_unref (peer);
-
- exit:
+ gst_caps_unref (new_caps);
+
if (!ret && xvidenc->handle) {
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
xvidenc->handle = NULL;
}
- gst_caps_unref (new_caps);
return ret;
} else /* setup did not work out */