From eb03323fb683e06ed8e7f557037f13252f150c25 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 5 Sep 2011 13:56:05 +0100 Subject: [PATCH 1/5] libgstvideo: add a new API to handle QoS events and dropping logic https://bugzilla.gnome.org/show_bug.cgi?id=658241 --- docs/libs/gst-plugins-base-libs-sections.txt | 6 + gst-libs/gst/video/video.c | 217 +++++++++++++++++++ gst-libs/gst/video/video.h | 38 ++++ win32/common/libgstvideo.def | 5 + 4 files changed, 266 insertions(+) diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt index fe52a0cbd1..3286ee2cde 100644 --- a/docs/libs/gst-plugins-base-libs-sections.txt +++ b/docs/libs/gst-plugins-base-libs-sections.txt @@ -2305,6 +2305,12 @@ gst_video_event_parse_still_frame gst_video_format_get_type GST_TYPE_VIDEO_FORMAT +GstVideoQoSTracker +gst_video_qos_tracker_init +gst_video_qos_tracker_reset +gst_video_qos_tracker_update +gst_video_qos_tracker_process_frame +gst_video_qos_tracker_clear
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index af4c122606..1b7fed27b1 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -2330,3 +2330,220 @@ gst_video_parse_caps_palette (GstCaps * caps) return p; } + +/** + * gst_video_qos_tracker_init: + * @qt: The #GstVideoQoSTracker to initialize + * @element: The element the tracker belongs to, which will be sending the QoS + * messages when appropriate. + * + * Initialize a #GstVideoQoSTracker. Call gst_video_qos_tracker_clear when done. + * Includes its own locking, so it's safe to call the gst_video_qos_tracker_ API + * from multiple threads (except _init and _clear, of course). + * + * The element is not referenced, so must have a lifetime that encompasses that + * of the GstVideoQoSTracker. This is implicit in the typical case where the + * GstVideoQoSTracker is a member of the owning element. + * + * Since: 0.10.36 + */ +void +gst_video_qos_tracker_init (GstVideoQoSTracker * qt, GstElement * element) +{ + qt->lock = g_mutex_new (); + qt->element = element; + gst_video_qos_tracker_reset (qt); +} + +/** + * gst_video_qos_tracker_reset: + * @qt: The #GstVideoQoSTracker to reset + * + * Reset a #GstVideoQoSTracker. + * Use when restarting an element. + * + * Since: 0.10.36 + */ +void +gst_video_qos_tracker_reset (GstVideoQoSTracker * qt) +{ + g_return_if_fail (qt && qt->lock); + g_mutex_lock (qt->lock); + qt->proportion = 1.0; + qt->timestamp = GST_CLOCK_TIME_NONE; + qt->diff = 0; + qt->earliest_time = GST_CLOCK_TIME_NONE; + qt->processed = 0; + qt->dropped = 0; + g_mutex_unlock (qt->lock); +} + +/** + * gst_video_qos_tracker_update: + * @qt: The #GstVideoQoSTracker to update + * @event: The event to update from, must a QOS event + * @frame_duration: the duration of a frame, if known, + * may be GST_CLOCK_TIME_NONE is unknown + * @method: the algorithm to use to determine the time at + * which to start accepting frames again when we're late + * + * Update a #GstVideoQoSTracker from an incoming QOS event. + * This allows the QoS tracker to know whether the sink is + * late or not. + * An element using a GstVideoQoSTracker should pass all + * QOS events to this function. + * + * Since: 0.10.36 + */ +void +gst_video_qos_tracker_update (GstVideoQoSTracker * qt, GstEvent * event, + GstClockTime frame_duration, GstVideoQoSTrackerMethod method) +{ + gdouble proportion; + GstClockTime timestamp; + GstClockTimeDiff diff; + + g_return_if_fail (qt && qt->lock); + g_return_if_fail (event && GST_IS_EVENT (event)); + g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_QOS); + + gst_event_parse_qos (event, &proportion, &diff, ×tamp); + + g_mutex_lock (qt->lock); + + qt->proportion = proportion; + qt->diff = diff; + + if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) { + qt->timestamp = timestamp; + if (G_UNLIKELY (diff > 0)) { + switch (method) { + case GST_VIDEO_QOS_TRACKER_DIFF: + qt->earliest_time = qt->timestamp + diff; + break; + case GST_VIDEO_QOS_TRACKER_TWICE_DIFF: + qt->earliest_time = qt->timestamp + 2 * diff; + break; + default: + g_assert_not_reached (); + qt->earliest_time = qt->timestamp + diff; + break; + } + if (GST_CLOCK_TIME_IS_VALID (frame_duration)) { + qt->earliest_time += frame_duration; + } + } else { + qt->earliest_time = qt->timestamp + qt->diff; + } + } else { + qt->timestamp = GST_CLOCK_TIME_NONE; + qt->earliest_time = GST_CLOCK_TIME_NONE; + } + + GST_DEBUG_OBJECT (qt->element, + "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, + GST_TIME_ARGS (qt->timestamp), qt->diff); + + g_mutex_unlock (qt->lock); +} + +/** + * gst_video_qos_tracker_process_frame: + * @qt: The #GstVideoQoSTracker to use + * @segment: The segment to use to determine running times + * @timestamp: the timestamp of the buffer to consider. + * May be GST_CLOCK_TIME_NONE if unknown. + * @duration: the duration of the buffer to consider. + * May be GST_CLOCK_TIME_NONE if unknown. + * + * Decides if a frame should be dropped or not based on the known + * timings from previously received QOS events. + * Frames with unknown timestamps will never be dropped. + * If a frame is to be dropped, an appropriate QoS message will + * be sent on behalf of the owning element, and the element should + * not send that buffer downstream. + * + * Returns: %TRUE if the buffer should be dropped, %FALSE otherwise. + * + * Since: 0.10.36 + */ +gboolean +gst_video_qos_tracker_process_frame (GstVideoQoSTracker * qt, + const GstSegment * segment, GstClockTime timestamp, GstClockTime duration) +{ + GstClockTime running_time; + gboolean skip; + GstClockTime earliest_time; + + g_return_val_if_fail (qt && qt->lock, FALSE); + g_return_val_if_fail (segment, FALSE); + + if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (timestamp))) + return FALSE; + + g_mutex_lock (qt->lock); + + earliest_time = qt->earliest_time; + + /* qos needs to be done on running time */ + running_time = + gst_segment_to_running_time ((GstSegment *) segment, GST_FORMAT_TIME, + timestamp); + skip = GST_CLOCK_TIME_IS_VALID (earliest_time) + && running_time <= earliest_time; + + if (skip) { + GstMessage *qos_msg; + guint64 stream_time; + gint64 jitter; + guint64 dropped, processed; + gdouble proportion; + + qt->dropped++; + + proportion = qt->proportion; + processed = qt->processed; + dropped = qt->dropped; + + g_mutex_unlock (qt->lock); + + GST_DEBUG_OBJECT (qt->element, "skipping decoding: qostime %" + GST_TIME_FORMAT " <= %" GST_TIME_FORMAT, + GST_TIME_ARGS (running_time), GST_TIME_ARGS (earliest_time)); + + stream_time = + gst_segment_to_stream_time ((GstSegment *) segment, GST_FORMAT_TIME, + timestamp); + jitter = GST_CLOCK_DIFF (running_time, earliest_time); + + qos_msg = + gst_message_new_qos (GST_OBJECT_CAST (qt->element), FALSE, running_time, + stream_time, timestamp, duration); + gst_message_set_qos_values (qos_msg, jitter, proportion, 1000000); + gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS, processed, dropped); + gst_element_post_message (qt->element, qos_msg); + } else { + qt->processed++; + g_mutex_unlock (qt->lock); + } + + return skip; +} + +/** + * gst_video_qos_tracker_clear: + * @qt: The #GstVideoQoSTracker to clear + * + * Clears a previously initialized GstVideoQoSTracker. + * That GstVideoQoSTracker may be be used after this call, unless + * it is initialized again. + * + * Since: 0.10.36 + */ +void +gst_video_qos_tracker_clear (GstVideoQoSTracker * qt) +{ + g_return_if_fail (qt && qt->lock); + g_mutex_free (qt->lock); + qt->lock = NULL; +} diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h index 52e0fea51a..637cae49ae 100644 --- a/gst-libs/gst/video/video.h +++ b/gst-libs/gst/video/video.h @@ -435,6 +435,34 @@ typedef enum { */ #define GST_VIDEO_BUFFER_PROGRESSIVE GST_BUFFER_FLAG_MEDIA4 +/** + * GstVideoQoSTrackerMethod: + * @GST_VIDEO_QOS_TRACKER_2DURATION: + * + * Enum value describing the algorithm to use to determine when to drop a frame. + */ +typedef enum { + GST_VIDEO_QOS_TRACKER_DIFF, + GST_VIDEO_QOS_TRACKER_TWICE_DIFF, +} GstVideoQoSTrackerMethod; + +typedef struct _GstVideoQoSTracker GstVideoQoSTracker; +struct _GstVideoQoSTracker { + gdouble proportion; + GstClockTime timestamp; + GstClockTimeDiff diff; + GstClockTime earliest_time; + guint64 processed; + guint64 dropped; + GMutex *lock; /* protects the above */ + GstElement *element; + + /*< private >*/ + union { + gpointer _gst_reserved[GST_PADDING]; + } abidata; +}; + /* functions */ const GValue * gst_video_frame_rate (GstPad * pad); @@ -569,6 +597,16 @@ GstBuffer * gst_video_convert_frame (GstBuffer * buf, GstClockTime timeout, GError ** error); +/* QoS */ +void gst_video_qos_tracker_init (GstVideoQoSTracker * qt, GstElement *element); +void gst_video_qos_tracker_reset (GstVideoQoSTracker * qt); +void gst_video_qos_tracker_update (GstVideoQoSTracker * qt, GstEvent* event, + GstClockTime frame_duration, + GstVideoQoSTrackerMethod method); +gboolean gst_video_qos_tracker_process_frame (GstVideoQoSTracker * qt, const GstSegment *segment, + GstClockTime timestamp, GstClockTime duration); +void gst_video_qos_tracker_clear (GstVideoQoSTracker * qt); + G_END_DECLS #endif /* __GST_VIDEO_H__ */ diff --git a/win32/common/libgstvideo.def b/win32/common/libgstvideo.def index 9f9fad3ec5..537b3b0333 100644 --- a/win32/common/libgstvideo.def +++ b/win32/common/libgstvideo.def @@ -35,3 +35,8 @@ EXPORTS gst_video_parse_caps_pixel_aspect_ratio gst_video_sink_center_rect gst_video_sink_get_type + gst_video_qos_tracker_init + gst_video_qos_tracker_reset + gst_video_qos_tracker_update + gst_video_qos_tracker_process_frame + gst_video_qos_tracker_clear From 149a4ce390a78e21309b210f7daba9db5d42afe6 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 7 Sep 2011 16:04:14 +0100 Subject: [PATCH 2/5] theoradec: move the QoS logic to libgstvideo https://bugzilla.gnome.org/show_bug.cgi?id=658241 --- ext/theora/gsttheoradec.c | 76 ++++++--------------------------------- ext/theora/gsttheoradec.h | 8 ++--- 2 files changed, 13 insertions(+), 71 deletions(-) diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c index 25d68dbac5..9e417be98d 100644 --- a/ext/theora/gsttheoradec.c +++ b/ext/theora/gsttheoradec.c @@ -231,15 +231,9 @@ gst_theora_dec_reset (GstTheoraDec * dec) dec->discont = TRUE; dec->frame_nr = -1; dec->seqnum = gst_util_seqnum_next (); - dec->dropped = 0; - dec->processed = 0; + gst_video_qos_tracker_reset (&dec->qt); gst_segment_init (&dec->segment, GST_FORMAT_TIME); - GST_OBJECT_LOCK (dec); - dec->proportion = 1.0; - dec->earliest_time = -1; - GST_OBJECT_UNLOCK (dec); - g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL); g_list_free (dec->queued); dec->queued = NULL; @@ -576,23 +570,12 @@ theora_dec_src_event (GstPad * pad, GstEvent * event) } case GST_EVENT_QOS: { - gdouble proportion; - GstClockTimeDiff diff; - GstClockTime timestamp; - - gst_event_parse_qos (event, &proportion, &diff, ×tamp); - /* we cannot randomly skip frame decoding since we don't have * B frames. we can however use the timestamp and diff to not * push late frames. This would at least save us the time to * crop/memcpy the data. */ - GST_OBJECT_LOCK (dec); - dec->proportion = proportion; - dec->earliest_time = timestamp + diff; - GST_OBJECT_UNLOCK (dec); - - GST_DEBUG_OBJECT (dec, "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, - GST_TIME_ARGS (timestamp), diff); + gst_video_qos_tracker_update (&dec->qt, event, + GST_CLOCK_TIME_NONE, GST_VIDEO_QOS_TRACKER_DIFF); res = gst_pad_push_event (dec->sinkpad, event); break; @@ -1146,50 +1129,11 @@ theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet, if (G_UNLIKELY (th_decode_packetin (dec->decoder, packet, &gp) < 0)) goto decode_error; - if (outtime != -1) { - gboolean need_skip; - GstClockTime running_time; - GstClockTime earliest_time; - gdouble proportion; - - /* qos needs to be done on running time */ - running_time = gst_segment_to_running_time (&dec->segment, GST_FORMAT_TIME, - outtime); - - GST_OBJECT_LOCK (dec); - proportion = dec->proportion; - earliest_time = dec->earliest_time; - /* check for QoS, don't perform the last steps of getting and - * pushing the buffers that are known to be late. */ - need_skip = earliest_time != -1 && running_time <= earliest_time; - GST_OBJECT_UNLOCK (dec); - - if (need_skip) { - GstMessage *qos_msg; - guint64 stream_time; - gint64 jitter; - - GST_DEBUG_OBJECT (dec, "skipping decoding: qostime %" - GST_TIME_FORMAT " <= %" GST_TIME_FORMAT, - GST_TIME_ARGS (running_time), GST_TIME_ARGS (earliest_time)); - - dec->dropped++; - - stream_time = - gst_segment_to_stream_time (&dec->segment, GST_FORMAT_TIME, outtime); - jitter = GST_CLOCK_DIFF (running_time, earliest_time); - - qos_msg = - gst_message_new_qos (GST_OBJECT_CAST (dec), FALSE, running_time, - stream_time, outtime, outdur); - gst_message_set_qos_values (qos_msg, jitter, proportion, 1000000); - gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS, - dec->processed, dec->dropped); - gst_element_post_message (GST_ELEMENT_CAST (dec), qos_msg); - - goto dropping_qos; - } - } + /* check for QoS, don't perform the last steps of getting and + * pushing the buffers that are known to be late. */ + if (gst_video_qos_tracker_process_frame (&dec->qt, &dec->segment, outtime, + outdur)) + goto dropping_qos; /* this does postprocessing and set up the decoded frame * pointers in our yuv variable */ @@ -1212,8 +1156,6 @@ theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet, GST_BUFFER_TIMESTAMP (out) = outtime; GST_BUFFER_DURATION (out) = outdur; - dec->processed++; - if (dec->segment.rate >= 0.0) result = theora_dec_push_forward (dec, out); else @@ -1506,6 +1448,7 @@ theora_dec_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: + gst_video_qos_tracker_init (&dec->qt, element); break; case GST_STATE_CHANGE_READY_TO_PAUSED: th_info_clear (&dec->info); @@ -1536,6 +1479,7 @@ theora_dec_change_state (GstElement * element, GstStateChange transition) gst_theora_dec_reset (dec); break; case GST_STATE_CHANGE_READY_TO_NULL: + gst_video_qos_tracker_clear (&dec->qt); break; default: break; diff --git a/ext/theora/gsttheoradec.h b/ext/theora/gsttheoradec.h index f6722119a6..9f10b8dcd2 100644 --- a/ext/theora/gsttheoradec.h +++ b/ext/theora/gsttheoradec.h @@ -25,6 +25,7 @@ #endif #include +#include #include #include @@ -97,11 +98,8 @@ struct _GstTheoraDec gboolean discont; guint32 seqnum; - /* QoS stuff */ /* with LOCK*/ - gdouble proportion; - GstClockTime earliest_time; - guint64 processed; - guint64 dropped; + /* QoS stuff */ + GstVideoQoSTracker qt; gboolean have_par; gint par_num; From 96374054ac158b8350db762bbefafbb3a80bcf81 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 28 Nov 2011 12:51:22 +0000 Subject: [PATCH 3/5] various: fix pad template leaks https://bugzilla.gnome.org/show_bug.cgi?id=662664 --- ext/alsa/gstalsasink.c | 4 ++-- ext/alsa/gstalsasrc.c | 4 ++-- ext/gio/gstgiobasesink.c | 3 +-- ext/gio/gstgiobasesrc.c | 3 +-- ext/gnomevfs/gstgnomevfssink.c | 3 +-- ext/gnomevfs/gstgnomevfssrc.c | 3 +-- ext/libvisual/visual.c | 6 ++---- ext/ogg/gstoggaviparse.c | 8 ++++---- ext/ogg/gstoggdemux.c | 8 ++++---- ext/ogg/gstoggmux.c | 6 ++---- ext/ogg/gstoggparse.c | 8 ++++---- ext/ogg/gstogmparse.c | 8 ++++---- ext/pango/gsttextoverlay.c | 12 ++++++------ ext/pango/gsttextrender.c | 8 ++++---- ext/theora/gsttheoradec.c | 8 ++++---- ext/theora/gsttheoraenc.c | 8 ++++---- ext/theora/gsttheoraparse.c | 8 ++++---- ext/vorbis/gstvorbisdec.c | 10 ++++------ ext/vorbis/gstvorbisenc.c | 8 ++++---- ext/vorbis/gstvorbisparse.c | 8 ++++---- gst-libs/gst/app/gstappsink.c | 4 ++-- gst-libs/gst/app/gstappsrc.c | 4 ++-- gst-libs/gst/cdda/gstcddabasesrc.c | 4 ++-- gst-libs/gst/tag/gsttagdemux.c | 3 +-- gst/adder/gstadder.c | 8 ++++---- gst/audioconvert/gstaudioconvert.c | 8 ++++---- gst/audiorate/gstaudiorate.c | 8 ++++---- gst/audioresample/gstaudioresample.c | 8 ++++---- gst/audiotestsrc/gstaudiotestsrc.c | 4 ++-- gst/encoding/gstencodebin.c | 20 ++++++++++---------- gst/encoding/gstsmartencoder.c | 7 +++---- gst/encoding/gststreamcombiner.c | 8 ++++---- gst/encoding/gststreamsplitter.c | 8 ++++---- gst/ffmpegcolorspace/gstffmpegcolorspace.c | 8 ++++---- gst/gdp/gstgdpdepay.c | 8 ++++---- gst/gdp/gstgdppay.c | 8 ++++---- gst/playback/gstdecodebin.c | 8 ++++---- gst/playback/gstdecodebin2.c | 8 ++++---- gst/playback/gstplaysink.c | 20 ++++++++++---------- gst/playback/gststreamselector.c | 8 ++++---- gst/playback/gststreamsynchronizer.c | 8 ++++---- gst/playback/gstsubtitleoverlay.c | 12 ++++++------ gst/playback/gsturidecodebin.c | 4 ++-- gst/subparse/gstssaparse.c | 6 ++---- gst/subparse/gstsubparse.c | 6 ++---- gst/tcp/gstmultifdsink.c | 3 +-- gst/tcp/gsttcpclientsink.c | 3 +-- gst/tcp/gsttcpclientsrc.c | 3 +-- gst/tcp/gsttcpserversrc.c | 3 +-- gst/videorate/gstvideorate.c | 8 ++++---- gst/videoscale/gstvideoscale.c | 11 +++++++---- gst/videotestsrc/gstvideotestsrc.c | 7 +++++-- sys/v4l/gstv4lmjpegsink.c | 4 ++-- sys/v4l/gstv4lmjpegsrc.c | 4 ++-- sys/v4l/gstv4lsrc.c | 4 ++-- sys/ximage/ximagesink.c | 4 ++-- sys/xvimage/xvimagesink.c | 4 ++-- tests/check/elements/audiorate.c | 7 +++---- tests/check/elements/decodebin.c | 7 +++---- tests/check/elements/decodebin2.c | 19 +++++++------------ tests/check/elements/playbin.c | 6 ++---- tests/check/elements/playbin2-compressed.c | 15 +++++---------- tests/check/elements/playbin2.c | 6 ++---- tests/check/elements/videoscale.c | 4 ++-- 64 files changed, 212 insertions(+), 242 deletions(-) diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 2fb37df2a3..a878b5ef08 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -172,8 +172,8 @@ gst_alsasink_base_init (gpointer g_class) "Audio sink (ALSA)", "Sink/Audio", "Output to a sound card via ALSA", "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&alsasink_sink_factory)); + gst_element_class_add_static_pad_template (element_class, + &alsasink_sink_factory); } static void diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index e2ca602a70..096c58b5a6 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -197,8 +197,8 @@ gst_alsasrc_base_init (gpointer g_class) "Audio source (ALSA)", "Source/Audio", "Read from a sound card via ALSA", "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&alsasrc_src_factory)); + gst_element_class_add_static_pad_template (element_class, + &alsasrc_src_factory); } static void diff --git a/ext/gio/gstgiobasesink.c b/ext/gio/gstgiobasesink.c index 40a64eb270..40add1c28e 100644 --- a/ext/gio/gstgiobasesink.c +++ b/ext/gio/gstgiobasesink.c @@ -55,8 +55,7 @@ gst_gio_base_sink_base_init (gpointer gclass) GST_DEBUG_CATEGORY_INIT (gst_gio_base_sink_debug, "gio_base_sink", 0, "GIO base sink"); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); + gst_element_class_add_static_pad_template (element_class, &sink_factory); } static void diff --git a/ext/gio/gstgiobasesrc.c b/ext/gio/gstgiobasesrc.c index 133e12c263..a51b104bb5 100644 --- a/ext/gio/gstgiobasesrc.c +++ b/ext/gio/gstgiobasesrc.c @@ -61,8 +61,7 @@ gst_gio_base_src_base_init (gpointer gclass) GST_DEBUG_CATEGORY_INIT (gst_gio_base_src_debug, "gio_base_src", 0, "GIO base source"); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); + gst_element_class_add_static_pad_template (element_class, &src_factory); } static void diff --git a/ext/gnomevfs/gstgnomevfssink.c b/ext/gnomevfs/gstgnomevfssink.c index 1a5f31f239..205f1bb315 100644 --- a/ext/gnomevfs/gstgnomevfssink.c +++ b/ext/gnomevfs/gstgnomevfssink.c @@ -131,8 +131,7 @@ gst_gnome_vfs_sink_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sinktemplate)); + gst_element_class_add_static_pad_template (element_class, &sinktemplate); gst_element_class_set_details_simple (element_class, "GnomeVFS Sink", "Sink/File", diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index ef9ab74157..9be426a45d 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -179,8 +179,7 @@ gst_gnome_vfs_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_static_pad_template (element_class, &srctemplate); gst_element_class_set_details_simple (element_class, "GnomeVFS Source", "Source/File", "Read from any GnomeVFS-supported file", diff --git a/ext/libvisual/visual.c b/ext/libvisual/visual.c index 48c1e27080..467c90fd57 100644 --- a/ext/libvisual/visual.c +++ b/ext/libvisual/visual.c @@ -194,10 +194,8 @@ gst_visual_class_init (gpointer g_class, gpointer class_data) klass->plugin->info->name, klass->plugin->info->version); /* FIXME: improve to only register what plugin supports? */ - gst_element_class_add_pad_template (element, - gst_static_pad_template_get (&src_template)); - gst_element_class_add_pad_template (element, - gst_static_pad_template_get (&sink_template)); + gst_element_class_add_static_pad_template (element, &src_template); + gst_element_class_add_static_pad_template (element, &sink_template); gst_element_class_set_details_simple (element, longname, "Visualization", klass->plugin->info->about, "Benjamin Otte "); diff --git a/ext/ogg/gstoggaviparse.c b/ext/ogg/gstoggaviparse.c index 2851e5272d..92c02a7bce 100644 --- a/ext/ogg/gstoggaviparse.c +++ b/ext/ogg/gstoggaviparse.c @@ -138,10 +138,10 @@ gst_ogg_avi_parse_base_init (gpointer g_class) "parse an ogg avi stream into pages (info about ogg: http://xiph.org)", "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&ogg_avi_parse_sink_template_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&ogg_avi_parse_src_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &ogg_avi_parse_sink_template_factory); + gst_element_class_add_static_pad_template (element_class, + &ogg_avi_parse_src_template_factory); } static void diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 58aa56023e..44240c0476 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -1952,10 +1952,10 @@ gst_ogg_demux_base_init (gpointer g_class) "demux ogg streams (info about ogg: http://xiph.org)", "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&ogg_demux_sink_template_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&ogg_demux_src_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &ogg_demux_sink_template_factory); + gst_element_class_add_static_pad_template (element_class, + &ogg_demux_src_template_factory); } static void diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 06133e30f0..80147eb933 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -170,10 +170,8 @@ gst_ogg_mux_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); + gst_element_class_add_static_pad_template (element_class, &src_factory); + gst_element_class_add_static_pad_template (element_class, &sink_factory); gst_element_class_set_details_simple (element_class, "Ogg muxer", "Codec/Muxer", diff --git a/ext/ogg/gstoggparse.c b/ext/ogg/gstoggparse.c index 104a0e56e4..3bdcecb130 100644 --- a/ext/ogg/gstoggparse.c +++ b/ext/ogg/gstoggparse.c @@ -224,10 +224,10 @@ gst_ogg_parse_base_init (gpointer g_class) "parse ogg streams into pages (info about ogg: http://xiph.org)", "Michael Smith "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&ogg_parse_sink_template_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&ogg_parse_src_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &ogg_parse_sink_template_factory); + gst_element_class_add_static_pad_template (element_class, + &ogg_parse_src_template_factory); } static void diff --git a/ext/ogg/gstogmparse.c b/ext/ogg/gstogmparse.c index 6b054a2d17..e68d5c27a1 100644 --- a/ext/ogg/gstogmparse.c +++ b/ext/ogg/gstogmparse.c @@ -279,8 +279,8 @@ gst_ogm_audio_parse_base_init (GstOgmParseClass * klass) "parse an OGM audio header and stream", "GStreamer maintainers "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory_audio)); + gst_element_class_add_static_pad_template (element_class, + &sink_factory_audio); audio_src_templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_SOMETIMES, caps); gst_element_class_add_pad_template (element_class, audio_src_templ); @@ -297,8 +297,8 @@ gst_ogm_video_parse_base_init (GstOgmParseClass * klass) "parse an OGM video header and stream", "GStreamer maintainers "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory_video)); + gst_element_class_add_static_pad_template (element_class, + &sink_factory_video); video_src_templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_SOMETIMES, caps); gst_element_class_add_pad_template (element_class, video_src_templ); diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index d57cdf4a2b..6abff7dbc5 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -368,16 +368,16 @@ gst_text_overlay_base_init (gpointer g_class) GstTextOverlayClass *klass = GST_TEXT_OVERLAY_CLASS (g_class); PangoFontMap *fontmap; - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&video_sink_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &src_template_factory); + gst_element_class_add_static_pad_template (element_class, + &video_sink_template_factory); /* ugh */ if (!GST_IS_TIME_OVERLAY_CLASS (g_class) && !GST_IS_CLOCK_OVERLAY_CLASS (g_class)) { - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&text_sink_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &text_sink_template_factory); } gst_element_class_set_details_simple (element_class, "Text overlay", diff --git a/ext/pango/gsttextrender.c b/ext/pango/gsttextrender.c index e200758802..38ea44ad53 100644 --- a/ext/pango/gsttextrender.c +++ b/ext/pango/gsttextrender.c @@ -175,10 +175,10 @@ gst_text_render_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &src_template_factory); + gst_element_class_add_static_pad_template (element_class, + &sink_template_factory); gst_element_class_set_details_simple (element_class, "Text renderer", "Filter/Editor/Video", diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c index 9e417be98d..34d89db592 100644 --- a/ext/theora/gsttheoradec.c +++ b/ext/theora/gsttheoradec.c @@ -113,10 +113,10 @@ gst_theora_dec_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_dec_src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_dec_sink_factory)); + gst_element_class_add_static_pad_template (element_class, + &theora_dec_src_factory); + gst_element_class_add_static_pad_template (element_class, + &theora_dec_sink_factory); gst_element_class_set_details_simple (element_class, "Theora video decoder", "Codec/Decoder/Video", "decode raw theora streams to raw YUV video", diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index 0d32360597..99f8c0a045 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -284,10 +284,10 @@ gst_theora_enc_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_enc_src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_enc_sink_factory)); + gst_element_class_add_static_pad_template (element_class, + &theora_enc_src_factory); + gst_element_class_add_static_pad_template (element_class, + &theora_enc_sink_factory); gst_element_class_set_details_simple (element_class, "Theora video encoder", "Codec/Encoder/Video", "encode raw YUV video to a theora stream", diff --git a/ext/theora/gsttheoraparse.c b/ext/theora/gsttheoraparse.c index 0ce68d92e9..c706d766da 100644 --- a/ext/theora/gsttheoraparse.c +++ b/ext/theora/gsttheoraparse.c @@ -105,10 +105,10 @@ gst_theora_parse_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_parse_src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_parse_sink_factory)); + gst_element_class_add_static_pad_template (element_class, + &theora_parse_src_factory); + gst_element_class_add_static_pad_template (element_class, + &theora_parse_sink_factory); gst_element_class_set_details_simple (element_class, "Theora video parser", "Codec/Parser/Video", "parse raw theora streams", "Andy Wingo "); diff --git a/ext/vorbis/gstvorbisdec.c b/ext/vorbis/gstvorbisdec.c index 9a89fe7fb7..c1a3614b1b 100644 --- a/ext/vorbis/gstvorbisdec.c +++ b/ext/vorbis/gstvorbisdec.c @@ -79,13 +79,11 @@ static void gst_vorbis_dec_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - GstPadTemplate *src_template, *sink_template; - src_template = gst_static_pad_template_get (&vorbis_dec_src_factory); - gst_element_class_add_pad_template (element_class, src_template); - - sink_template = gst_static_pad_template_get (&vorbis_dec_sink_factory); - gst_element_class_add_pad_template (element_class, sink_template); + gst_element_class_add_static_pad_template (element_class, + &vorbis_dec_src_factory); + gst_element_class_add_static_pad_template (element_class, + &vorbis_dec_sink_factory); gst_element_class_set_details_simple (element_class, "Vorbis audio decoder", "Codec/Decoder/Audio", diff --git a/ext/vorbis/gstvorbisenc.c b/ext/vorbis/gstvorbisenc.c index 45c871a085..dabedc633b 100644 --- a/ext/vorbis/gstvorbisenc.c +++ b/ext/vorbis/gstvorbisenc.c @@ -135,10 +135,10 @@ gst_vorbis_enc_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&vorbis_enc_src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&vorbis_enc_sink_factory)); + gst_element_class_add_static_pad_template (element_class, + &vorbis_enc_src_factory); + gst_element_class_add_static_pad_template (element_class, + &vorbis_enc_sink_factory); gst_element_class_set_details_simple (element_class, "Vorbis audio encoder", "Codec/Encoder/Audio", diff --git a/ext/vorbis/gstvorbisparse.c b/ext/vorbis/gstvorbisparse.c index 53fd7b1b36..4e905d8512 100644 --- a/ext/vorbis/gstvorbisparse.c +++ b/ext/vorbis/gstvorbisparse.c @@ -91,10 +91,10 @@ gst_vorbis_parse_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&vorbis_parse_src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&vorbis_parse_sink_factory)); + gst_element_class_add_static_pad_template (element_class, + &vorbis_parse_src_factory); + gst_element_class_add_static_pad_template (element_class, + &vorbis_parse_sink_factory); gst_element_class_set_details_simple (element_class, "VorbisParse", "Codec/Parser/Audio", "parse raw vorbis streams", diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c index 39e3defecb..fed4dd8237 100644 --- a/gst-libs/gst/app/gstappsink.c +++ b/gst-libs/gst/app/gstappsink.c @@ -229,8 +229,8 @@ gst_app_sink_base_init (gpointer g_class) "Generic/Sink", "Allow the application to get access to raw buffer", "David Schleef , Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_app_sink_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_app_sink_template); } static void diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c index fb72c29db5..18e357300b 100644 --- a/gst-libs/gst/app/gstappsrc.c +++ b/gst-libs/gst/app/gstappsrc.c @@ -260,8 +260,8 @@ gst_app_src_base_init (gpointer g_class) "Generic/Source", "Allow the application to feed buffers to a pipeline", "David Schleef , Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_app_src_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_app_src_template); } static void diff --git a/gst-libs/gst/cdda/gstcddabasesrc.c b/gst-libs/gst/cdda/gstcddabasesrc.c index e753a567f3..06036dbcfb 100644 --- a/gst-libs/gst/cdda/gstcddabasesrc.c +++ b/gst-libs/gst/cdda/gstcddabasesrc.c @@ -181,8 +181,8 @@ gst_cdda_base_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_cdda_base_src_src_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_cdda_base_src_src_template); /* our very own formats */ track_format = gst_format_register ("track", "CD track"); diff --git a/gst-libs/gst/tag/gsttagdemux.c b/gst-libs/gst/tag/gsttagdemux.c index 893989a5b2..7803ddb24c 100644 --- a/gst-libs/gst/tag/gsttagdemux.c +++ b/gst-libs/gst/tag/gsttagdemux.c @@ -214,8 +214,7 @@ gst_tag_demux_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); + gst_element_class_add_static_pad_template (element_class, &src_factory); GST_DEBUG_CATEGORY_INIT (tagdemux_debug, "tagdemux", 0, "tag demux base class"); diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index 5ba7c7d61d..9c69717dad 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -796,10 +796,10 @@ gst_adder_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&gst_adder_src_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&gst_adder_sink_template)); + gst_element_class_add_static_pad_template (gstelement_class, + &gst_adder_src_template); + gst_element_class_add_static_pad_template (gstelement_class, + &gst_adder_sink_template); gst_element_class_set_details_simple (gstelement_class, "Adder", "Generic/Audio", "Add N audio channels together", diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index 188c191daf..717cf10a24 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -221,10 +221,10 @@ gst_audio_convert_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_audio_convert_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_audio_convert_sink_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_audio_convert_src_template); + gst_element_class_add_static_pad_template (element_class, + &gst_audio_convert_sink_template); gst_element_class_set_details_simple (element_class, "Audio converter", "Filter/Converter/Audio", "Convert audio to different formats", "Benjamin Otte "); diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index 40d3467a94..cf697c57df 100644 --- a/gst/audiorate/gstaudiorate.c +++ b/gst/audiorate/gstaudiorate.c @@ -165,10 +165,10 @@ gst_audio_rate_base_init (gpointer g_class) "Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream", "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_audio_rate_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_audio_rate_src_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_audio_rate_sink_template); + gst_element_class_add_static_pad_template (element_class, + &gst_audio_rate_src_template); } static void diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c index e63d106db0..7c488829d3 100644 --- a/gst/audioresample/gstaudioresample.c +++ b/gst/audioresample/gstaudioresample.c @@ -154,10 +154,10 @@ gst_audio_resample_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&gst_audio_resample_src_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&gst_audio_resample_sink_template)); + gst_element_class_add_static_pad_template (gstelement_class, + &gst_audio_resample_src_template); + gst_element_class_add_static_pad_template (gstelement_class, + &gst_audio_resample_sink_template); gst_element_class_set_details_simple (gstelement_class, "Audio resampler", "Filter/Converter/Audio", "Resamples audio", diff --git a/gst/audiotestsrc/gstaudiotestsrc.c b/gst/audiotestsrc/gstaudiotestsrc.c index 78a5d6b6ea..4428ccefc1 100644 --- a/gst/audiotestsrc/gstaudiotestsrc.c +++ b/gst/audiotestsrc/gstaudiotestsrc.c @@ -168,8 +168,8 @@ gst_audio_test_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_audio_test_src_src_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_audio_test_src_src_template); gst_element_class_set_details_simple (element_class, "Audio test source", "Source/Audio", "Creates audio test signals of given frequency and volume", diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c index d34d80636b..17610cbe9d 100644 --- a/gst/encoding/gstencodebin.c +++ b/gst/encoding/gstencodebin.c @@ -408,16 +408,16 @@ gst_encode_bin_class_init (GstEncodeBinClass * klass) klass->request_pad = gst_encode_bin_request_pad_signal; - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&muxer_src_template)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&video_sink_template)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&audio_sink_template)); - /* gst_element_class_add_pad_template (gstelement_klass, */ - /* gst_static_pad_template_get (&text_sink_template)); */ - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&private_sink_template)); + gst_element_class_add_static_pad_template (gstelement_klass, + &muxer_src_template); + gst_element_class_add_static_pad_template (gstelement_klass, + &video_sink_template); + gst_element_class_add_static_pad_template (gstelement_klass, + &audio_sink_template); + /* gst_element_class_add_static_pad_template (gstelement_klass, */ + /* &text_sink_template); */ + gst_element_class_add_static_pad_template (gstelement_klass, + &private_sink_template); gstelement_klass->change_state = GST_DEBUG_FUNCPTR (gst_encode_bin_change_state); diff --git a/gst/encoding/gstsmartencoder.c b/gst/encoding/gstsmartencoder.c index ed0e42bd5c..97a5635578 100644 --- a/gst/encoding/gstsmartencoder.c +++ b/gst/encoding/gstsmartencoder.c @@ -96,10 +96,9 @@ gst_smart_encoder_class_init (GstSmartEncoderClass * klass) gst_smart_encoder_parent_class = g_type_class_peek_parent (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); + gst_element_class_add_static_pad_template (element_class, &src_template); + gst_element_class_add_static_pad_template (element_class, + &sink_template); gst_element_class_set_details_simple (element_class, "Smart Video Encoder", "Codec/Recoder/Video", diff --git a/gst/encoding/gststreamcombiner.c b/gst/encoding/gststreamcombiner.c index 72d40fe756..7328695917 100644 --- a/gst/encoding/gststreamcombiner.c +++ b/gst/encoding/gststreamcombiner.c @@ -62,10 +62,10 @@ gst_stream_combiner_class_init (GstStreamCombinerClass * klass) GST_DEBUG_CATEGORY_INIT (gst_stream_combiner_debug, "streamcombiner", 0, "Stream Combiner"); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&src_template)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&sink_template)); + gst_element_class_add_static_pad_template (gstelement_klass, + &src_template); + gst_element_class_add_static_pad_template (gstelement_klass, + &sink_template); gstelement_klass->request_new_pad = GST_DEBUG_FUNCPTR (gst_stream_combiner_request_new_pad); diff --git a/gst/encoding/gststreamsplitter.c b/gst/encoding/gststreamsplitter.c index c531b4c6c0..53f755489f 100644 --- a/gst/encoding/gststreamsplitter.c +++ b/gst/encoding/gststreamsplitter.c @@ -62,10 +62,10 @@ gst_stream_splitter_class_init (GstStreamSplitterClass * klass) GST_DEBUG_CATEGORY_INIT (gst_stream_splitter_debug, "streamsplitter", 0, "Stream Splitter"); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&src_template)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&sink_template)); + gst_element_class_add_static_pad_template (gstelement_klass, + &src_template); + gst_element_class_add_static_pad_template (gstelement_klass, + &sink_template); gstelement_klass->request_new_pad = GST_DEBUG_FUNCPTR (gst_stream_splitter_request_new_pad); diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 4ba02046b4..c8805b35f8 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -341,10 +341,10 @@ gst_ffmpegcsp_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_ffmpegcsp_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_ffmpegcsp_sink_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_ffmpegcsp_src_template); + gst_element_class_add_static_pad_template (element_class, + &gst_ffmpegcsp_sink_template); gst_element_class_set_details_simple (element_class, "FFMPEG Colorspace converter", "Filter/Converter/Video", diff --git a/gst/gdp/gstgdpdepay.c b/gst/gdp/gstgdpdepay.c index 702e63fedf..88a24a850b 100644 --- a/gst/gdp/gstgdpdepay.c +++ b/gst/gdp/gstgdpdepay.c @@ -89,10 +89,10 @@ gst_gdp_depay_base_init (gpointer g_class) "Depayloads GStreamer Data Protocol buffers", "Thomas Vander Stichele "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gdp_depay_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gdp_depay_src_template)); + gst_element_class_add_static_pad_template (element_class, + &gdp_depay_sink_template); + gst_element_class_add_static_pad_template (element_class, + &gdp_depay_src_template); } static void diff --git a/gst/gdp/gstgdppay.c b/gst/gdp/gstgdppay.c index 6da4967f7a..209a0c7e7f 100644 --- a/gst/gdp/gstgdppay.c +++ b/gst/gdp/gstgdppay.c @@ -102,10 +102,10 @@ gst_gdp_pay_base_init (gpointer g_class) "Payloads GStreamer Data Protocol buffers", "Thomas Vander Stichele "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gdp_pay_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gdp_pay_src_template)); + gst_element_class_add_static_pad_template (element_class, + &gdp_pay_sink_template); + gst_element_class_add_static_pad_template (element_class, + &gdp_pay_src_template); } static void diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index a3fe80186b..cab0542d9e 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -287,10 +287,10 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass) "The caps of the input data. (NULL = use typefind element)", GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&decoder_bin_sink_template)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&decoder_bin_src_template)); + gst_element_class_add_static_pad_template (gstelement_klass, + &decoder_bin_sink_template); + gst_element_class_add_static_pad_template (gstelement_klass, + &decoder_bin_src_template); gst_element_class_set_details_simple (gstelement_klass, "Decoder Bin", "Generic/Bin/Decoder", diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 2d6f8579c2..8eff9de052 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -930,10 +930,10 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass) klass->autoplug_sort = GST_DEBUG_FUNCPTR (gst_decode_bin_autoplug_sort); klass->autoplug_select = GST_DEBUG_FUNCPTR (gst_decode_bin_autoplug_select); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&decoder_bin_sink_template)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&decoder_bin_src_template)); + gst_element_class_add_static_pad_template (gstelement_klass, + &decoder_bin_sink_template); + gst_element_class_add_static_pad_template (gstelement_klass, + &decoder_bin_src_template); gst_element_class_set_details_simple (gstelement_klass, "Decoder Bin", "Generic/Bin/Decoder", diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index 3639f6c7c1..8ab2eda0eb 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -473,16 +473,16 @@ gst_play_sink_class_init (GstPlaySinkClass * klass) G_STRUCT_OFFSET (GstPlaySinkClass, convert_frame), NULL, NULL, gst_play_marshal_BUFFER__BOXED, GST_TYPE_BUFFER, 1, GST_TYPE_CAPS); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&audiorawtemplate)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&audiotemplate)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&videorawtemplate)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&videotemplate)); - gst_element_class_add_pad_template (gstelement_klass, - gst_static_pad_template_get (&texttemplate)); + gst_element_class_add_static_pad_template (gstelement_klass, + &audiorawtemplate); + gst_element_class_add_static_pad_template (gstelement_klass, + &audiotemplate); + gst_element_class_add_static_pad_template (gstelement_klass, + &videorawtemplate); + gst_element_class_add_static_pad_template (gstelement_klass, + &videotemplate); + gst_element_class_add_static_pad_template (gstelement_klass, + &texttemplate); gst_element_class_set_details_simple (gstelement_klass, "Player Sink", "Generic/Bin/Sink", "Convenience sink for multiple streams", diff --git a/gst/playback/gststreamselector.c b/gst/playback/gststreamselector.c index 294eac4c0e..aafe1fb5f8 100644 --- a/gst/playback/gststreamselector.c +++ b/gst/playback/gststreamselector.c @@ -466,10 +466,10 @@ gst_stream_selector_base_init (GstStreamSelectorClass * klass) "Julien Moutte , " "Jan Schmidt , " "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_stream_selector_sink_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_stream_selector_src_factory)); + gst_element_class_add_static_pad_template (element_class, + &gst_stream_selector_sink_factory); + gst_element_class_add_static_pad_template (element_class, + &gst_stream_selector_src_factory); } static void diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c index 9a48ab06d4..594b4b2be1 100644 --- a/gst/playback/gststreamsynchronizer.c +++ b/gst/playback/gststreamsynchronizer.c @@ -955,10 +955,10 @@ gst_stream_synchronizer_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); + gst_element_class_add_static_pad_template (gstelement_class, + &srctemplate); + gst_element_class_add_static_pad_template (gstelement_class, + &sinktemplate); gst_element_class_set_details_simple (gstelement_class, "Stream Synchronizer", "Generic", diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c index 49d790bf4d..2828a8c610 100644 --- a/gst/playback/gstsubtitleoverlay.c +++ b/gst/playback/gstsubtitleoverlay.c @@ -1617,13 +1617,13 @@ gst_subtitle_overlay_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_static_pad_template (gstelement_class, + &srctemplate); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&video_sinktemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&subtitle_sinktemplate)); + gst_element_class_add_static_pad_template (gstelement_class, + &video_sinktemplate); + gst_element_class_add_static_pad_template (gstelement_class, + &subtitle_sinktemplate); gst_element_class_set_details_simple (gstelement_class, "Subtitle Overlay", "Video/Overlay/Subtitle", diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 2404242ba6..c672a3a52b 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -213,8 +213,8 @@ gst_uri_decode_bin_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_static_pad_template (gstelement_class, + &srctemplate); gst_element_class_set_details_simple (gstelement_class, "URI Decoder", "Generic/Bin/Decoder", "Autoplug and decode an URI to raw media", diff --git a/gst/subparse/gstssaparse.c b/gst/subparse/gstssaparse.c index 5aa68e32eb..e2dccd3acc 100644 --- a/gst/subparse/gstssaparse.c +++ b/gst/subparse/gstssaparse.c @@ -58,10 +58,8 @@ gst_ssa_parse_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_templ)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &sink_templ); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "SSA Subtitle Parser", "Codec/Parser/Subtitle", "Parses SSA subtitle streams", diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 240ef587e5..9c31b549fd 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -124,10 +124,8 @@ gst_sub_parse_base_init (GstSubParseClass * klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_templ)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &sink_templ); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "Subtitle parser", "Codec/Parser/Subtitle", "Parses subtitle (.sub) files into text streams", diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c index 98c62d771a..b6c0f6d631 100644 --- a/gst/tcp/gstmultifdsink.c +++ b/gst/tcp/gstmultifdsink.c @@ -355,8 +355,7 @@ gst_multi_fd_sink_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sinktemplate)); + gst_element_class_add_static_pad_template (element_class, &sinktemplate); gst_element_class_set_details_simple (element_class, "Multi filedescriptor sink", "Sink/Network", diff --git a/gst/tcp/gsttcpclientsink.c b/gst/tcp/gsttcpclientsink.c index ca60578ba5..a4d91089ce 100644 --- a/gst/tcp/gsttcpclientsink.c +++ b/gst/tcp/gsttcpclientsink.c @@ -121,8 +121,7 @@ gst_tcp_client_sink_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sinktemplate)); + gst_element_class_add_static_pad_template (element_class, &sinktemplate); gst_element_class_set_details_simple (element_class, "TCP client sink", "Sink/Network", diff --git a/gst/tcp/gsttcpclientsrc.c b/gst/tcp/gsttcpclientsrc.c index b8ac8490d5..bfceacaa34 100644 --- a/gst/tcp/gsttcpclientsrc.c +++ b/gst/tcp/gsttcpclientsrc.c @@ -93,8 +93,7 @@ gst_tcp_client_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_static_pad_template (element_class, &srctemplate); gst_element_class_set_details_simple (element_class, "TCP client source", "Source/Network", diff --git a/gst/tcp/gsttcpserversrc.c b/gst/tcp/gsttcpserversrc.c index c4244dab79..35d28635a3 100644 --- a/gst/tcp/gsttcpserversrc.c +++ b/gst/tcp/gsttcpserversrc.c @@ -91,8 +91,7 @@ gst_tcp_server_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_static_pad_template (element_class, &srctemplate); gst_element_class_set_details_simple (element_class, "TCP server source", "Source/Network", diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c index bf416fa000..98fc92e363 100644 --- a/gst/videorate/gstvideorate.c +++ b/gst/videorate/gstvideorate.c @@ -170,10 +170,10 @@ gst_video_rate_base_init (gpointer g_class) "Drops/duplicates/adjusts timestamps on video frames to make a perfect stream", "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_video_rate_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_video_rate_src_template)); + gst_element_class_add_static_pad_template (element_class, + &gst_video_rate_sink_template); + gst_element_class_add_static_pad_template (element_class, + &gst_video_rate_src_template); } static void diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index f452e622a9..7b44647e37 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -229,15 +229,18 @@ static void gst_video_scale_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + GstPadTemplate *pad_template; gst_element_class_set_details_simple (element_class, "Video scaler", "Filter/Converter/Video/Scaler", "Resizes video", "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_video_scale_sink_template_factory ()); - gst_element_class_add_pad_template (element_class, - gst_video_scale_src_template_factory ()); + pad_template = gst_video_scale_sink_template_factory (); + gst_element_class_add_pad_template (element_class, pad_template); + gst_object_unref (pad_template); + pad_template = gst_video_scale_src_template_factory (); + gst_element_class_add_pad_template (element_class, pad_template); + gst_object_unref (pad_template); } static void diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index 227e0a9273..2dc01083b2 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -168,14 +168,17 @@ static void gst_video_test_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + GstPadTemplate *pad_template; gst_element_class_set_details_simple (element_class, "Video test source", "Source/Video", "Creates a test video stream", "David A. Schleef "); - gst_element_class_add_pad_template (element_class, + pad_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_video_test_src_getcaps (NULL))); + gst_video_test_src_getcaps (NULL)); + gst_element_class_add_pad_template (element_class, pad_template); + gst_object_unref (pad_template); } static void diff --git a/sys/v4l/gstv4lmjpegsink.c b/sys/v4l/gstv4lmjpegsink.c index 3a5cfaa6d4..c59c15815c 100644 --- a/sys/v4l/gstv4lmjpegsink.c +++ b/sys/v4l/gstv4lmjpegsink.c @@ -115,8 +115,8 @@ gst_v4lmjpegsink_base_init (gpointer g_class) "Writes MJPEG-encoded frames to a zoran MJPEG/video4linux device", "GStreamer maintainers "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sink_template)); + gst_element_class_add_static_pad_template (gstelement_class, + &sink_template); } static void diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c index 61860a18f9..c848b54bbc 100644 --- a/sys/v4l/gstv4lmjpegsrc.c +++ b/sys/v4l/gstv4lmjpegsrc.c @@ -144,8 +144,8 @@ gst_v4lmjpegsrc_base_init (gpointer g_class) "Reads MJPEG-encoded frames from a zoran MJPEG/video4linux device", "GStreamer maintainers "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&src_template)); + gst_element_class_add_static_pad_template (gstelement_class, + &src_template); } static void diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c index c0b5f780ae..208b781ba3 100644 --- a/sys/v4l/gstv4lsrc.c +++ b/sys/v4l/gstv4lsrc.c @@ -77,8 +77,8 @@ gst_v4lsrc_base_init (gpointer g_class) "Reads raw frames from a video4linux device", "GStreamer maintainers "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&v4l_src_template)); + gst_element_class_add_static_pad_template (gstelement_class, + &v4l_src_template); } static void diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 41d7df061f..f9ac6b779c 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -2376,8 +2376,8 @@ gst_ximagesink_base_init (gpointer g_class) "Video sink", "Sink/Video", "A standard X based videosink", "Julien Moutte "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_ximagesink_sink_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &gst_ximagesink_sink_template_factory); } static void diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 03e4d30ad8..9f5166a594 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -3536,8 +3536,8 @@ gst_xvimagesink_base_init (gpointer g_class) "Video sink", "Sink/Video", "A Xv based videosink", "Julien Moutte "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_xvimagesink_sink_template_factory)); + gst_element_class_add_static_pad_template (element_class, + &gst_xvimagesink_sink_template_factory); } static void diff --git a/tests/check/elements/audiorate.c b/tests/check/elements/audiorate.c index 55b67032fc..4d4edd9e24 100644 --- a/tests/check/elements/audiorate.c +++ b/tests/check/elements/audiorate.c @@ -62,10 +62,9 @@ test_injector_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); + gst_element_class_add_static_pad_template (element_class, &src_template); + gst_element_class_add_static_pad_template (element_class, + &sink_template); } static void diff --git a/tests/check/elements/decodebin.c b/tests/check/elements/decodebin.c index d5d327e95d..b32a776684 100644 --- a/tests/check/elements/decodebin.c +++ b/tests/check/elements/decodebin.c @@ -218,10 +218,9 @@ test_mpeg_audio_parse_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); + gst_element_class_add_static_pad_template (element_class, + &sink_template); + gst_element_class_add_static_pad_template (element_class, &src_template); gst_element_class_set_details_simple (element_class, "MPEG1 Audio Parser", "Codec/Parser/Audio", "Pretends to parse mpeg1 audio stream", diff --git a/tests/check/elements/decodebin2.c b/tests/check/elements/decodebin2.c index 784c0e554b..27ed98255f 100644 --- a/tests/check/elements/decodebin2.c +++ b/tests/check/elements/decodebin2.c @@ -223,10 +223,9 @@ test_mpeg_audio_parse_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); + gst_element_class_add_static_pad_template (element_class, + &sink_template); + gst_element_class_add_static_pad_template (element_class, &src_template); gst_element_class_set_details_simple (element_class, "MPEG1 Audio Parser", "Codec/Parser/Audio", "Pretends to parse mpeg1 audio stream", @@ -391,10 +390,8 @@ gst_fake_h264_parser_base_init (gpointer klass) "stream-format=(string) { avc, byte-stream }")); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_templ)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &sink_templ); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "FakeH264Parser", "Codec/Parser/Converter/Video", "yep", "me"); } @@ -492,10 +489,8 @@ gst_fake_h264_decoder_base_init (gpointer klass) GST_STATIC_CAPS ("video/x-raw-yuv")); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_templ)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &sink_templ); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "FakeH264Decoder", "Codec/Decoder/Video", "yep", "me"); } diff --git a/tests/check/elements/playbin.c b/tests/check/elements/playbin.c index 08aace6096..c550571d9b 100644 --- a/tests/check/elements/playbin.c +++ b/tests/check/elements/playbin.c @@ -459,8 +459,7 @@ gst_red_video_src_base_init (gpointer klass) ); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "Red Video Src", "Source/Video", "yep", "me"); } @@ -571,8 +570,7 @@ gst_codec_src_base_init (gpointer klass) ); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "Codec Src", "Source/Video", "yep", "me"); } diff --git a/tests/check/elements/playbin2-compressed.c b/tests/check/elements/playbin2-compressed.c index 5f3c544283..03ab020419 100644 --- a/tests/check/elements/playbin2-compressed.c +++ b/tests/check/elements/playbin2-compressed.c @@ -124,8 +124,7 @@ gst_caps_src_base_init (gpointer klass) GST_STATIC_CAPS_ANY); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "CapsSource", "Source/Generic", "yep", "me"); } @@ -278,8 +277,7 @@ gst_audio_codec_sink_base_init (gpointer klass) ); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_templ)); + gst_element_class_add_static_pad_template (element_class, &sink_templ); gst_element_class_set_details_simple (element_class, "AudioCodecSink", "Sink/Audio", "yep", "me"); } @@ -384,8 +382,7 @@ gst_video_codec_sink_base_init (gpointer klass) ); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_templ)); + gst_element_class_add_static_pad_template (element_class, &sink_templ); gst_element_class_set_details_simple (element_class, "VideoCodecSink", "Sink/Video", "yep", "me"); } @@ -468,10 +465,8 @@ gst_codec_demuxer_base_init (gpointer klass) ); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_templ)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &sink_templ); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "CodecDemuxer", "Codec/Demuxer", "yep", "me"); } diff --git a/tests/check/elements/playbin2.c b/tests/check/elements/playbin2.c index aef9272bbd..10493678e2 100644 --- a/tests/check/elements/playbin2.c +++ b/tests/check/elements/playbin2.c @@ -571,8 +571,7 @@ gst_red_video_src_base_init (gpointer klass) ); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "Red Video Src", "Source/Video", "yep", "me"); } @@ -683,8 +682,7 @@ gst_codec_src_base_init (gpointer klass) ); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_templ)); + gst_element_class_add_static_pad_template (element_class, &src_templ); gst_element_class_set_details_simple (element_class, "Codec Src", "Source/Video", "yep", "me"); } diff --git a/tests/check/elements/videoscale.c b/tests/check/elements/videoscale.c index 276261f3b0..f297efc413 100644 --- a/tests/check/elements/videoscale.c +++ b/tests/check/elements/videoscale.c @@ -642,8 +642,8 @@ gst_test_reverse_negotiation_sink_base_init (gpointer g_class) "Test Reverse Negotiation Sink", "Sink", "Some test sink", "Sebastian Dröge "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); + gst_element_class_add_static_pad_template (gstelement_class, + &sinktemplate); } static void From ea78b060a77678153095916f94e4ba6dea716dac Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 28 Nov 2011 13:26:53 +0000 Subject: [PATCH 4/5] Revert "libgstvideo: add a new API to handle QoS events and dropping logic" This reverts commit eb03323fb683e06ed8e7f557037f13252f150c25. *grumble* I managed to merge something I did not mean to. --- docs/libs/gst-plugins-base-libs-sections.txt | 6 - gst-libs/gst/video/video.c | 217 ------------------- gst-libs/gst/video/video.h | 38 ---- win32/common/libgstvideo.def | 5 - 4 files changed, 266 deletions(-) diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt index 3286ee2cde..fe52a0cbd1 100644 --- a/docs/libs/gst-plugins-base-libs-sections.txt +++ b/docs/libs/gst-plugins-base-libs-sections.txt @@ -2305,12 +2305,6 @@ gst_video_event_parse_still_frame gst_video_format_get_type GST_TYPE_VIDEO_FORMAT -GstVideoQoSTracker -gst_video_qos_tracker_init -gst_video_qos_tracker_reset -gst_video_qos_tracker_update -gst_video_qos_tracker_process_frame -gst_video_qos_tracker_clear
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index 1b7fed27b1..af4c122606 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -2330,220 +2330,3 @@ gst_video_parse_caps_palette (GstCaps * caps) return p; } - -/** - * gst_video_qos_tracker_init: - * @qt: The #GstVideoQoSTracker to initialize - * @element: The element the tracker belongs to, which will be sending the QoS - * messages when appropriate. - * - * Initialize a #GstVideoQoSTracker. Call gst_video_qos_tracker_clear when done. - * Includes its own locking, so it's safe to call the gst_video_qos_tracker_ API - * from multiple threads (except _init and _clear, of course). - * - * The element is not referenced, so must have a lifetime that encompasses that - * of the GstVideoQoSTracker. This is implicit in the typical case where the - * GstVideoQoSTracker is a member of the owning element. - * - * Since: 0.10.36 - */ -void -gst_video_qos_tracker_init (GstVideoQoSTracker * qt, GstElement * element) -{ - qt->lock = g_mutex_new (); - qt->element = element; - gst_video_qos_tracker_reset (qt); -} - -/** - * gst_video_qos_tracker_reset: - * @qt: The #GstVideoQoSTracker to reset - * - * Reset a #GstVideoQoSTracker. - * Use when restarting an element. - * - * Since: 0.10.36 - */ -void -gst_video_qos_tracker_reset (GstVideoQoSTracker * qt) -{ - g_return_if_fail (qt && qt->lock); - g_mutex_lock (qt->lock); - qt->proportion = 1.0; - qt->timestamp = GST_CLOCK_TIME_NONE; - qt->diff = 0; - qt->earliest_time = GST_CLOCK_TIME_NONE; - qt->processed = 0; - qt->dropped = 0; - g_mutex_unlock (qt->lock); -} - -/** - * gst_video_qos_tracker_update: - * @qt: The #GstVideoQoSTracker to update - * @event: The event to update from, must a QOS event - * @frame_duration: the duration of a frame, if known, - * may be GST_CLOCK_TIME_NONE is unknown - * @method: the algorithm to use to determine the time at - * which to start accepting frames again when we're late - * - * Update a #GstVideoQoSTracker from an incoming QOS event. - * This allows the QoS tracker to know whether the sink is - * late or not. - * An element using a GstVideoQoSTracker should pass all - * QOS events to this function. - * - * Since: 0.10.36 - */ -void -gst_video_qos_tracker_update (GstVideoQoSTracker * qt, GstEvent * event, - GstClockTime frame_duration, GstVideoQoSTrackerMethod method) -{ - gdouble proportion; - GstClockTime timestamp; - GstClockTimeDiff diff; - - g_return_if_fail (qt && qt->lock); - g_return_if_fail (event && GST_IS_EVENT (event)); - g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_QOS); - - gst_event_parse_qos (event, &proportion, &diff, ×tamp); - - g_mutex_lock (qt->lock); - - qt->proportion = proportion; - qt->diff = diff; - - if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) { - qt->timestamp = timestamp; - if (G_UNLIKELY (diff > 0)) { - switch (method) { - case GST_VIDEO_QOS_TRACKER_DIFF: - qt->earliest_time = qt->timestamp + diff; - break; - case GST_VIDEO_QOS_TRACKER_TWICE_DIFF: - qt->earliest_time = qt->timestamp + 2 * diff; - break; - default: - g_assert_not_reached (); - qt->earliest_time = qt->timestamp + diff; - break; - } - if (GST_CLOCK_TIME_IS_VALID (frame_duration)) { - qt->earliest_time += frame_duration; - } - } else { - qt->earliest_time = qt->timestamp + qt->diff; - } - } else { - qt->timestamp = GST_CLOCK_TIME_NONE; - qt->earliest_time = GST_CLOCK_TIME_NONE; - } - - GST_DEBUG_OBJECT (qt->element, - "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, - GST_TIME_ARGS (qt->timestamp), qt->diff); - - g_mutex_unlock (qt->lock); -} - -/** - * gst_video_qos_tracker_process_frame: - * @qt: The #GstVideoQoSTracker to use - * @segment: The segment to use to determine running times - * @timestamp: the timestamp of the buffer to consider. - * May be GST_CLOCK_TIME_NONE if unknown. - * @duration: the duration of the buffer to consider. - * May be GST_CLOCK_TIME_NONE if unknown. - * - * Decides if a frame should be dropped or not based on the known - * timings from previously received QOS events. - * Frames with unknown timestamps will never be dropped. - * If a frame is to be dropped, an appropriate QoS message will - * be sent on behalf of the owning element, and the element should - * not send that buffer downstream. - * - * Returns: %TRUE if the buffer should be dropped, %FALSE otherwise. - * - * Since: 0.10.36 - */ -gboolean -gst_video_qos_tracker_process_frame (GstVideoQoSTracker * qt, - const GstSegment * segment, GstClockTime timestamp, GstClockTime duration) -{ - GstClockTime running_time; - gboolean skip; - GstClockTime earliest_time; - - g_return_val_if_fail (qt && qt->lock, FALSE); - g_return_val_if_fail (segment, FALSE); - - if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (timestamp))) - return FALSE; - - g_mutex_lock (qt->lock); - - earliest_time = qt->earliest_time; - - /* qos needs to be done on running time */ - running_time = - gst_segment_to_running_time ((GstSegment *) segment, GST_FORMAT_TIME, - timestamp); - skip = GST_CLOCK_TIME_IS_VALID (earliest_time) - && running_time <= earliest_time; - - if (skip) { - GstMessage *qos_msg; - guint64 stream_time; - gint64 jitter; - guint64 dropped, processed; - gdouble proportion; - - qt->dropped++; - - proportion = qt->proportion; - processed = qt->processed; - dropped = qt->dropped; - - g_mutex_unlock (qt->lock); - - GST_DEBUG_OBJECT (qt->element, "skipping decoding: qostime %" - GST_TIME_FORMAT " <= %" GST_TIME_FORMAT, - GST_TIME_ARGS (running_time), GST_TIME_ARGS (earliest_time)); - - stream_time = - gst_segment_to_stream_time ((GstSegment *) segment, GST_FORMAT_TIME, - timestamp); - jitter = GST_CLOCK_DIFF (running_time, earliest_time); - - qos_msg = - gst_message_new_qos (GST_OBJECT_CAST (qt->element), FALSE, running_time, - stream_time, timestamp, duration); - gst_message_set_qos_values (qos_msg, jitter, proportion, 1000000); - gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS, processed, dropped); - gst_element_post_message (qt->element, qos_msg); - } else { - qt->processed++; - g_mutex_unlock (qt->lock); - } - - return skip; -} - -/** - * gst_video_qos_tracker_clear: - * @qt: The #GstVideoQoSTracker to clear - * - * Clears a previously initialized GstVideoQoSTracker. - * That GstVideoQoSTracker may be be used after this call, unless - * it is initialized again. - * - * Since: 0.10.36 - */ -void -gst_video_qos_tracker_clear (GstVideoQoSTracker * qt) -{ - g_return_if_fail (qt && qt->lock); - g_mutex_free (qt->lock); - qt->lock = NULL; -} diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h index 637cae49ae..52e0fea51a 100644 --- a/gst-libs/gst/video/video.h +++ b/gst-libs/gst/video/video.h @@ -435,34 +435,6 @@ typedef enum { */ #define GST_VIDEO_BUFFER_PROGRESSIVE GST_BUFFER_FLAG_MEDIA4 -/** - * GstVideoQoSTrackerMethod: - * @GST_VIDEO_QOS_TRACKER_2DURATION: - * - * Enum value describing the algorithm to use to determine when to drop a frame. - */ -typedef enum { - GST_VIDEO_QOS_TRACKER_DIFF, - GST_VIDEO_QOS_TRACKER_TWICE_DIFF, -} GstVideoQoSTrackerMethod; - -typedef struct _GstVideoQoSTracker GstVideoQoSTracker; -struct _GstVideoQoSTracker { - gdouble proportion; - GstClockTime timestamp; - GstClockTimeDiff diff; - GstClockTime earliest_time; - guint64 processed; - guint64 dropped; - GMutex *lock; /* protects the above */ - GstElement *element; - - /*< private >*/ - union { - gpointer _gst_reserved[GST_PADDING]; - } abidata; -}; - /* functions */ const GValue * gst_video_frame_rate (GstPad * pad); @@ -597,16 +569,6 @@ GstBuffer * gst_video_convert_frame (GstBuffer * buf, GstClockTime timeout, GError ** error); -/* QoS */ -void gst_video_qos_tracker_init (GstVideoQoSTracker * qt, GstElement *element); -void gst_video_qos_tracker_reset (GstVideoQoSTracker * qt); -void gst_video_qos_tracker_update (GstVideoQoSTracker * qt, GstEvent* event, - GstClockTime frame_duration, - GstVideoQoSTrackerMethod method); -gboolean gst_video_qos_tracker_process_frame (GstVideoQoSTracker * qt, const GstSegment *segment, - GstClockTime timestamp, GstClockTime duration); -void gst_video_qos_tracker_clear (GstVideoQoSTracker * qt); - G_END_DECLS #endif /* __GST_VIDEO_H__ */ diff --git a/win32/common/libgstvideo.def b/win32/common/libgstvideo.def index 537b3b0333..9f9fad3ec5 100644 --- a/win32/common/libgstvideo.def +++ b/win32/common/libgstvideo.def @@ -35,8 +35,3 @@ EXPORTS gst_video_parse_caps_pixel_aspect_ratio gst_video_sink_center_rect gst_video_sink_get_type - gst_video_qos_tracker_init - gst_video_qos_tracker_reset - gst_video_qos_tracker_update - gst_video_qos_tracker_process_frame - gst_video_qos_tracker_clear From c5544630250ec434e4dafaf17274e83865415120 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 28 Nov 2011 13:27:29 +0000 Subject: [PATCH 5/5] Revert "theoradec: move the QoS logic to libgstvideo" This reverts commit 149a4ce390a78e21309b210f7daba9db5d42afe6. *grumble* I managed to merge something I did not mean to. --- ext/theora/gsttheoradec.c | 76 +++++++++++++++++++++++++++++++++------ ext/theora/gsttheoradec.h | 8 +++-- 2 files changed, 71 insertions(+), 13 deletions(-) diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c index 34d89db592..75afb6f474 100644 --- a/ext/theora/gsttheoradec.c +++ b/ext/theora/gsttheoradec.c @@ -231,9 +231,15 @@ gst_theora_dec_reset (GstTheoraDec * dec) dec->discont = TRUE; dec->frame_nr = -1; dec->seqnum = gst_util_seqnum_next (); - gst_video_qos_tracker_reset (&dec->qt); + dec->dropped = 0; + dec->processed = 0; gst_segment_init (&dec->segment, GST_FORMAT_TIME); + GST_OBJECT_LOCK (dec); + dec->proportion = 1.0; + dec->earliest_time = -1; + GST_OBJECT_UNLOCK (dec); + g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL); g_list_free (dec->queued); dec->queued = NULL; @@ -570,12 +576,23 @@ theora_dec_src_event (GstPad * pad, GstEvent * event) } case GST_EVENT_QOS: { + gdouble proportion; + GstClockTimeDiff diff; + GstClockTime timestamp; + + gst_event_parse_qos (event, &proportion, &diff, ×tamp); + /* we cannot randomly skip frame decoding since we don't have * B frames. we can however use the timestamp and diff to not * push late frames. This would at least save us the time to * crop/memcpy the data. */ - gst_video_qos_tracker_update (&dec->qt, event, - GST_CLOCK_TIME_NONE, GST_VIDEO_QOS_TRACKER_DIFF); + GST_OBJECT_LOCK (dec); + dec->proportion = proportion; + dec->earliest_time = timestamp + diff; + GST_OBJECT_UNLOCK (dec); + + GST_DEBUG_OBJECT (dec, "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, + GST_TIME_ARGS (timestamp), diff); res = gst_pad_push_event (dec->sinkpad, event); break; @@ -1129,11 +1146,50 @@ theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet, if (G_UNLIKELY (th_decode_packetin (dec->decoder, packet, &gp) < 0)) goto decode_error; - /* check for QoS, don't perform the last steps of getting and - * pushing the buffers that are known to be late. */ - if (gst_video_qos_tracker_process_frame (&dec->qt, &dec->segment, outtime, - outdur)) - goto dropping_qos; + if (outtime != -1) { + gboolean need_skip; + GstClockTime running_time; + GstClockTime earliest_time; + gdouble proportion; + + /* qos needs to be done on running time */ + running_time = gst_segment_to_running_time (&dec->segment, GST_FORMAT_TIME, + outtime); + + GST_OBJECT_LOCK (dec); + proportion = dec->proportion; + earliest_time = dec->earliest_time; + /* check for QoS, don't perform the last steps of getting and + * pushing the buffers that are known to be late. */ + need_skip = earliest_time != -1 && running_time <= earliest_time; + GST_OBJECT_UNLOCK (dec); + + if (need_skip) { + GstMessage *qos_msg; + guint64 stream_time; + gint64 jitter; + + GST_DEBUG_OBJECT (dec, "skipping decoding: qostime %" + GST_TIME_FORMAT " <= %" GST_TIME_FORMAT, + GST_TIME_ARGS (running_time), GST_TIME_ARGS (earliest_time)); + + dec->dropped++; + + stream_time = + gst_segment_to_stream_time (&dec->segment, GST_FORMAT_TIME, outtime); + jitter = GST_CLOCK_DIFF (running_time, earliest_time); + + qos_msg = + gst_message_new_qos (GST_OBJECT_CAST (dec), FALSE, running_time, + stream_time, outtime, outdur); + gst_message_set_qos_values (qos_msg, jitter, proportion, 1000000); + gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS, + dec->processed, dec->dropped); + gst_element_post_message (GST_ELEMENT_CAST (dec), qos_msg); + + goto dropping_qos; + } + } /* this does postprocessing and set up the decoded frame * pointers in our yuv variable */ @@ -1156,6 +1212,8 @@ theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet, GST_BUFFER_TIMESTAMP (out) = outtime; GST_BUFFER_DURATION (out) = outdur; + dec->processed++; + if (dec->segment.rate >= 0.0) result = theora_dec_push_forward (dec, out); else @@ -1448,7 +1506,6 @@ theora_dec_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: - gst_video_qos_tracker_init (&dec->qt, element); break; case GST_STATE_CHANGE_READY_TO_PAUSED: th_info_clear (&dec->info); @@ -1479,7 +1536,6 @@ theora_dec_change_state (GstElement * element, GstStateChange transition) gst_theora_dec_reset (dec); break; case GST_STATE_CHANGE_READY_TO_NULL: - gst_video_qos_tracker_clear (&dec->qt); break; default: break; diff --git a/ext/theora/gsttheoradec.h b/ext/theora/gsttheoradec.h index 9f10b8dcd2..f6722119a6 100644 --- a/ext/theora/gsttheoradec.h +++ b/ext/theora/gsttheoradec.h @@ -25,7 +25,6 @@ #endif #include -#include #include #include @@ -98,8 +97,11 @@ struct _GstTheoraDec gboolean discont; guint32 seqnum; - /* QoS stuff */ - GstVideoQoSTracker qt; + /* QoS stuff */ /* with LOCK*/ + gdouble proportion; + GstClockTime earliest_time; + guint64 processed; + guint64 dropped; gboolean have_par; gint par_num;