3c4a8233287abb8e93f008beb9f7d3ab0b5b656f
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / debian / patches / 0002-playback-make-uridecodebin-and-decodebin2-implement-.patch
1 From 43667763dd6e5aa95fea97651a3355981d3bce8e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim.muller@collabora.co.uk>
3 Date: Fri, 22 May 2009 20:10:00 +0100
4 Subject: [PATCH] playback: make uridecodebin and decodebin2 implement the
5  tagreader interface
6
7 .. so they can proxy the configured tag reading mode to any elements they
8 auto-plug. Tagreadbin will use this.
9 ---
10  gst/playback/Makefile.am       |    1 +
11  gst/playback/gstdecodebin2.c   |   16 ++++++++++++++++
12  gst/playback/gsturidecodebin.c |   13 ++++++++++++-
13  3 files changed, 29 insertions(+), 1 deletions(-)
14
15 diff --git a/gst/playback/Makefile.am b/gst/playback/Makefile.am
16 index 3adb56d..2c336f3 100644
17 --- a/gst/playback/Makefile.am
18 +++ b/gst/playback/Makefile.am
19 @@ -44,6 +44,7 @@ nodist_libgstdecodebin2_la_SOURCES = $(built_sources)
20  libgstdecodebin2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
21  libgstdecodebin2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
22  libgstdecodebin2_la_LIBADD = \
23 +       $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la \
24         $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
25         $(GST_LIBS)
26  libgstdecodebin2_la_LIBTOOLFLAGS = --tag=disable-static
27 diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c
28 index 31b5ebb..e73d3b7 100644
29 --- a/gst/playback/gstdecodebin2.c
30 +++ b/gst/playback/gstdecodebin2.c
31 @@ -88,6 +88,7 @@
32  #include <string.h>
33  #include <gst/gst.h>
34  #include <gst/pbutils/pbutils.h>
35 +#include <gst/tag/gsttagreader.h>
36  
37  #include "gstplay-marshal.h"
38  #include "gstplay-enum.h"
39 @@ -170,6 +171,7 @@ struct _GstDecodeBin
40    GList *blocked_pads;          /* pads that have set to block */
41  
42    gboolean expose_allstreams;   /* Whether to expose unknow type streams or not */
43 +  GstTagReadingMode tag_mode;
44  };
45  
46  struct _GstDecodeBinClass
47 @@ -510,6 +512,8 @@ gst_decode_bin_get_type (void)
48      gst_decode_bin_type =
49          g_type_register_static (GST_TYPE_BIN, "GstDecodeBin2",
50          &gst_decode_bin_info, 0);
51 +
52 +    gst_tag_reader_add_interface_to_type (gst_decode_bin_type);
53    }
54  
55    return gst_decode_bin_type;
56 @@ -1742,6 +1746,15 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad,
57        continue;
58      }
59  
60 +    /* if it's a tag reader, configure the tag reading mode */
61 +    if (dbin->tag_mode != GST_TAG_READING_MODE_DEFAULT &&
62 +        GST_IS_TAG_READER (element)) {
63 +      GST_DEBUG_OBJECT (dbin, "setting tag reading mode %d on element %s",
64 +          dbin->tag_mode, GST_ELEMENT_NAME (element));
65 +      gst_tag_reader_set_tag_reading_mode (GST_TAG_READER (element),
66 +          dbin->tag_mode);
67 +    }
68 +
69      /* ... activate it ... We do this before adding it to the bin so that we
70       * don't accidentally make it post error messages that will stop
71       * everything. */
72 @@ -3645,6 +3658,9 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
73  
74    switch (transition) {
75      case GST_STATE_CHANGE_NULL_TO_READY:
76 +      dbin->tag_mode =
77 +          gst_tag_reader_get_tag_reading_mode (GST_TAG_READER (dbin));
78 +      GST_LOG_OBJECT (dbin, "tag reading mode: %d", dbin->tag_mode);
79        if (dbin->typefind == NULL)
80          goto missing_typefind;
81        break;
82 diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c
83 index bf10583..8c4e3f2 100644
84 --- a/gst/playback/gsturidecodebin.c
85 +++ b/gst/playback/gsturidecodebin.c
86 @@ -33,6 +33,7 @@
87  #include <gst/gst.h>
88  #include <gst/gst-i18n-plugin.h>
89  #include <gst/pbutils/missing-plugins.h>
90 +#include <gst/tag/gsttagreader.h>
91  
92  #include "gstplay-marshal.h"
93  #include "gstplay-enum.h"
94 @@ -104,6 +105,8 @@ struct _GstURIDecodeBin
95    gboolean expose_allstreams;   /* Whether to expose unknow type streams or not */
96  
97    guint64 ring_buffer_max_size; /* 0 means disabled */
98 +
99 +  GstTagReadingMode tag_mode;
100  };
101  
102  struct _GstURIDecodeBinClass
103 @@ -186,7 +189,8 @@ enum
104  static guint gst_uri_decode_bin_signals[LAST_SIGNAL] = { 0 };
105  
106  GType gst_uri_decode_bin_get_type (void);
107 -GST_BOILERPLATE (GstURIDecodeBin, gst_uri_decode_bin, GstBin, GST_TYPE_BIN);
108 +GST_BOILERPLATE_FULL (GstURIDecodeBin, gst_uri_decode_bin, GstBin,
109 +    GST_TYPE_BIN, gst_tag_reader_add_interface_to_type);
110  
111  static void remove_decoders (GstURIDecodeBin * bin, gboolean force);
112  static void gst_uri_decode_bin_set_property (GObject * object, guint prop_id,
113 @@ -1544,6 +1548,10 @@ make_decoder (GstURIDecodeBin * decoder)
114      if (decodebin->numsinkpads == 0)
115        goto no_typefind;
116  
117 +    /* configure tag reading mode */
118 +    gst_tag_reader_set_tag_reading_mode (GST_TAG_READER (decodebin),
119 +        decoder->tag_mode);
120 +
121      /* connect signals to proxy */
122      g_signal_connect (decodebin, "unknown-type",
123          G_CALLBACK (proxy_unknown_type_signal), decoder);
124 @@ -2385,6 +2393,9 @@ gst_uri_decode_bin_change_state (GstElement * element,
125  
126    switch (transition) {
127      case GST_STATE_CHANGE_READY_TO_PAUSED:
128 +      decoder->tag_mode =
129 +          gst_tag_reader_get_tag_reading_mode (GST_TAG_READER (decoder));
130 +      GST_LOG_OBJECT (decoder, "tag reading mode: %d", decoder->tag_mode);
131        if (!setup_source (decoder))
132          goto source_failed;
133        break;