64968ffb410a1712dd48ce81e850f98f196a3526
[vuplus_openvuplus] / meta-openvuplus / recipes-multimedia / gstreamer / gstreamer-0.10.36.1+git / multiqueue-sparsestreams.patch
1 --- ./plugins/elements/gstmultiqueue.c-original 2013-01-08 14:40:09.002563354 +0100
2 +++ ./plugins/elements/gstmultiqueue.c  2013-01-08 14:39:45.578850244 +0100
3 @@ -161,6 +161,7 @@
4    GstDataQueueSize max_size, extra_size;
5    GstClockTime cur_time;
6    gboolean is_eos;
7 +  gboolean is_sparse;
8    gboolean flushing;
9  
10    /* Protected by global lock */
11 @@ -801,6 +802,12 @@
12    return result;
13  }
14  
15 +static gboolean
16 +is_sparse (GstSingleQueue * sq)
17 +{
18 +  return sq->is_sparse;
19 +}
20 +
21  static void
22  update_buffering (GstMultiQueue * mq, GstSingleQueue * sq)
23  {
24 @@ -822,6 +829,8 @@
25    /* get bytes and time percentages and take the max */
26    if (sq->is_eos) {
27      percent = 100;
28 +  } else if (is_sparse (sq)) {
29 +    percent = 100;
30    } else {
31      percent = 0;
32      if (sq->max_size.time > 0) {
33 @@ -1606,15 +1615,26 @@
34    GstSingleQueue *sq = gst_pad_get_element_private (pad);
35    GstPad *otherpad;
36    GstCaps *result;
37 -
38 +  GstStructure* str;
39 +  const gchar *g_type;
40 +
41    otherpad = (pad == sq->srcpad) ? sq->sinkpad : sq->srcpad;
42  
43 -  GST_LOG_OBJECT (otherpad, "Getting caps from the peer of this pad");
44 -
45    result = gst_pad_peer_get_caps (otherpad);
46    if (result == NULL)
47      result = gst_caps_new_any ();
48  
49 +  str = gst_caps_get_structure(result, 0);
50 +  g_type = str ? gst_structure_get_name(str) : (const gchar*)"unknown";
51 +
52 +  GST_LOG_OBJECT (otherpad, "Got caps from the peer of this pad: %s", g_type);
53 +
54 +  if ( !g_strcmp0(g_type, "video/x-dvd-subpicture") || !g_strcmp0(g_type, "text/x-pango-markup") || !g_strcmp0(g_type, "text/plain") || !g_strcmp0(g_type, "subpicture/x-pgs") )
55 +  {
56 +    GST_INFO_OBJECT (otherpad, "subtitle stream discovered --> set is_sparse to true");
57 +    sq->is_sparse = TRUE;
58 +  }
59 +
60    return result;
61  }
62  
63 @@ -1841,7 +1861,7 @@
64  
65      GST_LOG_OBJECT (mq, "Checking Queue %d", oq->id);
66  
67 -    if (gst_data_queue_is_empty (oq->queue)) {
68 +    if (gst_data_queue_is_empty (oq->queue) && !is_sparse (oq)) {
69        GST_LOG_OBJECT (mq, "Queue %d is empty", oq->id);
70        if (IS_FILLED (sq, visible, size.visible)) {
71          sq->max_size.visible = size.visible + 1;
72 @@ -1868,7 +1888,7 @@
73       *    we are checking here.
74       */
75      if (sq->is_eos || IS_FILLED (sq, bytes, ssize.bytes) ||
76 -        IS_FILLED (sq, time, sq->cur_time)) {
77 +        IS_FILLED (sq, time, sq->cur_time) || is_sparse (oq)) {
78        GST_LOG_OBJECT (mq, "Queue %d is filled", oq->id);
79        filled = TRUE;
80      }
81 @@ -1911,7 +1931,7 @@
82          gst_data_queue_limits_changed (oq->queue);
83        }
84      }
85 -    if (!gst_data_queue_is_empty (oq->queue))
86 +    if (!gst_data_queue_is_empty (oq->queue) || is_sparse (oq))
87        empty = FALSE;
88    }
89    GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
90 @@ -2011,6 +2031,7 @@
91        (GstDataQueueFullCallback) single_queue_overrun_cb,
92        (GstDataQueueEmptyCallback) single_queue_underrun_cb, sq);
93    sq->is_eos = FALSE;
94 +  sq->is_sparse = FALSE;
95    sq->flushing = FALSE;
96    gst_segment_init (&sq->sink_segment, GST_FORMAT_TIME);
97    gst_segment_init (&sq->src_segment, GST_FORMAT_TIME);