mpegtsmux: add support for adding/removing streams at runtime
Submitted by Andreas Schuler
Link to original bug (#744090)
Description
When mpegtsmux is in PLAYING oder PAUSED state, I can add sink-pads, but when I activate it and put data in, I get the Error:
Stream on pad sink_xxx is not associated with any program.
With this patch, a new pad is added to the default, when it is not associated with any program. So it's possible to simply add streams during state PLAYING and PAUSED.
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c
index 975c926..6df698d 100644
--- a/gst/mpegtsmux/mpegtsmux.c
+++ b/gst/mpegtsmux/mpegtsmux.c
@@ -1117,6 +1117,25 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data,
return GST_FLOW_OK;
}
- if((best->prog) == NULL) {
- GST_WARNING_OBJECT (mux, "Stream on pad %"
-
GST_PTR_FORMAT " was not associated with any program, adding to default program",
-
COLLECT_DATA_PAD (best));
- best->prog_id = DEFAULT_PROG_ID;
- best->prog = mux->programs[best->prog_id];
- if(best->stream == NULL) {
-
ret = mpegtsmux_create_stream (mux, best);
-
if (ret != GST_FLOW_OK) {
-
GST_ELEMENT_ERROR (mux, STREAM, MUX, ("Stream on pad %"
-
GST_PTR_FORMAT " is not associated with any program",
-
COLLECT_DATA_PAD (best)),(NULL));
-
return GST_FLOW_ERROR;
-
}
- }
- }
- prog = best->prog;
if (prog == NULL)
goto no_program;