mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
subtitleoverlay: Add new element for generic subtitle overlaying
This autopluggs the required elements for parsing and rendering different subtitle formats on a video stream. Fixes bug #600370.
This commit is contained in:
parent
05aa195981
commit
92ccb87850
4 changed files with 1794 additions and 2 deletions
|
@ -21,7 +21,8 @@ libgstplaybin_la_SOURCES = \
|
|||
gstinputselector.c \
|
||||
gstscreenshot.c \
|
||||
gststreaminfo.c \
|
||||
gststreamselector.c
|
||||
gststreamselector.c \
|
||||
gstsubtitleoverlay.c
|
||||
|
||||
nodist_libgstplaybin_la_SOURCES = $(built_sources)
|
||||
libgstplaybin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
|
@ -29,6 +30,7 @@ libgstplaybin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
|||
libgstplaybin_la_LIBADD = \
|
||||
$(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
|
||||
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
|
||||
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
|
||||
$(GST_LIBS)
|
||||
libgstplaybin_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
|
@ -59,7 +61,8 @@ noinst_HEADERS = \
|
|||
gstplay-enum.h \
|
||||
gstscreenshot.h \
|
||||
gststreamselector.h \
|
||||
gstrawcaps.h
|
||||
gstrawcaps.h \
|
||||
gstsubtitleoverlay.h
|
||||
|
||||
noinst_PROGRAMS = test decodetest test2 test3 test4 test5 test6 test7
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "gststreamselector.h"
|
||||
#include "gststreaminfo.h"
|
||||
#include "gstplaysink.h"
|
||||
#include "gstsubtitleoverlay.h"
|
||||
|
||||
gboolean gst_play_bin_plugin_init (GstPlugin * plugin);
|
||||
gboolean gst_play_bin2_plugin_init (GstPlugin * plugin);
|
||||
|
@ -56,6 +57,7 @@ plugin_init (GstPlugin * plugin)
|
|||
res = gst_play_bin_plugin_init (plugin);
|
||||
res &= gst_play_bin2_plugin_init (plugin);
|
||||
res &= gst_play_sink_plugin_init (plugin);
|
||||
res &= gst_subtitle_overlay_plugin_init (plugin);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
1671
gst/playback/gstsubtitleoverlay.c
Normal file
1671
gst/playback/gstsubtitleoverlay.c
Normal file
File diff suppressed because it is too large
Load diff
116
gst/playback/gstsubtitleoverlay.h
Normal file
116
gst/playback/gstsubtitleoverlay.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_SUBTITLE_OVERLAY_H__
|
||||
#define __GST_SUBTITLE_OVERLAY_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define GST_TYPE_SUBTITLE_OVERLAY \
|
||||
(gst_subtitle_overlay_get_type())
|
||||
#define GST_SUBTITLE_OVERLAY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBTITLE_OVERLAY, GstSubtitleOverlay))
|
||||
#define GST_SUBTITLE_OVERLAY_CAST(obj) \
|
||||
((GstSubtitleOverlay *) obj)
|
||||
#define GST_SUBTITLE_OVERLAY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBTITLE_OVERLAY, GstSubtitleOverlayClass))
|
||||
#define GST_IS_SUBTITLE_OVERLAY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBTITLE_OVERLAY))
|
||||
#define GST_IS_SUBTITLE_OVERLAY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBTITLE_OVERLAY))
|
||||
|
||||
#define GST_SUBTITLE_OVERLAY_LOCK(obj) G_STMT_START { \
|
||||
GST_LOG_OBJECT (obj, \
|
||||
"locking from thread %p", \
|
||||
g_thread_self ()); \
|
||||
g_mutex_lock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
|
||||
GST_LOG_OBJECT (obj, \
|
||||
"locked from thread %p", \
|
||||
g_thread_self ()); \
|
||||
} G_STMT_END
|
||||
|
||||
#define GST_SUBTITLE_OVERLAY_UNLOCK(obj) G_STMT_START { \
|
||||
GST_LOG_OBJECT (obj, \
|
||||
"unlocking from thread %p", \
|
||||
g_thread_self ()); \
|
||||
g_mutex_unlock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
|
||||
} G_STMT_END
|
||||
|
||||
typedef struct _GstSubtitleOverlay GstSubtitleOverlay;
|
||||
typedef struct _GstSubtitleOverlayClass GstSubtitleOverlayClass;
|
||||
|
||||
struct _GstSubtitleOverlay
|
||||
{
|
||||
GstBin parent;
|
||||
|
||||
gchar *font_desc;
|
||||
|
||||
gboolean do_async;
|
||||
|
||||
GstPad *srcpad;
|
||||
GstPadEventFunction src_proxy_event;
|
||||
|
||||
GstPad *video_sinkpad;
|
||||
GstPad *video_block_pad;
|
||||
GstPadEventFunction video_sink_event;
|
||||
gboolean video_sink_blocked;
|
||||
GstSegment video_segment;
|
||||
gboolean video_segment_pending;
|
||||
|
||||
GstPad *subtitle_sinkpad;
|
||||
GstPad *subtitle_block_pad;
|
||||
GstPadLinkFunction subtitle_sink_link;
|
||||
GstPadUnlinkFunction subtitle_sink_unlink;
|
||||
GstPadEventFunction subtitle_sink_event;
|
||||
GstPadSetCapsFunction subtitle_sink_setcaps;
|
||||
gboolean subtitle_sink_blocked;
|
||||
GstSegment subtitle_segment;
|
||||
gboolean subtitle_segment_pending;
|
||||
gboolean subtitle_flush;
|
||||
|
||||
GList *factories;
|
||||
GstCaps *factory_caps;
|
||||
|
||||
GMutex *lock;
|
||||
GstCaps *subcaps;
|
||||
|
||||
GstElement *passthrough_identity;
|
||||
|
||||
GstElement *pre_colorspace;
|
||||
GstElement *post_colorspace;
|
||||
|
||||
GstElement *parser;
|
||||
GstElement *overlay;
|
||||
|
||||
GstElement *renderer;
|
||||
};
|
||||
|
||||
struct _GstSubtitleOverlayClass
|
||||
{
|
||||
GstBinClass parent;
|
||||
};
|
||||
|
||||
GType gst_subtitle_overlay_get_type (void);
|
||||
gboolean gst_subtitle_overlay_plugin_init (GstPlugin * plugin);
|
||||
|
||||
GstCaps *gst_subtitle_overlay_create_factory_caps (void);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_SUBTITLE_OVERLAY_H__ */
|
Loading…
Reference in a new issue