summaryrefslogtreecommitdiff
path: root/ext/resindvd/resindvdbin.c
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2012-08-31 14:13:58 -0700
committerJan Schmidt <thaytan@noraisin.net>2012-08-31 14:22:59 -0700
commit8f719fea02d9b32f3f8747c024b482300adc4f20 (patch)
tree3b51de7a591f044b06c558ac6f94d82e630175fd /ext/resindvd/resindvdbin.c
parent463ac4c12f50572bf5381d540bf9295da887d6a5 (diff)
downloadgstreamer-plugins-bad-8f719fea02d9b32f3f8747c024b482300adc4f20.tar.gz
resindvd: Plug a video parser in front of decoder
Seems to make playback both better and worse. The parser needs some fixing, it seems :-/
Diffstat (limited to 'ext/resindvd/resindvdbin.c')
-rw-r--r--ext/resindvd/resindvdbin.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/ext/resindvd/resindvdbin.c b/ext/resindvd/resindvdbin.c
index 2fda97a15..1085e2fa0 100644
--- a/ext/resindvd/resindvdbin.c
+++ b/ext/resindvd/resindvdbin.c
@@ -338,6 +338,29 @@ _pad_block_destroy_notify (RsnDvdBinPadBlockCtx * ctx)
}
static gboolean
+try_link_pieces (GstElement * e1, const gchar * pad1, GstElement * e2,
+ const gchar * pad2)
+{
+ GstPad *src = gst_element_get_static_pad (e1, pad1);
+ GstPad *sink = gst_element_get_static_pad (e2, pad2);
+ gboolean ret = FALSE;
+
+ if (src == NULL || sink == NULL)
+ goto done;
+
+ if (GST_PAD_LINK_FAILED (gst_pad_link (src, sink)))
+ goto done;
+
+ ret = TRUE;
+done:
+ if (src)
+ gst_object_unref (src);
+ if (sink)
+ gst_object_unref (sink);
+ return ret;
+}
+
+static gboolean
create_elements (RsnDvdBin * dvdbin)
{
GstPadTemplate *src_templ = NULL;
@@ -380,6 +403,10 @@ create_elements (RsnDvdBin * dvdbin)
"max-size-time", (7 * GST_SECOND / 10), "max-size-bytes", 0,
"max-size-buffers", 0, NULL);
+ if (!try_create_piece (dvdbin, DVD_ELEM_VIDPARSE, "mpegvideoparse", 0,
+ "vidparse", "video parser"))
+ return FALSE;
+
/* Decodebin will throw a missing element message to find an MPEG decoder */
if (!try_create_piece (dvdbin, DVD_ELEM_VIDDEC, NULL, RSN_TYPE_VIDEODEC,
"viddec", "video decoder"))
@@ -390,6 +417,10 @@ create_elements (RsnDvdBin * dvdbin)
"rsnparsetter", "Aspect ratio adjustment"))
return FALSE;
+ if (!try_link_pieces (dvdbin->pieces[DVD_ELEM_VIDPARSE], "src",
+ dvdbin->pieces[DVD_ELEM_VIDDEC], "sink"))
+ goto failed_vidparse_connect;
+
src = gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_VIDDEC], "src");
sink = gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_PARSET], "sink");
if (src == NULL || sink == NULL)
@@ -512,6 +543,10 @@ failed_connect:
GST_ELEMENT_ERROR (dvdbin, CORE, FAILED, (NULL),
("Could not connect DVD source and demuxer elements"));
goto error_out;
+failed_vidparse_connect:
+ GST_ELEMENT_ERROR (dvdbin, CORE, FAILED, (NULL),
+ ("Could not connect DVD video parser and video decoder"));
+ goto error_out;
failed_viddec_connect:
GST_ELEMENT_ERROR (dvdbin, CORE, FAILED, (NULL),
("Could not connect DVD video decoder and aspect ratio adjuster"));
@@ -674,10 +709,10 @@ demux_pad_added (GstElement * element, GstPad * pad, RsnDvdBin * dvdbin)
s = gst_caps_get_structure (caps, 0);
g_return_if_fail (s != NULL);
- if (can_sink_caps (dvdbin->pieces[DVD_ELEM_VIDDEC], caps)) {
+ if (can_sink_caps (dvdbin->pieces[DVD_ELEM_VIDPARSE], caps)) {
GST_LOG_OBJECT (dvdbin, "Found video pad w/ caps %" GST_PTR_FORMAT, caps);
dest_pad =
- gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_VIDDEC], "sink");
+ gst_element_get_static_pad (dvdbin->pieces[DVD_ELEM_VIDPARSE], "sink");
} else if (g_str_equal (gst_structure_get_name (s), "subpicture/x-dvd")) {
GST_LOG_OBJECT (dvdbin, "Found subpicture pad w/ caps %" GST_PTR_FORMAT,
caps);