198 |
199 |
199 ret = type & ((1 << GST_EVENT_TYPE_SHIFT) - 1); |
200 ret = type & ((1 << GST_EVENT_TYPE_SHIFT) - 1); |
200 |
201 |
201 return ret; |
202 return ret; |
202 } |
203 } |
203 #ifdef __SYMBIAN32__ |
204 |
204 EXPORT_C |
205 #define _do_init \ |
205 #endif |
206 { \ |
206 |
207 gint i; \ |
207 |
208 \ |
208 GType |
209 for (i = 0; event_quarks[i].name; i++) { \ |
209 gst_event_get_type (void) |
210 event_quarks[i].quark = g_quark_from_static_string (event_quarks[i].name); \ |
210 { |
211 } \ |
211 static GType _gst_event_type = 0; |
212 } |
212 int i; |
213 |
213 |
214 G_DEFINE_TYPE_WITH_CODE (GstEvent, gst_event, GST_TYPE_MINI_OBJECT, _do_init); |
214 if (G_UNLIKELY (_gst_event_type == 0)) { |
|
215 static const GTypeInfo event_info = { |
|
216 sizeof (GstEventClass), |
|
217 NULL, |
|
218 NULL, |
|
219 gst_event_class_init, |
|
220 NULL, |
|
221 NULL, |
|
222 sizeof (GstEvent), |
|
223 0, |
|
224 gst_event_init, |
|
225 NULL |
|
226 }; |
|
227 |
|
228 _gst_event_type = g_type_register_static (GST_TYPE_MINI_OBJECT, |
|
229 "GstEvent", &event_info, 0); |
|
230 |
|
231 for (i = 0; event_quarks[i].name; i++) { |
|
232 event_quarks[i].quark = g_quark_from_static_string (event_quarks[i].name); |
|
233 } |
|
234 } |
|
235 |
|
236 return _gst_event_type; |
|
237 } |
|
238 |
215 |
239 static void |
216 static void |
240 gst_event_class_init (gpointer g_class, gpointer class_data) |
217 gst_event_class_init (GstEventClass * klass) |
241 { |
218 { |
242 GstEventClass *event_class = GST_EVENT_CLASS (g_class); |
219 parent_class = g_type_class_peek_parent (klass); |
243 |
220 |
244 parent_class = g_type_class_peek_parent (g_class); |
221 klass->mini_object_class.copy = (GstMiniObjectCopyFunction) _gst_event_copy; |
245 |
222 klass->mini_object_class.finalize = |
246 event_class->mini_object_class.copy = |
|
247 (GstMiniObjectCopyFunction) _gst_event_copy; |
|
248 event_class->mini_object_class.finalize = |
|
249 (GstMiniObjectFinalizeFunction) gst_event_finalize; |
223 (GstMiniObjectFinalizeFunction) gst_event_finalize; |
250 } |
224 } |
251 |
225 |
252 static void |
226 static void |
253 gst_event_init (GTypeInstance * instance, gpointer g_class) |
227 gst_event_init (GstEvent * event) |
254 { |
228 { |
255 GstEvent *event; |
|
256 |
|
257 event = GST_EVENT (instance); |
|
258 |
|
259 GST_EVENT_TIMESTAMP (event) = GST_CLOCK_TIME_NONE; |
229 GST_EVENT_TIMESTAMP (event) = GST_CLOCK_TIME_NONE; |
260 } |
230 } |
261 |
231 |
262 static void |
232 static void |
263 gst_event_finalize (GstEvent * event) |
233 gst_event_finalize (GstEvent * event) |
378 gst_event_get_structure (GstEvent * event) |
350 gst_event_get_structure (GstEvent * event) |
379 { |
351 { |
380 g_return_val_if_fail (GST_IS_EVENT (event), NULL); |
352 g_return_val_if_fail (GST_IS_EVENT (event), NULL); |
381 |
353 |
382 return event->structure; |
354 return event->structure; |
|
355 } |
|
356 |
|
357 /** |
|
358 * gst_event_has_name: |
|
359 * @event: The #GstEvent. |
|
360 * @name: name to check |
|
361 * |
|
362 * Checks if @event has the given @name. This function is usually used to |
|
363 * check the name of a custom event. |
|
364 * |
|
365 * Returns: %TRUE if @name matches the name of the event structure. |
|
366 * |
|
367 * Since: 0.10.20 |
|
368 */ |
|
369 #ifdef __SYMBIAN32__ |
|
370 EXPORT_C |
|
371 #endif |
|
372 |
|
373 gboolean |
|
374 gst_event_has_name (GstEvent * event, const gchar * name) |
|
375 { |
|
376 g_return_val_if_fail (GST_IS_EVENT (event), FALSE); |
|
377 |
|
378 if (event->structure == NULL) |
|
379 return FALSE; |
|
380 |
|
381 return gst_structure_has_name (event->structure, name); |
|
382 } |
|
383 |
|
384 /** |
|
385 * gst_event_get_seqnum: |
|
386 * @event: A #GstEvent. |
|
387 * |
|
388 * Retrieve the sequence number of a event. |
|
389 * |
|
390 * Events have ever-incrementing sequence numbers, which may also be set |
|
391 * explicitly via gst_event_set_seqnum(). Sequence numbers are typically used to |
|
392 * indicate that a event corresponds to some other set of events or messages, |
|
393 * for example an EOS event corresponding to a SEEK event. It is considered good |
|
394 * practice to make this correspondence when possible, though it is not |
|
395 * required. |
|
396 * |
|
397 * Note that events and messages share the same sequence number incrementor; |
|
398 * two events or messages will never not have the same sequence number unless |
|
399 * that correspondence was made explicitly. |
|
400 * |
|
401 * Returns: The event's sequence number. |
|
402 * |
|
403 * MT safe. |
|
404 * |
|
405 * Since: 0.10.22 |
|
406 */ |
|
407 #ifdef __SYMBIAN32__ |
|
408 EXPORT_C |
|
409 #endif |
|
410 |
|
411 guint32 |
|
412 gst_event_get_seqnum (GstEvent * event) |
|
413 { |
|
414 g_return_val_if_fail (GST_IS_EVENT (event), -1); |
|
415 |
|
416 return GST_EVENT_SEQNUM (event); |
|
417 } |
|
418 |
|
419 /** |
|
420 * gst_event_set_seqnum: |
|
421 * @event: A #GstEvent. |
|
422 * @seqnum: A sequence number. |
|
423 * |
|
424 * Set the sequence number of a event. |
|
425 * |
|
426 * This function might be called by the creator of a event to indicate that the |
|
427 * event relates to other events or messages. See gst_event_get_seqnum() for |
|
428 * more information. |
|
429 * |
|
430 * MT safe. |
|
431 * |
|
432 * Since: 0.10.22 |
|
433 */ |
|
434 #ifdef __SYMBIAN32__ |
|
435 EXPORT_C |
|
436 #endif |
|
437 |
|
438 void |
|
439 gst_event_set_seqnum (GstEvent * event, guint32 seqnum) |
|
440 { |
|
441 g_return_if_fail (GST_IS_EVENT (event)); |
|
442 |
|
443 GST_EVENT_SEQNUM (event) = seqnum; |
383 } |
444 } |
384 |
445 |
385 /** |
446 /** |
386 * gst_event_new_flush_start: |
447 * gst_event_new_flush_start: |
387 * |
448 * |
539 * Allocate a new newsegment event with the given format/values triplets. |
600 * Allocate a new newsegment event with the given format/values triplets. |
540 * |
601 * |
541 * The newsegment event marks the range of buffers to be processed. All |
602 * The newsegment event marks the range of buffers to be processed. All |
542 * data not within the segment range is not to be processed. This can be |
603 * data not within the segment range is not to be processed. This can be |
543 * used intelligently by plugins to apply more efficient methods of skipping |
604 * used intelligently by plugins to apply more efficient methods of skipping |
544 * unneeded data. |
605 * unneeded data. The valid range is expressed with the @start and @stop |
|
606 * values. |
545 * |
607 * |
546 * The position value of the segment is used in conjunction with the start |
608 * The position value of the segment is used in conjunction with the start |
547 * value to convert the buffer timestamps into the stream time. This is |
609 * value to convert the buffer timestamps into the stream time. This is |
548 * usually done in sinks to report the current stream_time. |
610 * usually done in sinks to report the current stream_time. |
549 * @position represents the stream_time of a buffer carrying a timestamp of |
611 * @position represents the stream_time of a buffer carrying a timestamp of |
570 * Since: 0.10.6 |
632 * Since: 0.10.6 |
571 */ |
633 */ |
572 #ifdef __SYMBIAN32__ |
634 #ifdef __SYMBIAN32__ |
573 EXPORT_C |
635 EXPORT_C |
574 #endif |
636 #endif |
|
637 |
575 GstEvent * |
638 GstEvent * |
576 gst_event_new_new_segment_full (gboolean update, gdouble rate, |
639 gst_event_new_new_segment_full (gboolean update, gdouble rate, |
577 gdouble applied_rate, GstFormat format, gint64 start, gint64 stop, |
640 gdouble applied_rate, GstFormat format, gint64 start, gint64 stop, |
578 gint64 position) |
641 gint64 position) |
579 { |
642 { |
|
643 GstEvent *event; |
|
644 GstStructure *structure; |
|
645 |
580 g_return_val_if_fail (rate != 0.0, NULL); |
646 g_return_val_if_fail (rate != 0.0, NULL); |
581 g_return_val_if_fail (applied_rate != 0.0, NULL); |
647 g_return_val_if_fail (applied_rate != 0.0, NULL); |
582 |
648 |
583 if (format == GST_FORMAT_TIME) { |
649 if (format == GST_FORMAT_TIME) { |
584 GST_CAT_INFO (GST_CAT_EVENT, |
650 GST_CAT_INFO (GST_CAT_EVENT, |
587 ", position %" GST_TIME_FORMAT, |
653 ", position %" GST_TIME_FORMAT, |
588 update, rate, GST_TIME_ARGS (start), |
654 update, rate, GST_TIME_ARGS (start), |
589 GST_TIME_ARGS (stop), GST_TIME_ARGS (position)); |
655 GST_TIME_ARGS (stop), GST_TIME_ARGS (position)); |
590 } else { |
656 } else { |
591 GST_CAT_INFO (GST_CAT_EVENT, |
657 GST_CAT_INFO (GST_CAT_EVENT, |
592 "creating newsegment update %d, rate %lf, format %d, " |
658 "creating newsegment update %d, rate %lf, format %s, " |
593 "start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT ", position %" |
659 "start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT ", position %" |
594 G_GINT64_FORMAT, update, rate, format, start, stop, position); |
660 G_GINT64_FORMAT, update, rate, gst_format_get_name (format), start, |
|
661 stop, position); |
595 } |
662 } |
596 |
663 |
597 g_return_val_if_fail (position != -1, NULL); |
664 g_return_val_if_fail (position != -1, NULL); |
598 g_return_val_if_fail (start != -1, NULL); |
665 g_return_val_if_fail (start != -1, NULL); |
599 if (stop != -1) |
666 if (stop != -1) |
600 g_return_val_if_fail (start <= stop, NULL); |
667 g_return_val_if_fail (start <= stop, NULL); |
601 |
668 |
602 return gst_event_new_custom (GST_EVENT_NEWSEGMENT, |
669 structure = gst_structure_id_new (GST_QUARK (EVENT_NEWSEGMENT), |
603 gst_structure_new ("GstEventNewsegment", |
670 GST_QUARK (UPDATE), G_TYPE_BOOLEAN, update, |
604 "update", G_TYPE_BOOLEAN, update, |
671 GST_QUARK (RATE), G_TYPE_DOUBLE, rate, |
605 "rate", G_TYPE_DOUBLE, rate, |
672 GST_QUARK (APPLIED_RATE), G_TYPE_DOUBLE, applied_rate, |
606 "applied_rate", G_TYPE_DOUBLE, applied_rate, |
673 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
607 "format", GST_TYPE_FORMAT, format, |
674 GST_QUARK (START), G_TYPE_INT64, start, |
608 "start", G_TYPE_INT64, start, |
675 GST_QUARK (STOP), G_TYPE_INT64, stop, |
609 "stop", G_TYPE_INT64, stop, |
676 GST_QUARK (POSITION), G_TYPE_INT64, position, NULL); |
610 "position", G_TYPE_INT64, position, NULL)); |
677 event = gst_event_new_custom (GST_EVENT_NEWSEGMENT, structure); |
|
678 |
|
679 return event; |
611 } |
680 } |
612 |
681 |
613 /** |
682 /** |
614 * gst_event_parse_new_segment_full: |
683 * gst_event_parse_new_segment_full: |
615 * @event: The event to query |
684 * @event: The event to query |
642 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT); |
711 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT); |
643 |
712 |
644 structure = gst_event_get_structure (event); |
713 structure = gst_event_get_structure (event); |
645 if (G_LIKELY (update)) |
714 if (G_LIKELY (update)) |
646 *update = |
715 *update = |
647 g_value_get_boolean (gst_structure_get_value (structure, "update")); |
716 g_value_get_boolean (gst_structure_id_get_value (structure, |
|
717 GST_QUARK (UPDATE))); |
648 if (G_LIKELY (rate)) |
718 if (G_LIKELY (rate)) |
649 *rate = g_value_get_double (gst_structure_get_value (structure, "rate")); |
719 *rate = |
|
720 g_value_get_double (gst_structure_id_get_value (structure, |
|
721 GST_QUARK (RATE))); |
650 if (G_LIKELY (applied_rate)) |
722 if (G_LIKELY (applied_rate)) |
651 *applied_rate = |
723 *applied_rate = |
652 g_value_get_double (gst_structure_get_value (structure, |
724 g_value_get_double (gst_structure_id_get_value (structure, |
653 "applied_rate")); |
725 GST_QUARK (APPLIED_RATE))); |
654 if (G_LIKELY (format)) |
726 if (G_LIKELY (format)) |
655 *format = g_value_get_enum (gst_structure_get_value (structure, "format")); |
727 *format = |
|
728 g_value_get_enum (gst_structure_id_get_value (structure, |
|
729 GST_QUARK (FORMAT))); |
656 if (G_LIKELY (start)) |
730 if (G_LIKELY (start)) |
657 *start = g_value_get_int64 (gst_structure_get_value (structure, "start")); |
731 *start = |
|
732 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
733 GST_QUARK (START))); |
658 if (G_LIKELY (stop)) |
734 if (G_LIKELY (stop)) |
659 *stop = g_value_get_int64 (gst_structure_get_value (structure, "stop")); |
735 *stop = |
|
736 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
737 GST_QUARK (STOP))); |
660 if (G_LIKELY (position)) |
738 if (G_LIKELY (position)) |
661 *position = |
739 *position = |
662 g_value_get_int64 (gst_structure_get_value (structure, "position")); |
740 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
741 GST_QUARK (POSITION))); |
663 } |
742 } |
664 |
743 |
665 /** |
744 /** |
666 * gst_event_new_tag: |
745 * gst_event_new_tag: |
667 * @taglist: metadata list |
746 * @taglist: metadata list. The event will take ownership of @taglist. |
668 * |
747 * |
669 * Generates a metadata tag event from the given @taglist. |
748 * Generates a metadata tag event from the given @taglist. |
670 * |
749 * |
671 * Returns: a new #GstEvent |
750 * Returns: a new #GstEvent |
672 */ |
751 */ |
724 |
803 |
725 GstEvent * |
804 GstEvent * |
726 gst_event_new_buffer_size (GstFormat format, gint64 minsize, |
805 gst_event_new_buffer_size (GstFormat format, gint64 minsize, |
727 gint64 maxsize, gboolean async) |
806 gint64 maxsize, gboolean async) |
728 { |
807 { |
|
808 GstEvent *event; |
|
809 GstStructure *structure; |
|
810 |
729 GST_CAT_INFO (GST_CAT_EVENT, |
811 GST_CAT_INFO (GST_CAT_EVENT, |
730 "creating buffersize format %d, minsize %" G_GINT64_FORMAT |
812 "creating buffersize format %s, minsize %" G_GINT64_FORMAT |
731 ", maxsize %" G_GINT64_FORMAT ", async %d", format, |
813 ", maxsize %" G_GINT64_FORMAT ", async %d", gst_format_get_name (format), |
732 minsize, maxsize, async); |
814 minsize, maxsize, async); |
733 |
815 |
734 return gst_event_new_custom (GST_EVENT_BUFFERSIZE, |
816 structure = gst_structure_id_new (GST_QUARK (EVENT_BUFFER_SIZE), |
735 gst_structure_new ("GstEventBufferSize", |
817 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
736 "format", GST_TYPE_FORMAT, format, |
818 GST_QUARK (MINSIZE), G_TYPE_INT64, minsize, |
737 "minsize", G_TYPE_INT64, minsize, |
819 GST_QUARK (MAXSIZE), G_TYPE_INT64, maxsize, |
738 "maxsize", G_TYPE_INT64, maxsize, |
820 GST_QUARK (ASYNC), G_TYPE_BOOLEAN, async, NULL); |
739 "async", G_TYPE_BOOLEAN, async, NULL)); |
821 event = gst_event_new_custom (GST_EVENT_BUFFERSIZE, structure); |
|
822 |
|
823 return event; |
740 } |
824 } |
741 |
825 |
742 /** |
826 /** |
743 * gst_event_parse_buffer_size: |
827 * gst_event_parse_buffer_size: |
744 * @event: The event to query |
828 * @event: The event to query |
762 g_return_if_fail (GST_IS_EVENT (event)); |
846 g_return_if_fail (GST_IS_EVENT (event)); |
763 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_BUFFERSIZE); |
847 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_BUFFERSIZE); |
764 |
848 |
765 structure = gst_event_get_structure (event); |
849 structure = gst_event_get_structure (event); |
766 if (format) |
850 if (format) |
767 *format = g_value_get_enum (gst_structure_get_value (structure, "format")); |
851 *format = |
|
852 g_value_get_enum (gst_structure_id_get_value (structure, |
|
853 GST_QUARK (FORMAT))); |
768 if (minsize) |
854 if (minsize) |
769 *minsize = |
855 *minsize = |
770 g_value_get_int64 (gst_structure_get_value (structure, "minsize")); |
856 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
857 GST_QUARK (MINSIZE))); |
771 if (maxsize) |
858 if (maxsize) |
772 *maxsize = |
859 *maxsize = |
773 g_value_get_int64 (gst_structure_get_value (structure, "maxsize")); |
860 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
861 GST_QUARK (MAXSIZE))); |
774 if (async) |
862 if (async) |
775 *async = g_value_get_boolean (gst_structure_get_value (structure, "async")); |
863 *async = |
|
864 g_value_get_boolean (gst_structure_id_get_value (structure, |
|
865 GST_QUARK (ASYNC))); |
776 } |
866 } |
777 |
867 |
778 /** |
868 /** |
779 * gst_event_new_qos: |
869 * gst_event_new_qos: |
780 * @proportion: the proportion of the qos message |
870 * @proportion: the proportion of the qos message |
807 * increasing value. |
897 * increasing value. |
808 * |
898 * |
809 * The upstream element can use the @diff and @timestamp values to decide |
899 * The upstream element can use the @diff and @timestamp values to decide |
810 * whether to process more buffers. For possitive @diff, all buffers with |
900 * whether to process more buffers. For possitive @diff, all buffers with |
811 * timestamp <= @timestamp + @diff will certainly arrive late in the sink |
901 * timestamp <= @timestamp + @diff will certainly arrive late in the sink |
812 * as well. |
902 * as well. A (negative) @diff value so that @timestamp + @diff would yield a |
|
903 * result smaller than 0 is not allowed. |
813 * |
904 * |
814 * The application can use general event probes to intercept the QoS |
905 * The application can use general event probes to intercept the QoS |
815 * event and implement custom application specific QoS handling. |
906 * event and implement custom application specific QoS handling. |
816 * |
907 * |
817 * Returns: A new QOS event. |
908 * Returns: A new QOS event. |
822 |
913 |
823 GstEvent * |
914 GstEvent * |
824 gst_event_new_qos (gdouble proportion, GstClockTimeDiff diff, |
915 gst_event_new_qos (gdouble proportion, GstClockTimeDiff diff, |
825 GstClockTime timestamp) |
916 GstClockTime timestamp) |
826 { |
917 { |
|
918 GstEvent *event; |
|
919 GstStructure *structure; |
|
920 |
|
921 /* diff must be positive or timestamp + diff must be positive */ |
|
922 g_return_val_if_fail (diff >= 0 || -diff <= timestamp, NULL); |
|
923 |
827 GST_CAT_INFO (GST_CAT_EVENT, |
924 GST_CAT_INFO (GST_CAT_EVENT, |
828 "creating qos proportion %lf, diff %" G_GINT64_FORMAT |
925 "creating qos proportion %lf, diff %" G_GINT64_FORMAT |
829 ", timestamp %" GST_TIME_FORMAT, proportion, |
926 ", timestamp %" GST_TIME_FORMAT, proportion, |
830 diff, GST_TIME_ARGS (timestamp)); |
927 diff, GST_TIME_ARGS (timestamp)); |
831 |
928 |
832 return gst_event_new_custom (GST_EVENT_QOS, |
929 structure = gst_structure_id_new (GST_QUARK (EVENT_QOS), |
833 gst_structure_new ("GstEventQOS", |
930 GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion, |
834 "proportion", G_TYPE_DOUBLE, proportion, |
931 GST_QUARK (DIFF), G_TYPE_INT64, diff, |
835 "diff", G_TYPE_INT64, diff, |
932 GST_QUARK (TIMESTAMP), G_TYPE_UINT64, timestamp, NULL); |
836 "timestamp", G_TYPE_UINT64, timestamp, NULL)); |
933 event = gst_event_new_custom (GST_EVENT_QOS, structure); |
|
934 |
|
935 return event; |
837 } |
936 } |
838 |
937 |
839 /** |
938 /** |
840 * gst_event_parse_qos: |
939 * gst_event_parse_qos: |
841 * @event: The event to query |
940 * @event: The event to query |
860 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_QOS); |
959 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_QOS); |
861 |
960 |
862 structure = gst_event_get_structure (event); |
961 structure = gst_event_get_structure (event); |
863 if (proportion) |
962 if (proportion) |
864 *proportion = |
963 *proportion = |
865 g_value_get_double (gst_structure_get_value (structure, "proportion")); |
964 g_value_get_double (gst_structure_id_get_value (structure, |
|
965 GST_QUARK (PROPORTION))); |
866 if (diff) |
966 if (diff) |
867 *diff = g_value_get_int64 (gst_structure_get_value (structure, "diff")); |
967 *diff = |
|
968 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
969 GST_QUARK (DIFF))); |
868 if (timestamp) |
970 if (timestamp) |
869 *timestamp = |
971 *timestamp = |
870 g_value_get_uint64 (gst_structure_get_value (structure, "timestamp")); |
972 g_value_get_uint64 (gst_structure_id_get_value (structure, |
|
973 GST_QUARK (TIMESTAMP))); |
871 } |
974 } |
872 |
975 |
873 /** |
976 /** |
874 * gst_event_new_seek: |
977 * gst_event_new_seek: |
875 * @rate: The new playback rate |
978 * @rate: The new playback rate |
894 * A pipeline has a default playback segment configured with a start |
997 * A pipeline has a default playback segment configured with a start |
895 * position of 0, a stop position of -1 and a rate of 1.0. The currently |
998 * position of 0, a stop position of -1 and a rate of 1.0. The currently |
896 * configured playback segment can be queried with #GST_QUERY_SEGMENT. |
999 * configured playback segment can be queried with #GST_QUERY_SEGMENT. |
897 * |
1000 * |
898 * @start_type and @stop_type specify how to adjust the currently configured |
1001 * @start_type and @stop_type specify how to adjust the currently configured |
899 * start and stop fields in @segment. Adjustments can be made relative or |
1002 * start and stop fields in playback segment. Adjustments can be made relative |
900 * absolute to the last configured values. A type of #GST_SEEK_TYPE_NONE means |
1003 * or absolute to the last configured values. A type of #GST_SEEK_TYPE_NONE |
901 * that the position should not be updated. |
1004 * means that the position should not be updated. |
902 * |
1005 * |
903 * When the rate is positive and @start has been updated, playback will start |
1006 * When the rate is positive and @start has been updated, playback will start |
904 * from the newly configured start position. |
1007 * from the newly configured start position. |
905 * |
1008 * |
906 * For negative rates, playback will start from the newly configured stop |
1009 * For negative rates, playback will start from the newly configured stop |
908 * -1 for negative rates. |
1011 * -1 for negative rates. |
909 * |
1012 * |
910 * It is not possible to seek relative to the current playback position, to do |
1013 * It is not possible to seek relative to the current playback position, to do |
911 * this, PAUSE the pipeline, query the current playback position with |
1014 * this, PAUSE the pipeline, query the current playback position with |
912 * #GST_QUERY_POSITION and update the playback segment current position with a |
1015 * #GST_QUERY_POSITION and update the playback segment current position with a |
913 * #GST_SEEK_TYPE_SET to the desired position. |
1016 * #GST_SEEK_TYPE_SET to the desired position. |
914 * |
1017 * |
915 * Returns: A new seek event. |
1018 * Returns: A new seek event. |
916 */ |
1019 */ |
917 #ifdef __SYMBIAN32__ |
1020 |
918 EXPORT_C |
1021 #ifdef __SYMBIAN32__ |
919 #endif |
1022 EXPORT_C |
|
1023 #endif |
|
1024 |
920 GstEvent * |
1025 GstEvent * |
921 gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags, |
1026 gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags, |
922 GstSeekType start_type, gint64 start, GstSeekType stop_type, gint64 stop) |
1027 GstSeekType start_type, gint64 start, GstSeekType stop_type, gint64 stop) |
923 { |
1028 { |
|
1029 GstEvent *event; |
|
1030 GstStructure *structure; |
|
1031 |
924 g_return_val_if_fail (rate != 0.0, NULL); |
1032 g_return_val_if_fail (rate != 0.0, NULL); |
925 |
1033 |
926 if (format == GST_FORMAT_TIME) { |
1034 if (format == GST_FORMAT_TIME) { |
927 GST_CAT_INFO (GST_CAT_EVENT, |
1035 GST_CAT_INFO (GST_CAT_EVENT, |
928 "creating seek rate %lf, format TIME, flags %d, " |
1036 "creating seek rate %lf, format TIME, flags %d, " |
930 "stop_type %d, stop %" GST_TIME_FORMAT, |
1038 "stop_type %d, stop %" GST_TIME_FORMAT, |
931 rate, flags, start_type, GST_TIME_ARGS (start), |
1039 rate, flags, start_type, GST_TIME_ARGS (start), |
932 stop_type, GST_TIME_ARGS (stop)); |
1040 stop_type, GST_TIME_ARGS (stop)); |
933 } else { |
1041 } else { |
934 GST_CAT_INFO (GST_CAT_EVENT, |
1042 GST_CAT_INFO (GST_CAT_EVENT, |
935 "creating seek rate %lf, format %d, flags %d, " |
1043 "creating seek rate %lf, format %s, flags %d, " |
936 "start_type %d, start %" G_GINT64_FORMAT ", " |
1044 "start_type %d, start %" G_GINT64_FORMAT ", " |
937 "stop_type %d, stop %" G_GINT64_FORMAT, |
1045 "stop_type %d, stop %" G_GINT64_FORMAT, |
938 rate, format, flags, start_type, start, stop_type, stop); |
1046 rate, gst_format_get_name (format), flags, start_type, start, stop_type, |
|
1047 stop); |
939 } |
1048 } |
940 |
1049 |
941 return gst_event_new_custom (GST_EVENT_SEEK, |
1050 structure = gst_structure_id_new (GST_QUARK (EVENT_SEEK), |
942 gst_structure_new ("GstEventSeek", "rate", G_TYPE_DOUBLE, rate, |
1051 GST_QUARK (RATE), G_TYPE_DOUBLE, rate, |
943 "format", GST_TYPE_FORMAT, format, |
1052 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
944 "flags", GST_TYPE_SEEK_FLAGS, flags, |
1053 GST_QUARK (FLAGS), GST_TYPE_SEEK_FLAGS, flags, |
945 "cur_type", GST_TYPE_SEEK_TYPE, start_type, |
1054 GST_QUARK (CUR_TYPE), GST_TYPE_SEEK_TYPE, start_type, |
946 "cur", G_TYPE_INT64, start, |
1055 GST_QUARK (CUR), G_TYPE_INT64, start, |
947 "stop_type", GST_TYPE_SEEK_TYPE, stop_type, |
1056 GST_QUARK (STOP_TYPE), GST_TYPE_SEEK_TYPE, stop_type, |
948 "stop", G_TYPE_INT64, stop, NULL)); |
1057 GST_QUARK (STOP), G_TYPE_INT64, stop, NULL); |
|
1058 event = gst_event_new_custom (GST_EVENT_SEEK, structure); |
|
1059 |
|
1060 return event; |
949 } |
1061 } |
950 |
1062 |
951 /** |
1063 /** |
952 * gst_event_parse_seek: |
1064 * gst_event_parse_seek: |
953 * @event: a seek event |
1065 * @event: a seek event |
975 g_return_if_fail (GST_IS_EVENT (event)); |
1087 g_return_if_fail (GST_IS_EVENT (event)); |
976 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_SEEK); |
1088 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_SEEK); |
977 |
1089 |
978 structure = gst_event_get_structure (event); |
1090 structure = gst_event_get_structure (event); |
979 if (rate) |
1091 if (rate) |
980 *rate = g_value_get_double (gst_structure_get_value (structure, "rate")); |
1092 *rate = |
|
1093 g_value_get_double (gst_structure_id_get_value (structure, |
|
1094 GST_QUARK (RATE))); |
981 if (format) |
1095 if (format) |
982 *format = g_value_get_enum (gst_structure_get_value (structure, "format")); |
1096 *format = |
|
1097 g_value_get_enum (gst_structure_id_get_value (structure, |
|
1098 GST_QUARK (FORMAT))); |
983 if (flags) |
1099 if (flags) |
984 *flags = g_value_get_flags (gst_structure_get_value (structure, "flags")); |
1100 *flags = |
|
1101 g_value_get_flags (gst_structure_id_get_value (structure, |
|
1102 GST_QUARK (FLAGS))); |
985 if (start_type) |
1103 if (start_type) |
986 *start_type = |
1104 *start_type = |
987 g_value_get_enum (gst_structure_get_value (structure, "cur_type")); |
1105 g_value_get_enum (gst_structure_id_get_value (structure, |
|
1106 GST_QUARK (CUR_TYPE))); |
988 if (start) |
1107 if (start) |
989 *start = g_value_get_int64 (gst_structure_get_value (structure, "cur")); |
1108 *start = |
|
1109 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
1110 GST_QUARK (CUR))); |
990 if (stop_type) |
1111 if (stop_type) |
991 *stop_type = |
1112 *stop_type = |
992 g_value_get_enum (gst_structure_get_value (structure, "stop_type")); |
1113 g_value_get_enum (gst_structure_id_get_value (structure, |
|
1114 GST_QUARK (STOP_TYPE))); |
993 if (stop) |
1115 if (stop) |
994 *stop = g_value_get_int64 (gst_structure_get_value (structure, "stop")); |
1116 *stop = |
|
1117 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
1118 GST_QUARK (STOP))); |
995 } |
1119 } |
996 |
1120 |
997 /** |
1121 /** |
998 * gst_event_new_navigation: |
1122 * gst_event_new_navigation: |
999 * @structure: description of the event |
1123 * @structure: description of the event. The event will take ownership of the |
|
1124 * structure. |
1000 * |
1125 * |
1001 * Create a new navigation event from the given description. |
1126 * Create a new navigation event from the given description. |
1002 * |
1127 * |
1003 * Returns: a new #GstEvent |
1128 * Returns: a new #GstEvent |
1004 */ |
1129 */ |
1034 #endif |
1159 #endif |
1035 |
1160 |
1036 GstEvent * |
1161 GstEvent * |
1037 gst_event_new_latency (GstClockTime latency) |
1162 gst_event_new_latency (GstClockTime latency) |
1038 { |
1163 { |
|
1164 GstEvent *event; |
|
1165 GstStructure *structure; |
|
1166 |
1039 GST_CAT_INFO (GST_CAT_EVENT, |
1167 GST_CAT_INFO (GST_CAT_EVENT, |
1040 "creating latency event %" GST_TIME_FORMAT, GST_TIME_ARGS (latency)); |
1168 "creating latency event %" GST_TIME_FORMAT, GST_TIME_ARGS (latency)); |
1041 |
1169 |
1042 return gst_event_new_custom (GST_EVENT_LATENCY, |
1170 structure = gst_structure_id_new (GST_QUARK (EVENT_LATENCY), |
1043 gst_structure_new ("GstEventLatency", |
1171 GST_QUARK (LATENCY), G_TYPE_UINT64, latency, NULL); |
1044 "latency", G_TYPE_UINT64, latency, NULL)); |
1172 event = gst_event_new_custom (GST_EVENT_LATENCY, structure); |
|
1173 |
|
1174 return event; |
1045 } |
1175 } |
1046 |
1176 |
1047 /** |
1177 /** |
1048 * gst_event_parse_latency: |
1178 * gst_event_parse_latency: |
1049 * @event: The event to query |
1179 * @event: The event to query |
1066 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_LATENCY); |
1196 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_LATENCY); |
1067 |
1197 |
1068 structure = gst_event_get_structure (event); |
1198 structure = gst_event_get_structure (event); |
1069 if (latency) |
1199 if (latency) |
1070 *latency = |
1200 *latency = |
1071 g_value_get_uint64 (gst_structure_get_value (structure, "latency")); |
1201 g_value_get_uint64 (gst_structure_id_get_value (structure, |
1072 } |
1202 GST_QUARK (LATENCY))); |
|
1203 } |
|
1204 |
|
1205 /** |
|
1206 * gst_event_new_step: |
|
1207 * @format: the format of @amount |
|
1208 * @amount: the amount of data to step |
|
1209 * @rate: the step rate |
|
1210 * @flush: flushing steps |
|
1211 * @intermediate: intermediate steps |
|
1212 * |
|
1213 * Create a new step event. The purpose of the step event is to instruct a sink |
|
1214 * to skip @amount (expressed in @format) of media. It can be used to implement |
|
1215 * stepping through the video frame by frame or for doing fast trick modes. |
|
1216 * |
|
1217 * A rate of <= 0.0 is not allowed, pause the pipeline or reverse the playback |
|
1218 * direction of the pipeline to get the same effect. |
|
1219 * |
|
1220 * The @flush flag will clear any pending data in the pipeline before starting |
|
1221 * the step operation. |
|
1222 * |
|
1223 * The @intermediate flag instructs the pipeline that this step operation is |
|
1224 * part of a larger step operation. |
|
1225 * |
|
1226 * Returns: a new #GstEvent |
|
1227 * |
|
1228 * Since: 0.10.24 |
|
1229 */ |
|
1230 #ifdef __SYMBIAN32__ |
|
1231 EXPORT_C |
|
1232 #endif |
|
1233 |
|
1234 GstEvent * |
|
1235 gst_event_new_step (GstFormat format, guint64 amount, gdouble rate, |
|
1236 gboolean flush, gboolean intermediate) |
|
1237 { |
|
1238 GstEvent *event; |
|
1239 GstStructure *structure; |
|
1240 |
|
1241 g_return_val_if_fail (rate > 0.0, NULL); |
|
1242 |
|
1243 GST_CAT_INFO (GST_CAT_EVENT, "creating step event"); |
|
1244 |
|
1245 structure = gst_structure_id_new (GST_QUARK (EVENT_STEP), |
|
1246 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
|
1247 GST_QUARK (AMOUNT), G_TYPE_UINT64, amount, |
|
1248 GST_QUARK (RATE), G_TYPE_DOUBLE, rate, |
|
1249 GST_QUARK (FLUSH), G_TYPE_BOOLEAN, flush, |
|
1250 GST_QUARK (INTERMEDIATE), G_TYPE_BOOLEAN, intermediate, NULL); |
|
1251 event = gst_event_new_custom (GST_EVENT_STEP, structure); |
|
1252 |
|
1253 return event; |
|
1254 } |
|
1255 |
|
1256 /** |
|
1257 * gst_event_parse_step: |
|
1258 * @event: The event to query |
|
1259 * @format: A pointer to store the format in. |
|
1260 * @amount: A pointer to store the amount in. |
|
1261 * @rate: A pointer to store the rate in. |
|
1262 * @flush: A pointer to store the flush boolean in. |
|
1263 * @intermediate: A pointer to store the intermediate boolean in. |
|
1264 * |
|
1265 * Parse the step event. |
|
1266 * |
|
1267 * Since: 0.10.24 |
|
1268 */ |
|
1269 #ifdef __SYMBIAN32__ |
|
1270 EXPORT_C |
|
1271 #endif |
|
1272 |
|
1273 void |
|
1274 gst_event_parse_step (GstEvent * event, GstFormat * format, guint64 * amount, |
|
1275 gdouble * rate, gboolean * flush, gboolean * intermediate) |
|
1276 { |
|
1277 const GstStructure *structure; |
|
1278 |
|
1279 g_return_if_fail (GST_IS_EVENT (event)); |
|
1280 g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STEP); |
|
1281 |
|
1282 structure = gst_event_get_structure (event); |
|
1283 if (format) |
|
1284 *format = g_value_get_enum (gst_structure_id_get_value (structure, |
|
1285 GST_QUARK (FORMAT))); |
|
1286 if (amount) |
|
1287 *amount = g_value_get_uint64 (gst_structure_id_get_value (structure, |
|
1288 GST_QUARK (AMOUNT))); |
|
1289 if (rate) |
|
1290 *rate = g_value_get_double (gst_structure_id_get_value (structure, |
|
1291 GST_QUARK (RATE))); |
|
1292 if (flush) |
|
1293 *flush = g_value_get_boolean (gst_structure_id_get_value (structure, |
|
1294 GST_QUARK (FLUSH))); |
|
1295 if (intermediate) |
|
1296 *intermediate = g_value_get_boolean (gst_structure_id_get_value (structure, |
|
1297 GST_QUARK (INTERMEDIATE))); |
|
1298 } |