Commit 32814180 authored by Julien Moutte's avatar Julien Moutte
Browse files

ext/pango/gsttextoverlay.c: Refactoring of textoverlay without collectpads....

ext/pango/gsttextoverlay.c: Refactoring of textoverlay without collectpads. This now supports sparse subtitles coming...

Original commit message from CVS:
2006-02-18  Julien MOUTTE  <julien@moutte.net>

* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_setcaps), (gst_text_overlay_src_event),
(gst_text_overlay_render_text),
(gst_text_overlay_text_pad_link),
(gst_text_overlay_text_pad_unlink),
(gst_text_overlay_text_event),
(gst_text_overlay_video_event), (gst_text_overlay_pop_text),
(gst_text_overlay_text_chain), (gst_text_overlay_video_chain),
(gst_text_overlay_change_state): Refactoring of textoverlay
without collectpads. This now supports sparse subtitles coming
from a demuxer instead of a sub file. Seeking is still broken
though. Need to discuss with wtay some more on how to handle
seeking correctly.
* ext/pango/gsttextoverlay.h:
* gst/playback/gstplaybin.c: (setup_sinks): Support linking with
subtitles coming from the demuxer.
parent 9a55cf38
This diff is collapsed.
......@@ -2,7 +2,6 @@
#define __GST_TEXT_OVERLAY_H__
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include <pango/pangoft2.h>
G_BEGIN_DECLS
......@@ -53,9 +52,11 @@ struct _GstTextOverlay {
GstPad *text_sinkpad;
GstPad *srcpad;
GstCollectPads *collect;
GstCollectData *video_collect_data;
GstCollectData *text_collect_data;
GstSegment *segment;
GstBuffer *text_buffer;
gboolean text_linked;
GCond *cond; /* to signal removal of data */
gint width;
gint height;
......
......@@ -1154,25 +1154,34 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
goto beach;
}
ghost = gst_ghost_pad_new ("text_src", textsrcpad);
if (!GST_IS_PAD (ghost)) {
GST_WARNING_OBJECT (textsrcpad, "failed creating ghost pad for "
"subtitle-bin");
gst_object_unref (parent);
gst_object_unref (grandparent);
gst_object_unref (textsrcpad);
textsrcpad = NULL;
goto beach;
}
/* We ghost the pad on subtitle_bin only, if the text pad is from the
media demuxer we keep it as it is */
if (!GST_IS_PLAY_BIN (grandparent)) {
GST_DEBUG_OBJECT (textsrcpad, "this subtitle pad is from a subtitle "
"file, ghosting to a suitable hierarchy");
ghost = gst_ghost_pad_new ("text_src", textsrcpad);
if (!GST_IS_PAD (ghost)) {
GST_WARNING_OBJECT (textsrcpad, "failed creating ghost pad for "
"subtitle-bin");
gst_object_unref (parent);
gst_object_unref (grandparent);
gst_object_unref (textsrcpad);
textsrcpad = NULL;
goto beach;
}
if (gst_element_add_pad (GST_ELEMENT (grandparent), ghost)) {
gst_object_unref (textsrcpad);
textsrcpad = ghost;
if (gst_element_add_pad (GST_ELEMENT (grandparent), ghost)) {
gst_object_unref (textsrcpad);
textsrcpad = gst_object_ref (ghost);
} else {
GST_WARNING_OBJECT (ghost, "failed adding ghost pad on subtitle-bin");
gst_object_unref (ghost);
gst_object_unref (textsrcpad);
textsrcpad = NULL;
}
} else {
GST_WARNING_OBJECT (ghost, "failed adding ghost pad on subtitle-bin");
gst_object_unref (ghost);
gst_object_unref (textsrcpad);
textsrcpad = NULL;
GST_DEBUG_OBJECT (textsrcpad, "this subtitle pad is from the demuxer "
"no changes to hierarchy needed");
}
gst_object_unref (parent);
......@@ -1187,6 +1196,9 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
"src");
res = add_sink (play_bin, sink, pad, textsrcpad);
gst_object_unref (pad);
if (textsrcpad) {
gst_object_unref (textsrcpad);
}
}
/* remove the sinks now, pipeline get_state will now wait for the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment