oggmux: port to gstcollectpads2

This commit is contained in:
Thiago Santos 2009-08-10 01:48:29 +00:00 committed by Sebastian Dröge
parent 1a7acdc99e
commit 136f5b2690
2 changed files with 22 additions and 22 deletions

View file

@ -117,7 +117,7 @@ static void gst_ogg_mux_init (GstOggMux * ogg_mux);
static void gst_ogg_mux_finalize (GObject * object); static void gst_ogg_mux_finalize (GObject * object);
static GstFlowReturn static GstFlowReturn
gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux); gst_ogg_mux_collected (GstCollectPads2 * pads, GstOggMux * ogg_mux);
static gboolean gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event); static gboolean gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event);
static GstPad *gst_ogg_mux_request_new_pad (GstElement * element, static GstPad *gst_ogg_mux_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name); GstPadTemplate * templ, const gchar * name);
@ -266,9 +266,9 @@ gst_ogg_mux_init (GstOggMux * ogg_mux)
/* seed random number generator for creation of serial numbers */ /* seed random number generator for creation of serial numbers */
srand (time (NULL)); srand (time (NULL));
ogg_mux->collect = gst_collect_pads_new (); ogg_mux->collect = gst_collect_pads2_new ();
gst_collect_pads_set_function (ogg_mux->collect, gst_collect_pads2_set_function (ogg_mux->collect,
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_ogg_mux_collected), (GstCollectPads2Function) GST_DEBUG_FUNCPTR (gst_ogg_mux_collected),
ogg_mux); ogg_mux);
ogg_mux->max_delay = DEFAULT_MAX_DELAY; ogg_mux->max_delay = DEFAULT_MAX_DELAY;
@ -294,7 +294,7 @@ gst_ogg_mux_finalize (GObject * object)
} }
static void static void
gst_ogg_mux_ogg_pad_destroy_notify (GstCollectData * data) gst_ogg_mux_ogg_pad_destroy_notify (GstCollectData2 * data)
{ {
GstOggPadData *oggpad = (GstOggPadData *) data; GstOggPadData *oggpad = (GstOggPadData *) data;
GstBuffer *buf; GstBuffer *buf;
@ -465,8 +465,8 @@ gst_ogg_mux_request_new_pad (GstElement * element,
GstOggPadData *oggpad; GstOggPadData *oggpad;
oggpad = (GstOggPadData *) oggpad = (GstOggPadData *)
gst_collect_pads_add_pad_full (ogg_mux->collect, newpad, gst_collect_pads2_add_pad_full (ogg_mux->collect, newpad,
sizeof (GstOggPadData), gst_ogg_mux_ogg_pad_destroy_notify); sizeof (GstOggPadData), gst_ogg_mux_ogg_pad_destroy_notify, TRUE);
ogg_mux->active_pads++; ogg_mux->active_pads++;
oggpad->map.serialno = serial; oggpad->map.serialno = serial;
@ -522,7 +522,7 @@ gst_ogg_mux_release_pad (GstElement * element, GstPad * pad)
ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad)); ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
gst_collect_pads_remove_pad (ogg_mux->collect, pad); gst_collect_pads2_remove_pad (ogg_mux->collect, pad);
gst_element_remove_pad (element, pad); gst_element_remove_pad (element, pad);
gst_object_unref (ogg_mux); gst_object_unref (ogg_mux);
@ -935,9 +935,9 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
walk = ogg_mux->collect->data; walk = ogg_mux->collect->data;
while (walk) { while (walk) {
GstOggPadData *pad; GstOggPadData *pad;
GstCollectData *data; GstCollectData2 *data;
data = (GstCollectData *) walk->data; data = (GstCollectData2 *) walk->data;
pad = (GstOggPadData *) data; pad = (GstOggPadData *) data;
walk = g_slist_next (walk); walk = g_slist_next (walk);
@ -948,7 +948,7 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
if (pad->buffer == NULL) { if (pad->buffer == NULL) {
GstBuffer *buf; GstBuffer *buf;
buf = gst_collect_pads_pop (ogg_mux->collect, data); buf = gst_collect_pads2_pop (ogg_mux->collect, data);
GST_LOG_OBJECT (data->pad, "popped buffer %" GST_PTR_FORMAT, buf); GST_LOG_OBJECT (data->pad, "popped buffer %" GST_PTR_FORMAT, buf);
/* On EOS we get a NULL buffer */ /* On EOS we get a NULL buffer */
@ -1557,7 +1557,7 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
ogg_mux->pulling ? ogg_mux->pulling->collect.pad : NULL); ogg_mux->pulling ? ogg_mux->pulling->collect.pad : NULL);
if (ogg_mux->pulling) { if (ogg_mux->pulling) {
next_buf = gst_collect_pads_peek (ogg_mux->collect, next_buf = gst_collect_pads2_peek (ogg_mux->collect,
&ogg_mux->pulling->collect); &ogg_mux->pulling->collect);
if (next_buf) { if (next_buf) {
ogg_mux->pulling->eos = FALSE; ogg_mux->pulling->eos = FALSE;
@ -1571,7 +1571,7 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
/* We could end up pushing from the best pad instead, so check that /* We could end up pushing from the best pad instead, so check that
* as well */ * as well */
if (best && best != ogg_mux->pulling) { if (best && best != ogg_mux->pulling) {
next_buf = gst_collect_pads_peek (ogg_mux->collect, &best->collect); next_buf = gst_collect_pads2_peek (ogg_mux->collect, &best->collect);
if (next_buf) { if (next_buf) {
best->eos = FALSE; best->eos = FALSE;
gst_buffer_unref (next_buf); gst_buffer_unref (next_buf);
@ -1863,7 +1863,7 @@ gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
* Returns TRUE if all pads are EOS. * Returns TRUE if all pads are EOS.
*/ */
static gboolean static gboolean
all_pads_eos (GstCollectPads * pads) all_pads_eos (GstCollectPads2 * pads)
{ {
GSList *walk; GSList *walk;
@ -1894,7 +1894,7 @@ all_pads_eos (GstCollectPads * pads)
* are all empty, and then sends EOS. * are all empty, and then sends EOS.
*/ */
static GstFlowReturn static GstFlowReturn
gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux) gst_ogg_mux_collected (GstCollectPads2 * pads, GstOggMux * ogg_mux)
{ {
GstOggPadData *best; GstOggPadData *best;
GstFlowReturn ret; GstFlowReturn ret;
@ -1979,7 +1979,7 @@ gst_ogg_mux_set_property (GObject * object,
/* reset all variables in the ogg pads. */ /* reset all variables in the ogg pads. */
static void static void
gst_ogg_mux_init_collectpads (GstCollectPads * collect) gst_ogg_mux_init_collectpads (GstCollectPads2 * collect)
{ {
GSList *walk; GSList *walk;
@ -2007,7 +2007,7 @@ gst_ogg_mux_init_collectpads (GstCollectPads * collect)
/* Clear all buffers from the collectpads object */ /* Clear all buffers from the collectpads object */
static void static void
gst_ogg_mux_clear_collectpads (GstCollectPads * collect) gst_ogg_mux_clear_collectpads (GstCollectPads2 * collect)
{ {
GSList *walk; GSList *walk;
@ -2051,12 +2051,12 @@ gst_ogg_mux_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_ogg_mux_clear (ogg_mux); gst_ogg_mux_clear (ogg_mux);
gst_ogg_mux_init_collectpads (ogg_mux->collect); gst_ogg_mux_init_collectpads (ogg_mux->collect);
gst_collect_pads_start (ogg_mux->collect); gst_collect_pads2_start (ogg_mux->collect);
break; break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_collect_pads_stop (ogg_mux->collect); gst_collect_pads2_stop (ogg_mux->collect);
break; break;
default: default:
break; break;

View file

@ -24,7 +24,7 @@
#include <ogg/ogg.h> #include <ogg/ogg.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstcollectpads.h> #include <gst/base/gstcollectpads2.h>
#include "gstoggstream.h" #include "gstoggstream.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -48,7 +48,7 @@ GstOggPadState;
/* all information needed for one ogg stream */ /* all information needed for one ogg stream */
typedef struct typedef struct
{ {
GstCollectData collect; /* we extend the CollectData */ GstCollectData2 collect; /* we extend the CollectData */
GstOggStream map; GstOggStream map;
gboolean have_type; gboolean have_type;
@ -101,7 +101,7 @@ struct _GstOggMux
GstPad *srcpad; GstPad *srcpad;
/* sinkpads */ /* sinkpads */
GstCollectPads *collect; GstCollectPads2 *collect;
/* number of pads which have not received EOS */ /* number of pads which have not received EOS */
gint active_pads; gint active_pads;