mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
mpegpsmux: port to GstCollectPads2
This commit is contained in:
parent
a8a0b11e3f
commit
c03c4d7fac
2 changed files with 18 additions and 18 deletions
|
@ -96,7 +96,7 @@ static gboolean new_packet_cb (guint8 * data, guint len, void *user_data);
|
||||||
static void release_buffer_cb (guint8 * data, void *user_data);
|
static void release_buffer_cb (guint8 * data, void *user_data);
|
||||||
|
|
||||||
static gboolean mpegpsdemux_prepare_srcpad (MpegPsMux * mux);
|
static gboolean mpegpsdemux_prepare_srcpad (MpegPsMux * mux);
|
||||||
static GstFlowReturn mpegpsmux_collected (GstCollectPads * pads,
|
static GstFlowReturn mpegpsmux_collected (GstCollectPads2 * pads,
|
||||||
MpegPsMux * mux);
|
MpegPsMux * mux);
|
||||||
static GstPad *mpegpsmux_request_new_pad (GstElement * element,
|
static GstPad *mpegpsmux_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * templ, const gchar * name);
|
GstPadTemplate * templ, const gchar * name);
|
||||||
|
@ -151,9 +151,9 @@ mpegpsmux_init (MpegPsMux * mux, MpegPsMuxClass * g_class)
|
||||||
gst_pad_use_fixed_caps (mux->srcpad);
|
gst_pad_use_fixed_caps (mux->srcpad);
|
||||||
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 (mpegpsmux_collected), mux);
|
(GstCollectPads2Function) GST_DEBUG_FUNCPTR (mpegpsmux_collected), mux);
|
||||||
|
|
||||||
mux->psmux = psmux_new ();
|
mux->psmux = psmux_new ();
|
||||||
psmux_set_write_func (mux->psmux, new_packet_cb, mux);
|
psmux_set_write_func (mux->psmux, new_packet_cb, mux);
|
||||||
|
@ -369,7 +369,7 @@ mpegpsmux_create_streams (MpegPsMux * mux)
|
||||||
|
|
||||||
/* Create the streams */
|
/* Create the streams */
|
||||||
while (walk) {
|
while (walk) {
|
||||||
GstCollectData *c_data = (GstCollectData *) walk->data;
|
GstCollectData2 *c_data = (GstCollectData2 *) walk->data;
|
||||||
MpegPsPadData *ps_data = (MpegPsPadData *) walk->data;
|
MpegPsPadData *ps_data = (MpegPsPadData *) walk->data;
|
||||||
|
|
||||||
walk = g_slist_next (walk);
|
walk = g_slist_next (walk);
|
||||||
|
@ -394,11 +394,11 @@ mpegpsmux_choose_best_stream (MpegPsMux * mux)
|
||||||
/* Choose from which stream to mux with */
|
/* Choose from which stream to mux with */
|
||||||
|
|
||||||
MpegPsPadData *best = NULL;
|
MpegPsPadData *best = NULL;
|
||||||
GstCollectData *c_best = NULL;
|
GstCollectData2 *c_best = NULL;
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
|
||||||
for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk)) {
|
for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk)) {
|
||||||
GstCollectData *c_data = (GstCollectData *) walk->data;
|
GstCollectData2 *c_data = (GstCollectData2 *) walk->data;
|
||||||
MpegPsPadData *ps_data = (MpegPsPadData *) walk->data;
|
MpegPsPadData *ps_data = (MpegPsPadData *) walk->data;
|
||||||
|
|
||||||
if (ps_data->eos == FALSE) {
|
if (ps_data->eos == FALSE) {
|
||||||
|
@ -406,7 +406,7 @@ mpegpsmux_choose_best_stream (MpegPsMux * mux)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
ps_data->queued_buf = buf =
|
ps_data->queued_buf = buf =
|
||||||
gst_collect_pads_peek (mux->collect, c_data);
|
gst_collect_pads2_peek (mux->collect, c_data);
|
||||||
|
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
if (ps_data->prepare_func) {
|
if (ps_data->prepare_func) {
|
||||||
|
@ -467,7 +467,7 @@ mpegpsmux_choose_best_stream (MpegPsMux * mux)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c_best) {
|
if (c_best) {
|
||||||
gst_buffer_unref (gst_collect_pads_pop (mux->collect, c_best));
|
gst_buffer_unref (gst_collect_pads2_pop (mux->collect, c_best));
|
||||||
}
|
}
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
|
@ -488,7 +488,7 @@ mpegpsmux_push_gop_list (MpegPsMux * mux)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
mpegpsmux_collected (GstCollectPads * pads, MpegPsMux * mux)
|
mpegpsmux_collected (GstCollectPads2 * pads, MpegPsMux * mux)
|
||||||
{
|
{
|
||||||
/* main muxing function */
|
/* main muxing function */
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ mpegpsmux_request_new_pad (GstElement * element,
|
||||||
|
|
||||||
pad = gst_pad_new_from_template (templ, name);
|
pad = gst_pad_new_from_template (templ, name);
|
||||||
|
|
||||||
pad_data = (MpegPsPadData *) gst_collect_pads_add_pad (mux->collect, pad,
|
pad_data = (MpegPsPadData *) gst_collect_pads2_add_pad (mux->collect, pad,
|
||||||
sizeof (MpegPsPadData));
|
sizeof (MpegPsPadData));
|
||||||
if (pad_data == NULL)
|
if (pad_data == NULL)
|
||||||
goto pad_failure;
|
goto pad_failure;
|
||||||
|
@ -612,7 +612,7 @@ mpegpsmux_request_new_pad (GstElement * element,
|
||||||
could_not_add:
|
could_not_add:
|
||||||
GST_ELEMENT_ERROR (element, STREAM, FAILED,
|
GST_ELEMENT_ERROR (element, STREAM, FAILED,
|
||||||
("Internal data stream error."), ("Could not add pad to element"));
|
("Internal data stream error."), ("Could not add pad to element"));
|
||||||
gst_collect_pads_remove_pad (mux->collect, pad);
|
gst_collect_pads2_remove_pad (mux->collect, pad);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
return NULL;
|
return NULL;
|
||||||
pad_failure:
|
pad_failure:
|
||||||
|
@ -647,7 +647,7 @@ mpegpsmux_release_pad (GstElement * element, GstPad * pad)
|
||||||
mux->video_stream_id = 0;
|
mux->video_stream_id = 0;
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
||||||
gst_collect_pads_remove_pad (mux->collect, pad);
|
gst_collect_pads2_remove_pad (mux->collect, pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -761,12 +761,12 @@ mpegpsmux_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;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#define __MPEGPSMUX_H__
|
#define __MPEGPSMUX_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstcollectpads.h>
|
#include <gst/base/gstcollectpads2.h>
|
||||||
#include <gst/base/gstadapter.h>
|
#include <gst/base/gstadapter.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -70,7 +70,7 @@ struct MpegPsMux {
|
||||||
|
|
||||||
guint video_stream_id; /* stream id of primary video stream */
|
guint video_stream_id; /* stream id of primary video stream */
|
||||||
|
|
||||||
GstCollectPads *collect; /* pads collector */
|
GstCollectPads2 *collect; /* pads collector */
|
||||||
|
|
||||||
PsMux *psmux;
|
PsMux *psmux;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ struct MpegPsMuxClass {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MpegPsPadData {
|
struct MpegPsPadData {
|
||||||
GstCollectData collect; /* Parent */
|
GstCollectData2 collect; /* Parent */
|
||||||
|
|
||||||
guint8 stream_id;
|
guint8 stream_id;
|
||||||
guint8 stream_id_ext;
|
guint8 stream_id_ext;
|
||||||
|
|
Loading…
Reference in a new issue