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

« back to all changes in this revision

Viewing changes to libs/gst/base/gstcollectpads.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:
78
78
 * </itemizedlist>
79
79
 *
80
80
 * Last reviewed on 2011-10-28 (0.10.36)
81
 
 *
82
 
 * Since: 0.10.36
83
81
 */
84
82
 
85
83
#ifdef HAVE_CONFIG_H
109
107
{
110
108
  /* with LOCK and/or STREAM_LOCK */
111
109
  gboolean started;
 
110
  gboolean stream_started;
112
111
 
113
112
  /* with STREAM_LOCK */
114
113
  guint32 cookie;               /* @data list cookie */
235
234
  pads->priv->queuedpads = 0;
236
235
  pads->priv->eospads = 0;
237
236
  pads->priv->started = FALSE;
 
237
  pads->priv->stream_started = FALSE;
238
238
 
239
239
  g_rec_mutex_init (&pads->stream_lock);
240
240
 
293
293
 * MT safe.
294
294
 *
295
295
 * Returns: (transfer full): a new #GstCollectPads, or NULL in case of an error.
296
 
 *
297
 
 * Since: 0.10.36
298
296
 */
299
297
GstCollectPads *
300
298
gst_collect_pads_new (void)
325
323
 * the oldest buffer when all pads have been collected.
326
324
 *
327
325
 * MT safe.
328
 
 *
329
 
 * Since: 0.10.36
330
326
 */
331
327
void
332
328
gst_collect_pads_set_buffer_function (GstCollectPads * pads,
349
345
 * Set the timestamp comparison function.
350
346
 *
351
347
 * MT safe.
352
 
 *
353
 
 * Since: 0.10.36
354
348
 */
355
349
/* NOTE allowing to change comparison seems not advisable;
356
350
no known use-case, and collaboration with default algorithm is unpredictable.
386
380
 * If this callback is set, the former will be unset.
387
381
 *
388
382
 * MT safe.
389
 
 *
390
 
 * Since: 0.10.36
391
383
 */
392
384
void
393
385
gst_collect_pads_set_function (GstCollectPads * pads,
445
437
 * if so (unusually) needed.
446
438
 *
447
439
 * MT safe.
448
 
 *
449
 
 * Since: 0.10.36
450
440
 */
451
441
void
452
442
gst_collect_pads_set_event_function (GstCollectPads * pads,
475
465
 * if so (unusually) needed.
476
466
 *
477
467
 * MT safe.
478
 
 *
479
 
 * Since: 0.10.36
480
468
 */
481
469
void
482
470
gst_collect_pads_set_query_function (GstCollectPads * pads,
501
489
*
502
490
* Convenience clipping function that converts incoming buffer's timestamp
503
491
* to running time, or clips the buffer if outside configured segment.
504
 
*
505
 
* Since: 0.10.37
506
492
*/
507
493
GstFlowReturn
508
494
gst_collect_pads_clip_running_time (GstCollectPads * pads,
541
527
 *
542
528
 * Install a clipping function that is called right after a buffer is received
543
529
 * on a pad managed by @pads. See #GstCollectPad2ClipFunction for more info.
544
 
 *
545
 
 * Since: 0.10.36
546
530
 */
547
531
void
548
532
gst_collect_pads_set_clip_function (GstCollectPads * pads,
579
563
 *
580
564
 * Returns: a new #GstCollectData to identify the new pad. Or NULL
581
565
 *   if wrong parameters are supplied.
582
 
 *
583
 
 * Since: 0.10.36
584
566
 */
585
567
GstCollectData *
586
568
gst_collect_pads_add_pad (GstCollectPads * pads, GstPad * pad, guint size)
623
605
 *
624
606
 * MT safe.
625
607
 *
626
 
 * Since: 0.10.36
627
 
 *
628
608
 * Returns: a new #GstCollectData to identify the new pad. Or NULL
629
609
 *   if wrong parameters are supplied.
630
610
 */
701
681
 * MT safe.
702
682
 *
703
683
 * Returns: %TRUE if the pad could be removed.
704
 
 *
705
 
 * Since: 0.10.36
706
684
 */
707
685
gboolean
708
686
gst_collect_pads_remove_pad (GstCollectPads * pads, GstPad * pad)
776
754
  }
777
755
}
778
756
 
779
 
/**
780
 
 * gst_collect_pads_is_active:
781
 
 * @pads: the collectspads to use
782
 
 * @pad: the pad to check
783
 
 *
784
 
 * Check if a pad is active.
785
 
 *
786
 
 * This function is currently not implemented.
787
 
 *
788
 
 * MT safe.
789
 
 *
790
 
 * Returns: %TRUE if the pad is active.
791
 
 *
792
 
 * Since: 0.10.36
793
 
 */
794
 
gboolean
795
 
gst_collect_pads_is_active (GstCollectPads * pads, GstPad * pad)
796
 
{
797
 
  g_return_val_if_fail (pads != NULL, FALSE);
798
 
  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), FALSE);
799
 
  g_return_val_if_fail (pad != NULL, FALSE);
800
 
  g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
801
 
 
802
 
  g_warning ("gst_collect_pads_is_active() is not implemented");
803
 
 
804
 
  return FALSE;
805
 
}
806
 
 
807
 
/**
808
 
 * gst_collect_pads_collect:
809
 
 * @pads: the collectspads to use
810
 
 *
811
 
 * Collect data on all pads. This function is usually called
812
 
 * from a #GstTask function in an element. 
813
 
 *
814
 
 * This function is currently not implemented.
815
 
 *
816
 
 * MT safe.
817
 
 *
818
 
 * Returns: #GstFlowReturn of the operation.
819
 
 *
820
 
 * Since: 0.10.36
821
 
 */
822
 
GstFlowReturn
823
 
gst_collect_pads_collect (GstCollectPads * pads)
824
 
{
825
 
  g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
826
 
  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);
827
 
 
828
 
  g_warning ("gst_collect_pads_collect() is not implemented");
829
 
 
830
 
  return GST_FLOW_NOT_SUPPORTED;
831
 
}
832
 
 
833
 
/**
834
 
 * gst_collect_pads_collect_range:
835
 
 * @pads: the collectspads to use
836
 
 * @offset: the offset to collect
837
 
 * @length: the length to collect
838
 
 *
839
 
 * Collect data with @offset and @length on all pads. This function
840
 
 * is typically called in the getrange function of an element. 
841
 
 *
842
 
 * This function is currently not implemented.
843
 
 *
844
 
 * MT safe.
845
 
 *
846
 
 * Returns: #GstFlowReturn of the operation.
847
 
 *
848
 
 * Since: 0.10.36
849
 
 */
850
 
GstFlowReturn
851
 
gst_collect_pads_collect_range (GstCollectPads * pads, guint64 offset,
852
 
    guint length)
853
 
{
854
 
  g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);
855
 
  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);
856
 
 
857
 
  g_warning ("gst_collect_pads_collect_range() is not implemented");
858
 
 
859
 
  return GST_FLOW_NOT_SUPPORTED;
860
 
}
861
 
 
862
757
/*
863
758
 * Must be called with STREAM_LOCK.
864
759
 */
903
798
 * e.g. by sending a FLUSH_START downstream.
904
799
 *
905
800
 * MT safe.
906
 
 *
907
 
 * Since: 0.10.36
908
801
 */
909
802
void
910
803
gst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing)
925
818
 * Starts the processing of data in the collect_pads.
926
819
 *
927
820
 * MT safe.
928
 
 *
929
 
 * Since: 0.10.36
930
821
 */
931
822
void
932
823
gst_collect_pads_start (GstCollectPads * pads)
969
860
 * will also unblock any blocking operations.
970
861
 *
971
862
 * MT safe.
972
 
 *
973
 
 * Since: 0.10.36
974
863
 */
975
864
void
976
865
gst_collect_pads_stop (GstCollectPads * pads)
1013
902
    unref_data (pads->priv->earliest_data);
1014
903
  pads->priv->earliest_data = NULL;
1015
904
  pads->priv->earliest_time = GST_CLOCK_TIME_NONE;
 
905
  pads->priv->stream_started = FALSE;
1016
906
 
1017
907
  GST_OBJECT_UNLOCK (pads);
1018
908
  /* Wake them up so they can end the chain functions. */
1034
924
 *
1035
925
 * Returns: The buffer in @data or NULL if no buffer is queued.
1036
926
 *  should unref the buffer after usage.
1037
 
 *
1038
 
 * Since: 0.10.36
1039
927
 */
1040
928
GstBuffer *
1041
929
gst_collect_pads_peek (GstCollectPads * pads, GstCollectData * data)
1068
956
 *
1069
957
 * Returns: (transfer full): The buffer in @data or NULL if no buffer was
1070
958
 *   queued. You should unref the buffer after usage.
1071
 
 *
1072
 
 * Since: 0.10.36
1073
959
 */
1074
960
GstBuffer *
1075
961
gst_collect_pads_pop (GstCollectPads * pads, GstCollectData * data)
1122
1008
 *
1123
1009
 * Returns: The maximum number of bytes queued on all pads. This function
1124
1010
 * returns 0 if a pad has no queued buffer.
1125
 
 *
1126
 
 * Since: 0.10.36
1127
1011
 */
1128
1012
/* we might pre-calculate this in some struct field,
1129
1013
 * but would then have to maintain this in _chain and particularly _pop, etc,
1193
1077
 *
1194
1078
 * Returns: The number of bytes flushed This can be less than @size and
1195
1079
 * is 0 if the pad was end-of-stream.
1196
 
 *
1197
 
 * Since: 0.10.36
1198
1080
 */
1199
1081
guint
1200
1082
gst_collect_pads_flush (GstCollectPads * pads, GstCollectData * data,
1239
1121
 *
1240
1122
 * MT safe.
1241
1123
 *
1242
 
 * Since: 0.10.36
1243
 
 *
1244
1124
 * Returns: (transfer full): A sub buffer. The size of the buffer can be less that requested.
1245
1125
 * A return of NULL signals that the pad is end-of-stream.
1246
1126
 * Unref the buffer after use.
1280
1160
 *
1281
1161
 * MT safe.
1282
1162
 *
1283
 
 * Since: 0.10.36
1284
 
 *
1285
1163
 * Returns: A sub buffer. The size of the buffer can be less that requested.
1286
1164
 * A return of NULL signals that the pad is end-of-stream.
1287
1165
 * Unref the buffer after use.
1313
1191
 * in the callback.
1314
1192
 *
1315
1193
 * MT safe.
1316
 
 *
1317
 
 * Since: 0.10.36
1318
1194
 */
1319
1195
void
1320
1196
gst_collect_pads_set_waiting (GstCollectPads * pads, GstCollectData * data,
1539
1415
 *
1540
1416
 * This function should be called with STREAM_LOCK held,
1541
1417
 * such as in the callback.
1542
 
 *
1543
 
 * Since: 0.10.36
1544
1418
 */
1545
1419
static void
1546
1420
gst_collect_pads_find_best_pad (GstCollectPads * pads,
1697
1571
 * Default GstCollectPads event handling that elements should always
1698
1572
 * chain up to to ensure proper operation.  Element might however indicate
1699
1573
 * event should not be forwarded downstream.
1700
 
 *
1701
 
 * Since: 0.11.x
1702
1574
 */
1703
1575
gboolean
1704
1576
gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
1837
1709
       * accumulated and this is certainly not what we want. */
1838
1710
      goto eat;
1839
1711
    }
 
1712
    case GST_EVENT_STREAM_START:
 
1713
      /* let the only the first one go through */
 
1714
      if (!pads->priv->stream_started) {
 
1715
        pads->priv->stream_started = TRUE;
 
1716
        goto forward;
 
1717
      } else {
 
1718
        goto eat;
 
1719
      }
 
1720
      break;
1840
1721
    case GST_EVENT_CAPS:
1841
 
    case GST_EVENT_STREAM_START:
1842
1722
    case GST_EVENT_STREAM_CONFIG:
1843
1723
      goto eat;
1844
1724
    default:
1928
1808
 * Default GstCollectPads query handling that elements should always
1929
1809
 * chain up to to ensure proper operation.  Element might however indicate
1930
1810
 * query should not be forwarded downstream.
1931
 
 *
1932
 
 * Since: 0.11.x
1933
1811
 */
1934
1812
gboolean
1935
1813
gst_collect_pads_query_default (GstCollectPads * pads, GstCollectData * data,