summaryrefslogtreecommitdiff
path: root/gst/mpegpsmux
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2011-12-10 20:08:20 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-12-11 00:10:15 +0000
commitc4cb38f3949b395b34258cd3aebe0bd8dcd9ed34 (patch)
tree3b37c93af71ac2af43c4082977f60ff98bf27c7c /gst/mpegpsmux
parent1f45eb7950215d890fd6919a2013f16fb7c27238 (diff)
downloadgstreamer-plugins-bad-c4cb38f3949b395b34258cd3aebe0bd8dcd9ed34.tar.gz
mpegpsmux: remember primary video stream
Diffstat (limited to 'gst/mpegpsmux')
-rw-r--r--gst/mpegpsmux/mpegpsmux.c11
-rw-r--r--gst/mpegpsmux/mpegpsmux.h4
2 files changed, 14 insertions, 1 deletions
diff --git a/gst/mpegpsmux/mpegpsmux.c b/gst/mpegpsmux/mpegpsmux.c
index d0e31bb86..19e23d93d 100644
--- a/gst/mpegpsmux/mpegpsmux.c
+++ b/gst/mpegpsmux/mpegpsmux.c
@@ -217,6 +217,7 @@ mpegpsmux_create_stream (MpegPsMux * mux, MpegPsPadData * ps_data, GstPad * pad)
GstFlowReturn ret = GST_FLOW_ERROR;
GstCaps *caps = gst_pad_get_negotiated_caps (pad);
GstStructure *s;
+ gboolean is_video = FALSE;
if (caps == NULL) {
GST_DEBUG_OBJECT (pad, "Sink pad caps were not set before pushing");
@@ -229,6 +230,7 @@ mpegpsmux_create_stream (MpegPsMux * mux, MpegPsPadData * ps_data, GstPad * pad)
if (gst_structure_has_name (s, "video/x-dirac")) {
GST_DEBUG_OBJECT (pad, "Creating Dirac stream");
ps_data->stream = psmux_create_stream (mux->psmux, PSMUX_ST_VIDEO_DIRAC);
+ is_video = TRUE;
} else if (gst_structure_has_name (s, "audio/x-ac3")) {
GST_DEBUG_OBJECT (pad, "Creating AC3 stream");
ps_data->stream = psmux_create_stream (mux->psmux, PSMUX_ST_PS_AUDIO_AC3);
@@ -252,6 +254,7 @@ mpegpsmux_create_stream (MpegPsMux * mux, MpegPsPadData * ps_data, GstPad * pad)
ps_data->codec_data = NULL;
}
ps_data->stream = psmux_create_stream (mux->psmux, PSMUX_ST_VIDEO_H264);
+ is_video = TRUE;
} else if (gst_structure_has_name (s, "audio/mpeg")) {
gint mpegversion;
if (!gst_structure_get_int (s, "mpegversion", &mpegversion)) {
@@ -312,6 +315,7 @@ mpegpsmux_create_stream (MpegPsMux * mux, MpegPsPadData * ps_data, GstPad * pad)
GST_DEBUG_OBJECT (pad, "Creating MPEG Video, version 4 stream");
ps_data->stream = psmux_create_stream (mux->psmux, PSMUX_ST_VIDEO_MPEG4);
}
+ is_video = TRUE;
}
if (ps_data->stream != NULL) {
@@ -327,6 +331,11 @@ mpegpsmux_create_stream (MpegPsMux * mux, MpegPsPadData * ps_data, GstPad * pad)
psmux_stream_set_buffer_release_func (ps_data->stream, release_buffer_cb);
ret = GST_FLOW_OK;
+
+ if (is_video && mux->video_stream_id == 0) {
+ mux->video_stream_id = ps_data->stream_id;
+ GST_INFO_OBJECT (mux, "video pad stream_id 0x%02x", mux->video_stream_id);
+ }
}
beach:
@@ -590,6 +599,8 @@ mpegpsmux_release_pad (GstElement * element, GstPad * pad)
pad_data->codec_data = NULL;
}
}
+ if (pad_data->stream_id == mux->video_stream_id)
+ mux->video_stream_id = 0;
GST_OBJECT_UNLOCK (pad);
gst_collect_pads_remove_pad (mux->collect, pad);
diff --git a/gst/mpegpsmux/mpegpsmux.h b/gst/mpegpsmux/mpegpsmux.h
index 4da1bea66..125f8f674 100644
--- a/gst/mpegpsmux/mpegpsmux.h
+++ b/gst/mpegpsmux/mpegpsmux.h
@@ -68,7 +68,9 @@ struct MpegPsMux {
GstPad *srcpad;
- GstCollectPads *collect; // pads collector
+ guint video_stream_id; /* stream id of primary video stream */
+
+ GstCollectPads *collect; /* pads collector */
PsMux *psmux;