mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 13:18:52 +00:00
matroskamux: port to GstCollectPads2
This commit is contained in:
parent
79a6e23c1f
commit
c422a4e2e6
2 changed files with 21 additions and 21 deletions
|
@ -223,7 +223,7 @@ static void gst_matroska_mux_finalize (GObject * object);
|
||||||
|
|
||||||
/* Pads collected callback */
|
/* Pads collected callback */
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_matroska_mux_collected (GstCollectPads * pads, gpointer user_data);
|
gst_matroska_mux_collected (GstCollectPads2 * pads, gpointer user_data);
|
||||||
|
|
||||||
/* pad functions */
|
/* pad functions */
|
||||||
static gboolean gst_matroska_mux_handle_src_event (GstPad * pad,
|
static gboolean gst_matroska_mux_handle_src_event (GstPad * pad,
|
||||||
|
@ -450,9 +450,9 @@ gst_matroska_mux_init (GstMatroskaMux * mux, GstMatroskaMuxClass * g_class)
|
||||||
gst_pad_set_event_function (mux->srcpad, gst_matroska_mux_handle_src_event);
|
gst_pad_set_event_function (mux->srcpad, gst_matroska_mux_handle_src_event);
|
||||||
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
|
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
|
||||||
|
|
||||||
mux->collect = gst_collect_pads_new ();
|
mux->collect = gst_collect_pads2_new ();
|
||||||
gst_collect_pads_set_function (mux->collect,
|
gst_collect_pads2_set_function (mux->collect,
|
||||||
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_matroska_mux_collected),
|
(GstCollectPads2Function) GST_DEBUG_FUNCPTR (gst_matroska_mux_collected),
|
||||||
mux);
|
mux);
|
||||||
|
|
||||||
mux->ebml_write = gst_ebml_write_new (mux->srcpad);
|
mux->ebml_write = gst_ebml_write_new (mux->srcpad);
|
||||||
|
@ -781,7 +781,7 @@ gst_matroska_mux_handle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now GstCollectPads can take care of the rest, e.g. EOS */
|
/* now GstCollectPads2 can take care of the rest, e.g. EOS */
|
||||||
if (event)
|
if (event)
|
||||||
ret = mux->collect_event (pad, event);
|
ret = mux->collect_event (pad, event);
|
||||||
|
|
||||||
|
@ -2008,17 +2008,17 @@ gst_matroska_mux_request_new_pad (GstElement * element,
|
||||||
|
|
||||||
gst_matroskamux_pad_init (newpad);
|
gst_matroskamux_pad_init (newpad);
|
||||||
collect_pad = (GstMatroskaPad *)
|
collect_pad = (GstMatroskaPad *)
|
||||||
gst_collect_pads_add_pad_full (mux->collect, GST_PAD (newpad),
|
gst_collect_pads2_add_pad_full (mux->collect, GST_PAD (newpad),
|
||||||
sizeof (GstMatroskamuxPad),
|
sizeof (GstMatroskamuxPad),
|
||||||
(GstCollectDataDestroyNotify) gst_matroska_pad_free);
|
(GstCollectData2DestroyNotify) gst_matroska_pad_free, TRUE);
|
||||||
|
|
||||||
collect_pad->track = context;
|
collect_pad->track = context;
|
||||||
gst_matroska_pad_reset (collect_pad, FALSE);
|
gst_matroska_pad_reset (collect_pad, FALSE);
|
||||||
|
|
||||||
/* FIXME: hacked way to override/extend the event function of
|
/* FIXME: hacked way to override/extend the event function of
|
||||||
* GstCollectPads; because it sets its own event function giving the
|
* GstCollectPads2; because it sets its own event function giving the
|
||||||
* element no access to events.
|
* element no access to events.
|
||||||
* TODO GstCollectPads should really give its 'users' a clean chance to
|
* TODO GstCollectPads2 should really give its 'users' a clean chance to
|
||||||
* properly handle events that are not meant for collectpads itself.
|
* properly handle events that are not meant for collectpads itself.
|
||||||
* Perhaps a callback or so, though rejected (?) in #340060.
|
* Perhaps a callback or so, though rejected (?) in #340060.
|
||||||
* This would allow (clean) transcoding of info from demuxer/streams
|
* This would allow (clean) transcoding of info from demuxer/streams
|
||||||
|
@ -2063,7 +2063,7 @@ gst_matroska_mux_release_pad (GstElement * element, GstPad * pad)
|
||||||
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
||||||
|
|
||||||
for (walk = mux->collect->data; walk; walk = g_slist_next (walk)) {
|
for (walk = mux->collect->data; walk; walk = g_slist_next (walk)) {
|
||||||
GstCollectData *cdata = (GstCollectData *) walk->data;
|
GstCollectData2 *cdata = (GstCollectData2 *) walk->data;
|
||||||
GstMatroskaPad *collect_pad = (GstMatroskaPad *) cdata;
|
GstMatroskaPad *collect_pad = (GstMatroskaPad *) cdata;
|
||||||
|
|
||||||
if (cdata->pad == pad) {
|
if (cdata->pad == pad) {
|
||||||
|
@ -2084,7 +2084,7 @@ gst_matroska_mux_release_pad (GstElement * element, GstPad * pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_collect_pads_remove_pad (mux->collect, pad);
|
gst_collect_pads2_remove_pad (mux->collect, pad);
|
||||||
if (gst_element_remove_pad (element, pad))
|
if (gst_element_remove_pad (element, pad))
|
||||||
mux->num_streams--;
|
mux->num_streams--;
|
||||||
}
|
}
|
||||||
|
@ -2564,7 +2564,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
|
||||||
/**
|
/**
|
||||||
* gst_matroska_mux_best_pad:
|
* gst_matroska_mux_best_pad:
|
||||||
* @mux: #GstMatroskaMux
|
* @mux: #GstMatroskaMux
|
||||||
* @popped: True if at least one buffer was popped from #GstCollectPads
|
* @popped: True if at least one buffer was popped from #GstCollectPads2
|
||||||
*
|
*
|
||||||
* Find a pad with the oldest data
|
* Find a pad with the oldest data
|
||||||
* (data from this pad should be written first).
|
* (data from this pad should be written first).
|
||||||
|
@ -2585,8 +2585,8 @@ gst_matroska_mux_best_pad (GstMatroskaMux * mux, gboolean * popped)
|
||||||
collect_pad = (GstMatroskaPad *) collected->data;
|
collect_pad = (GstMatroskaPad *) collected->data;
|
||||||
/* fetch a new buffer if needed */
|
/* fetch a new buffer if needed */
|
||||||
if (collect_pad->buffer == NULL) {
|
if (collect_pad->buffer == NULL) {
|
||||||
collect_pad->buffer = gst_collect_pads_pop (mux->collect,
|
collect_pad->buffer = gst_collect_pads2_pop (mux->collect,
|
||||||
(GstCollectData *) collect_pad);
|
(GstCollectData2 *) collect_pad);
|
||||||
|
|
||||||
if (collect_pad->buffer != NULL) {
|
if (collect_pad->buffer != NULL) {
|
||||||
GstClockTime time;
|
GstClockTime time;
|
||||||
|
@ -2975,7 +2975,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_matroska_mux_collected:
|
* gst_matroska_mux_collected:
|
||||||
* @pads: #GstCollectPads
|
* @pads: #GstCollectPads2
|
||||||
* @uuser_data: #GstMatroskaMux
|
* @uuser_data: #GstMatroskaMux
|
||||||
*
|
*
|
||||||
* Collectpads callback.
|
* Collectpads callback.
|
||||||
|
@ -2983,7 +2983,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
|
||||||
* Returns: #GstFlowReturn
|
* Returns: #GstFlowReturn
|
||||||
*/
|
*/
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_matroska_mux_collected (GstCollectPads * pads, gpointer user_data)
|
gst_matroska_mux_collected (GstCollectPads2 * pads, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstMatroskaMux *mux = GST_MATROSKA_MUX (user_data);
|
GstMatroskaMux *mux = GST_MATROSKA_MUX (user_data);
|
||||||
GstEbmlWrite *ebml = mux->ebml_write;
|
GstEbmlWrite *ebml = mux->ebml_write;
|
||||||
|
@ -3077,12 +3077,12 @@ gst_matroska_mux_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
gst_collect_pads_start (mux->collect);
|
gst_collect_pads2_start (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 (mux->collect);
|
gst_collect_pads2_stop (mux->collect);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define __GST_MATROSKA_MUX_H__
|
#define __GST_MATROSKA_MUX_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstcollectpads.h>
|
#include <gst/base/gstcollectpads2.h>
|
||||||
|
|
||||||
#include "ebml-write.h"
|
#include "ebml-write.h"
|
||||||
#include "matroska-ids.h"
|
#include "matroska-ids.h"
|
||||||
|
@ -56,7 +56,7 @@ typedef struct _GstMatroskaMetaSeekIndex {
|
||||||
/* all information needed for one matroska stream */
|
/* all information needed for one matroska stream */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstCollectData collect; /* we extend the CollectData */
|
GstCollectData2 collect; /* we extend the CollectData */
|
||||||
GstMatroskaTrackContext *track;
|
GstMatroskaTrackContext *track;
|
||||||
|
|
||||||
GstBuffer *buffer; /* the queued buffer for this pad */
|
GstBuffer *buffer; /* the queued buffer for this pad */
|
||||||
|
@ -76,7 +76,7 @@ typedef struct _GstMatroskaMux {
|
||||||
|
|
||||||
/* pads */
|
/* pads */
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
GstCollectPads *collect;
|
GstCollectPads2 *collect;
|
||||||
GstPadEventFunction collect_event;
|
GstPadEventFunction collect_event;
|
||||||
GstEbmlWrite *ebml_write;
|
GstEbmlWrite *ebml_write;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue