~ubuntu-branches/ubuntu/trusty/gstreamer1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to libs/gst/base/gstbasesrc.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2012-08-08 18:12:33 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120808181233-riejwxprfsxh1njl
Tags: 0.11.93-1
* New upstream release:
  + debian/libgstreamer.symbols:
    - Update symbols file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
 * distributed and running.
91
91
 *
92
92
 * Live sources that synchronize and block on the clock (an audio source, for
93
 
 * example) can since 0.10.12 use gst_base_src_wait_playing() when the
 
93
 * example) can use gst_base_src_wait_playing() when the
94
94
 * #GstBaseSrcClass.create() function was interrupted by a state change to
95
95
 * PAUSED.
96
96
 *
138
138
 * EOS message posted on the pipeline's bus to know when all data has
139
139
 * been processed and the pipeline can safely be stopped.
140
140
 *
141
 
 * Since GStreamer 0.10.16 an application may send an EOS event to a source
142
 
 * element to make it perform the EOS logic (send EOS event downstream or post a
 
141
 * An application may send an EOS event to a source element to make it
 
142
 * perform the EOS logic (send EOS event downstream or post a
143
143
 * #GST_MESSAGE_SEGMENT_DONE on the bus). This can typically be done
144
144
 * with the gst_element_send_event() function on the element or its parent bin.
145
145
 *
484
484
 * to a state change to READY or a FLUSH event (in which case this function
485
485
 * returns #GST_FLOW_FLUSHING).
486
486
 *
487
 
 * Since: 0.10.12
488
 
 *
489
487
 * Returns: #GST_FLOW_OK if @src is PLAYING and processing can
490
488
 * continue. Any other return value should be returned from the create vmethod.
491
489
 */
571
569
 * operate in pull mode if the #GstBaseSrcClass.is_seekable() returns TRUE.
572
570
 *
573
571
 * This function must only be called in states < %GST_STATE_PAUSED.
574
 
 *
575
 
 * Since: 0.10.1
576
572
 */
577
573
void
578
574
gst_base_src_set_format (GstBaseSrc * src, GstFormat format)
593
589
 * If not @dynamic, size is only updated when needed, such as when trying to
594
590
 * read past current tracked size.  Otherwise, size is checked for upon each
595
591
 * read.
596
 
 *
597
 
 * Since: 0.10.36
598
592
 */
599
593
void
600
594
gst_base_src_set_dynamic_size (GstBaseSrc * src, gboolean dynamic)
662
656
 * This function is mostly used by subclasses.
663
657
 *
664
658
 * Returns: TRUE if the query succeeded.
665
 
 *
666
 
 * Since: 0.10.13
667
659
 */
668
660
gboolean
669
661
gst_base_src_query_latency (GstBaseSrc * src, gboolean * live,
705
697
 *
706
698
 * Set the number of bytes that @src will push out with each buffer. When
707
699
 * @blocksize is set to -1, a default length will be used.
708
 
 *
709
 
 * Since: 0.10.22
710
700
 */
711
701
void
712
702
gst_base_src_set_blocksize (GstBaseSrc * src, guint blocksize)
725
715
 * Get the number of bytes that @src will push out with each buffer.
726
716
 *
727
717
 * Returns: the number of bytes pushed with each buffer.
728
 
 *
729
 
 * Since: 0.10.22
730
718
 */
731
719
guint
732
720
gst_base_src_get_blocksize (GstBaseSrc * src)
751
739
 * Configure @src to automatically timestamp outgoing buffers based on the
752
740
 * current running_time of the pipeline. This property is mostly useful for live
753
741
 * sources.
754
 
 *
755
 
 * Since: 0.10.15
756
742
 */
757
743
void
758
744
gst_base_src_set_do_timestamp (GstBaseSrc * src, gboolean timestamp)
771
757
 * Query if @src timestamps outgoing buffers based on the current running_time.
772
758
 *
773
759
 * Returns: %TRUE if the base class will automatically timestamp outgoing buffers.
774
 
 *
775
 
 * Since: 0.10.15
776
760
 */
777
761
gboolean
778
762
gst_base_src_get_do_timestamp (GstBaseSrc * src)
803
787
 * configured with gst_base_src_set_format()
804
788
 *
805
789
 * Returns: %TRUE if preparation of the seamless segment succeeded.
806
 
 *
807
 
 * Since: 0.10.26
808
790
 */
809
791
gboolean
810
792
gst_base_src_new_seamless_segment (GstBaseSrc * src, gint64 start, gint64 stop,
841
823
  gboolean ret = TRUE;
842
824
 
843
825
  if (src->priv->stream_start_pending) {
844
 
    ret = gst_pad_push_event (src->srcpad, gst_event_new_stream_start ());
 
826
    gchar *stream_id;
 
827
 
 
828
    stream_id =
 
829
        gst_pad_create_stream_id (src->srcpad, GST_ELEMENT_CAST (src), NULL);
 
830
 
 
831
    GST_DEBUG_OBJECT (src, "Pushing STREAM_START");
 
832
    ret =
 
833
        gst_pad_push_event (src->srcpad,
 
834
        gst_event_new_stream_start (stream_id));
845
835
    src->priv->stream_start_pending = FALSE;
 
836
    g_free (stream_id);
846
837
  }
847
838
 
848
839
  return ret;
866
857
  bclass = GST_BASE_SRC_GET_CLASS (src);
867
858
 
868
859
  gst_base_src_send_stream_start (src);
869
 
  gst_pad_push_event (src->srcpad, gst_event_new_caps (caps));
870
860
 
871
861
  if (bclass->set_caps)
872
862
    res = bclass->set_caps (src, caps);
 
863
  if (res)
 
864
    res = gst_pad_set_caps (src->srcpad, caps);
873
865
 
874
866
  return res;
875
867
}
1210
1202
        res = FALSE;
1211
1203
      break;
1212
1204
    }
 
1205
    case GST_QUERY_URI:{
 
1206
      if (GST_IS_URI_HANDLER (src)) {
 
1207
        gchar *uri = gst_uri_handler_get_uri (GST_URI_HANDLER (src));
 
1208
 
 
1209
        if (uri != NULL) {
 
1210
          gst_query_set_uri (query, uri);
 
1211
          g_free (uri);
 
1212
          res = TRUE;
 
1213
        } else {
 
1214
          res = FALSE;
 
1215
        }
 
1216
      } else {
 
1217
        res = FALSE;
 
1218
      }
 
1219
      break;
 
1220
    }
1213
1221
    default:
1214
1222
      res = FALSE;
1215
1223
      break;
1282
1290
   *     seek format, adjust by the relative seek offset and then convert back to
1283
1291
   *     the processing format
1284
1292
   */
1285
 
  GstSeekType cur_type, stop_type;
1286
 
  gint64 cur, stop;
 
1293
  GstSeekType start_type, stop_type;
 
1294
  gint64 start, stop;
1287
1295
  GstSeekFlags flags;
1288
1296
  GstFormat seek_format, dest_format;
1289
1297
  gdouble rate;
1291
1299
  gboolean res = TRUE;
1292
1300
 
1293
1301
  gst_event_parse_seek (event, &rate, &seek_format, &flags,
1294
 
      &cur_type, &cur, &stop_type, &stop);
 
1302
      &start_type, &start, &stop_type, &stop);
1295
1303
  dest_format = segment->format;
1296
1304
 
1297
1305
  if (seek_format == dest_format) {
1298
1306
    gst_segment_do_seek (segment, rate, seek_format, flags,
1299
 
        cur_type, cur, stop_type, stop, &update);
 
1307
        start_type, start, stop_type, stop, &update);
1300
1308
    return TRUE;
1301
1309
  }
1302
1310
 
1303
 
  if (cur_type != GST_SEEK_TYPE_NONE) {
1304
 
    /* FIXME: Handle seek_cur & seek_end by converting the input segment vals */
 
1311
  if (start_type != GST_SEEK_TYPE_NONE) {
 
1312
    /* FIXME: Handle seek_end by converting the input segment vals */
1305
1313
    res =
1306
 
        gst_pad_query_convert (src->srcpad, seek_format, cur, dest_format,
1307
 
        &cur);
1308
 
    cur_type = GST_SEEK_TYPE_SET;
 
1314
        gst_pad_query_convert (src->srcpad, seek_format, start, dest_format,
 
1315
        &start);
 
1316
    start_type = GST_SEEK_TYPE_SET;
1309
1317
  }
1310
1318
 
1311
1319
  if (res && stop_type != GST_SEEK_TYPE_NONE) {
1312
 
    /* FIXME: Handle seek_cur & seek_end by converting the input segment vals */
 
1320
    /* FIXME: Handle seek_end by converting the input segment vals */
1313
1321
    res =
1314
1322
        gst_pad_query_convert (src->srcpad, seek_format, stop, dest_format,
1315
1323
        &stop);
1317
1325
  }
1318
1326
 
1319
1327
  /* And finally, configure our output segment in the desired format */
1320
 
  gst_segment_do_seek (segment, rate, dest_format, flags, cur_type, cur,
 
1328
  gst_segment_do_seek (segment, rate, dest_format, flags, start_type, start,
1321
1329
      stop_type, stop, &update);
1322
1330
 
1323
1331
  if (!res)
1482
1490
 * instead of EOS when doing a segment seek.
1483
1491
 */
1484
1492
static gboolean
1485
 
gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event)
 
1493
gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
1486
1494
{
1487
1495
  gboolean res = TRUE, tres;
1488
1496
  gdouble rate;
1489
1497
  GstFormat seek_format, dest_format;
1490
1498
  GstSeekFlags flags;
1491
 
  GstSeekType cur_type, stop_type;
1492
 
  gint64 cur, stop;
 
1499
  GstSeekType start_type, stop_type;
 
1500
  gint64 start, stop;
1493
1501
  gboolean flush, playing;
1494
1502
  gboolean update;
1495
1503
  gboolean relative_seek = FALSE;
1506
1514
 
1507
1515
  if (event) {
1508
1516
    gst_event_parse_seek (event, &rate, &seek_format, &flags,
1509
 
        &cur_type, &cur, &stop_type, &stop);
 
1517
        &start_type, &start, &stop_type, &stop);
1510
1518
 
1511
 
    relative_seek = SEEK_TYPE_IS_RELATIVE (cur_type) ||
 
1519
    relative_seek = SEEK_TYPE_IS_RELATIVE (start_type) ||
1512
1520
        SEEK_TYPE_IS_RELATIVE (stop_type);
1513
1521
 
1514
1522
    if (dest_format != seek_format && !relative_seek) {
1541
1549
    gst_pad_pause_task (src->srcpad);
1542
1550
 
1543
1551
  /* unblock streaming thread. */
1544
 
  gst_base_src_set_flushing (src, TRUE, FALSE, &playing);
 
1552
  if (unlock)
 
1553
    gst_base_src_set_flushing (src, TRUE, FALSE, &playing);
1545
1554
 
1546
1555
  /* grab streaming lock, this should eventually be possible, either
1547
1556
   * because the task is paused, our streaming thread stopped
1556
1565
    GST_DEBUG_OBJECT (src, "seek with seqnum %" G_GUINT32_FORMAT, seqnum);
1557
1566
  }
1558
1567
 
1559
 
  gst_base_src_set_flushing (src, FALSE, playing, NULL);
 
1568
  if (unlock)
 
1569
    gst_base_src_set_flushing (src, FALSE, playing, NULL);
1560
1570
 
1561
1571
  /* If we configured the seeksegment above, don't overwrite it now. Otherwise
1562
1572
   * copy the current segment info into the temp segment that we can actually
1579
1589
        /* The seek format matches our processing format, no need to ask the
1580
1590
         * the subclass to configure the segment. */
1581
1591
        gst_segment_do_seek (&seeksegment, rate, seek_format, flags,
1582
 
            cur_type, cur, stop_type, stop, &update);
 
1592
            start_type, start, stop_type, stop, &update);
1583
1593
      }
1584
1594
    }
1585
1595
    /* Else, no seek event passed, so we're just (re)starting the
1619
1629
    memcpy (&src->segment, &seeksegment, sizeof (GstSegment));
1620
1630
    GST_OBJECT_UNLOCK (src);
1621
1631
 
1622
 
    if (seeksegment.flags & GST_SEEK_FLAG_SEGMENT) {
 
1632
    if (seeksegment.flags & GST_SEGMENT_FLAG_SEGMENT) {
1623
1633
      GstMessage *message;
1624
1634
 
1625
1635
      message = gst_message_new_segment_start (GST_OBJECT (src),
1642
1652
  /* and restart the task in case it got paused explicitly or by
1643
1653
   * the FLUSH_START event we pushed out. */
1644
1654
  tres = gst_pad_start_task (src->srcpad, (GstTaskFunction) gst_base_src_loop,
1645
 
      src->srcpad);
 
1655
      src->srcpad, NULL);
1646
1656
  if (res && !tres)
1647
1657
    res = FALSE;
1648
1658
 
1674
1684
  switch (GST_EVENT_TYPE (event)) {
1675
1685
      /* bidirectional events */
1676
1686
    case GST_EVENT_FLUSH_START:
 
1687
      GST_DEBUG_OBJECT (src, "pushing flush-start event downstream");
 
1688
      result = gst_pad_push_event (src->srcpad, event);
 
1689
      event = NULL;
 
1690
      break;
1677
1691
    case GST_EVENT_FLUSH_STOP:
 
1692
      GST_LIVE_LOCK (src->srcpad);
 
1693
      src->priv->segment_pending = TRUE;
1678
1694
      /* sending random flushes downstream can break stuff,
1679
1695
       * especially sync since all segment info will get flushed */
 
1696
      GST_DEBUG_OBJECT (src, "pushing flush-stop event downstream");
 
1697
      result = gst_pad_push_event (src->srcpad, event);
 
1698
      GST_LIVE_UNLOCK (src->srcpad);
 
1699
      event = NULL;
1680
1700
      break;
1681
1701
 
1682
1702
      /* downstream serialized events */
1761
1781
        GST_DEBUG_OBJECT (src, "performing seek");
1762
1782
        /* when we are running in push mode, we can execute the
1763
1783
         * seek right now. */
1764
 
        result = gst_base_src_perform_seek (src, event);
 
1784
        result = gst_base_src_perform_seek (src, event, TRUE);
1765
1785
      } else {
1766
1786
        GstEvent **event_p;
1767
1787
 
1856
1876
      if (!gst_base_src_seekable (src))
1857
1877
        goto not_seekable;
1858
1878
 
1859
 
      result = gst_base_src_perform_seek (src, event);
 
1879
      result = gst_base_src_perform_seek (src, event, TRUE);
1860
1880
      break;
1861
1881
    case GST_EVENT_FLUSH_START:
1862
1882
      /* cancel any blocking getrange, is normally called
2012
2032
  GstBaseSrcClass *bclass;
2013
2033
  GstClockTime base_time;
2014
2034
  GstClock *clock;
2015
 
  GstClockTime now = GST_CLOCK_TIME_NONE, timestamp;
 
2035
  GstClockTime now = GST_CLOCK_TIME_NONE, pts, dts, timestamp;
2016
2036
  gboolean do_timestamp, first, pseudo_live, is_live;
2017
2037
 
2018
2038
  bclass = GST_BASE_SRC_GET_CLASS (basesrc);
2022
2042
    bclass->get_times (basesrc, buffer, &start, &end);
2023
2043
 
2024
2044
  /* get buffer timestamp */
2025
 
  timestamp = GST_BUFFER_TIMESTAMP (buffer);
 
2045
  dts = GST_BUFFER_DTS (buffer);
 
2046
  pts = GST_BUFFER_PTS (buffer);
 
2047
 
 
2048
  if (GST_CLOCK_TIME_IS_VALID (dts))
 
2049
    timestamp = dts;
 
2050
  else
 
2051
    timestamp = pts;
2026
2052
 
2027
2053
  /* grab the lock to prepare for clocking and calculate the startup
2028
2054
   * latency. */
2081
2107
    running_time = now - base_time;
2082
2108
 
2083
2109
    GST_LOG_OBJECT (basesrc,
2084
 
        "startup timestamp: %" GST_TIME_FORMAT ", running_time %"
2085
 
        GST_TIME_FORMAT, GST_TIME_ARGS (timestamp),
2086
 
        GST_TIME_ARGS (running_time));
 
2110
        "startup PTS: %" GST_TIME_FORMAT ", DTS %" GST_TIME_FORMAT
 
2111
        ", running_time %" GST_TIME_FORMAT, GST_TIME_ARGS (pts),
 
2112
        GST_TIME_ARGS (dts), GST_TIME_ARGS (running_time));
2087
2113
 
2088
2114
    if (pseudo_live && timestamp != -1) {
2089
2115
      /* live source and we need to sync, add startup latency to all timestamps
2098
2124
      GST_LOG_OBJECT (basesrc, "no timestamp offset needed");
2099
2125
    }
2100
2126
 
2101
 
    if (!GST_CLOCK_TIME_IS_VALID (timestamp)) {
2102
 
      if (do_timestamp)
2103
 
        timestamp = running_time;
2104
 
      else
2105
 
        timestamp = 0;
2106
 
 
2107
 
      GST_BUFFER_TIMESTAMP (buffer) = timestamp;
2108
 
 
2109
 
      GST_LOG_OBJECT (basesrc, "created timestamp: %" GST_TIME_FORMAT,
2110
 
          GST_TIME_ARGS (timestamp));
 
2127
    if (!GST_CLOCK_TIME_IS_VALID (dts)) {
 
2128
      if (do_timestamp) {
 
2129
        dts = running_time;
 
2130
      } else {
 
2131
        dts = 0;
 
2132
      }
 
2133
      GST_BUFFER_DTS (buffer) = dts;
 
2134
 
 
2135
      GST_LOG_OBJECT (basesrc, "created DTS %" GST_TIME_FORMAT,
 
2136
          GST_TIME_ARGS (dts));
2111
2137
    }
2112
 
 
2113
 
    /* add the timestamp offset we need for sync */
2114
 
    timestamp += basesrc->priv->ts_offset;
2115
2138
  } else {
2116
2139
    /* not the first buffer, the timestamp is the diff between the clock and
2117
2140
     * base_time */
2118
 
    if (do_timestamp && !GST_CLOCK_TIME_IS_VALID (timestamp)) {
 
2141
    if (do_timestamp && !GST_CLOCK_TIME_IS_VALID (dts)) {
2119
2142
      now = gst_clock_get_time (clock);
2120
2143
 
2121
 
      GST_BUFFER_TIMESTAMP (buffer) = now - base_time;
 
2144
      dts = now - base_time;
 
2145
      GST_BUFFER_DTS (buffer) = dts;
2122
2146
 
2123
 
      GST_LOG_OBJECT (basesrc, "created timestamp: %" GST_TIME_FORMAT,
2124
 
          GST_TIME_ARGS (now - base_time));
 
2147
      GST_LOG_OBJECT (basesrc, "created DTS %" GST_TIME_FORMAT,
 
2148
          GST_TIME_ARGS (dts));
2125
2149
    }
2126
2150
  }
 
2151
  if (!GST_CLOCK_TIME_IS_VALID (pts)) {
 
2152
    if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT))
 
2153
      pts = dts;
 
2154
 
 
2155
    GST_BUFFER_PTS (buffer) = dts;
 
2156
 
 
2157
    GST_LOG_OBJECT (basesrc, "created PTS %" GST_TIME_FORMAT,
 
2158
        GST_TIME_ARGS (pts));
 
2159
  }
2127
2160
 
2128
2161
  /* if we don't have a buffer timestamp, we don't sync */
2129
2162
  if (!GST_CLOCK_TIME_IS_VALID (start))
2130
2163
    goto no_sync;
2131
2164
 
2132
 
  if (is_live && GST_CLOCK_TIME_IS_VALID (timestamp)) {
 
2165
  if (is_live) {
2133
2166
    /* for pseudo live sources, add our ts_offset to the timestamp */
2134
 
    GST_BUFFER_TIMESTAMP (buffer) += basesrc->priv->ts_offset;
 
2167
    if (GST_CLOCK_TIME_IS_VALID (pts))
 
2168
      GST_BUFFER_PTS (buffer) += basesrc->priv->ts_offset;
 
2169
    if (GST_CLOCK_TIME_IS_VALID (dts))
 
2170
      GST_BUFFER_DTS (buffer) += basesrc->priv->ts_offset;
2135
2171
    start += basesrc->priv->ts_offset;
2136
2172
  }
2137
2173
 
2251
2287
  GstBaseSrcClass *bclass;
2252
2288
  GstClockReturn status;
2253
2289
  GstBuffer *res_buf;
 
2290
  GstBuffer *in_buf;
2254
2291
 
2255
2292
  bclass = GST_BASE_SRC_GET_CLASS (src);
2256
2293
 
2296
2333
      "calling create offset %" G_GUINT64_FORMAT " length %u, time %"
2297
2334
      G_GINT64_FORMAT, offset, length, src->segment.time);
2298
2335
 
2299
 
  res_buf = *buf;
 
2336
  res_buf = in_buf = *buf;
2300
2337
 
2301
2338
  ret = bclass->create (src, offset, length, &res_buf);
2302
2339
 
2314
2351
  if (G_UNLIKELY (ret != GST_FLOW_OK))
2315
2352
    goto not_ok;
2316
2353
 
 
2354
  /* fallback in case the create function didn't fill a provided buffer */
 
2355
  if (in_buf != NULL && res_buf != in_buf) {
 
2356
    GstMapInfo info;
 
2357
    gsize copied_size;
 
2358
 
 
2359
    GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, src, "create function didn't "
 
2360
        "fill the provided buffer, copying");
 
2361
 
 
2362
    gst_buffer_map (in_buf, &info, GST_MAP_WRITE);
 
2363
    copied_size = gst_buffer_extract (res_buf, 0, info.data, info.size);
 
2364
    gst_buffer_unmap (in_buf, &info);
 
2365
    gst_buffer_set_size (in_buf, copied_size);
 
2366
 
 
2367
    gst_buffer_copy_into (in_buf, res_buf, GST_BUFFER_COPY_METADATA, 0, -1);
 
2368
 
 
2369
    gst_buffer_unref (res_buf);
 
2370
    res_buf = in_buf;
 
2371
  }
 
2372
 
2317
2373
  /* no timestamp set and we are at offset 0, we can timestamp with 0 */
2318
2374
  if (offset == 0 && src->segment.time == 0
2319
 
      && GST_BUFFER_TIMESTAMP (res_buf) == -1 && !src->is_live) {
 
2375
      && GST_BUFFER_DTS (res_buf) == -1 && !src->is_live) {
2320
2376
    GST_DEBUG_OBJECT (src, "setting first timestamp to 0");
2321
2377
    res_buf = gst_buffer_make_writable (res_buf);
2322
 
    GST_BUFFER_TIMESTAMP (res_buf) = 0;
 
2378
    GST_BUFFER_DTS (res_buf) = 0;
2323
2379
  }
2324
2380
 
2325
2381
  /* now sync before pushing the buffer */
2678
2734
      gint64 position;
2679
2735
 
2680
2736
      /* perform EOS logic */
2681
 
      flag_segment = (src->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0;
 
2737
      flag_segment = (src->segment.flags & GST_SEGMENT_FLAG_SEGMENT) != 0;
2682
2738
      format = src->segment.format;
2683
2739
      position = src->segment.position;
2684
2740
 
2689
2745
            format, position);
2690
2746
        gst_message_set_seqnum (message, src->priv->seqnum);
2691
2747
        gst_element_post_message (GST_ELEMENT_CAST (src), message);
 
2748
        event = gst_event_new_segment_done (format, position);
 
2749
        gst_event_set_seqnum (event, src->priv->seqnum);
 
2750
        gst_pad_push_event (pad, event);
2692
2751
      } else {
2693
2752
        event = gst_event_new_eos ();
2694
2753
        gst_event_set_seqnum (event, src->priv->seqnum);
2755
2814
    gst_object_unref (oldpool);
2756
2815
  }
2757
2816
  if (oldalloc) {
2758
 
    gst_allocator_unref (oldalloc);
 
2817
    gst_object_unref (oldalloc);
2759
2818
  }
2760
2819
  return TRUE;
2761
2820
 
2838
2897
  else
2839
2898
    gst_query_add_allocation_param (query, allocator, &params);
2840
2899
  if (allocator)
2841
 
    gst_allocator_unref (allocator);
 
2900
    gst_object_unref (allocator);
2842
2901
 
2843
2902
  if (pool) {
2844
2903
    gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
3071
3130
 
3072
3131
/**
3073
3132
 * gst_base_src_start_complete:
3074
 
 * @src: base source instance
 
3133
 * @basesrc: base source instance
3075
3134
 * @ret: a #GstFlowReturn
3076
3135
 *
3077
3136
 * Complete an asynchronous start operation. When the subclass overrides the
3146
3205
    basesrc->pending_seek = NULL;
3147
3206
    GST_OBJECT_UNLOCK (basesrc);
3148
3207
 
3149
 
    /* The perform seek code will start the task when finished. */
3150
 
    if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event)))
 
3208
    /* The perform seek code will start the task when finished. We don't have to
 
3209
     * unlock the streaming thread because it is not running yet */
 
3210
    if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE)))
3151
3211
      goto seek_failed;
3152
3212
 
3153
3213
    if (event)
3200
3260
 
3201
3261
/**
3202
3262
 * gst_base_src_start_wait:
3203
 
 * @src: base source instance
3204
 
 * @ret: a #GstFlowReturn
 
3263
 * @basesrc: base source instance
3205
3264
 *
3206
3265
 * Wait until the start operation completes.
3207
3266
 *
3284
3343
 
3285
3344
  bclass = GST_BASE_SRC_GET_CLASS (basesrc);
3286
3345
 
 
3346
  GST_DEBUG_OBJECT (basesrc, "flushing %d, live_play %d", flushing, live_play);
 
3347
 
3287
3348
  if (flushing) {
3288
3349
    gst_base_src_activate_pool (basesrc, FALSE);
3289
3350
    /* unlock any subclasses, we need to do this before grabbing the
3383
3444
    GST_OBJECT_UNLOCK (basesrc->srcpad);
3384
3445
    if (start)
3385
3446
      gst_pad_start_task (basesrc->srcpad, (GstTaskFunction) gst_base_src_loop,
3386
 
          basesrc->srcpad);
 
3447
          basesrc->srcpad, NULL);
3387
3448
    GST_DEBUG_OBJECT (basesrc, "signal");
3388
3449
    GST_LIVE_SIGNAL (basesrc);
3389
3450
  }
3471
3532
    GstPadMode mode, gboolean active)
3472
3533
{
3473
3534
  gboolean res;
 
3535
  GstBaseSrc *src = GST_BASE_SRC (parent);
 
3536
 
 
3537
  src->priv->stream_start_pending = FALSE;
3474
3538
 
3475
3539
  switch (mode) {
3476
3540
    case GST_PAD_MODE_PULL:
3477
3541
      res = gst_base_src_activate_pull (pad, parent, active);
3478
3542
      break;
3479
3543
    case GST_PAD_MODE_PUSH:
 
3544
      src->priv->stream_start_pending = active;
3480
3545
      res = gst_base_src_activate_push (pad, parent, active);
3481
3546
      break;
3482
3547
    default:
3501
3566
    case GST_STATE_CHANGE_NULL_TO_READY:
3502
3567
      break;
3503
3568
    case GST_STATE_CHANGE_READY_TO_PAUSED:
3504
 
      basesrc->priv->stream_start_pending = TRUE;
3505
3569
      no_preroll = gst_base_src_is_live (basesrc);
3506
3570
      break;
3507
3571
    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
3535
3599
       * already did this */
3536
3600
      g_atomic_int_set (&basesrc->priv->pending_eos, FALSE);
3537
3601
      gst_event_replace (&basesrc->pending_seek, NULL);
3538
 
      basesrc->priv->stream_start_pending = FALSE;
3539
3602
      break;
3540
3603
    }
3541
3604
    case GST_STATE_CHANGE_READY_TO_NULL: