mpegtsmux: Read prog-map[PMT_ORDER_<PID>] for PMT order key

Right now the prog-map's meaning of `PMT_%d` is overloaded:
- PMT_<PGM> is used to look up the PID for the PMT.
- PMT_<PID> is used to look up ordering keys for streams in the PMT.

This is not a problem in practice because program numbers and PES PIDs
shouldn't overlap. Still, it's quite the wart in the API.

Provide "PMT_ORDER_%d" as an unambiguous way of specifying ordering
keys.

See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1510#note_2790022
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8584>
This commit is contained in:
Jan Alexander Steffens (heftig) 2025-02-25 15:50:42 +01:00 committed by GStreamer Marge Bot
parent ece3a0c976
commit 24bcff5650

View File

@ -597,7 +597,6 @@ gst_base_ts_mux_create_or_update_stream (GstBaseTsMux * mux,
guint8 color_spec = 0;
const gchar *stream_format = NULL;
const char *interlace_mode = NULL;
gchar *pmt_name;
GstMpegtsDescriptor *pmt_descriptor = NULL;
GST_DEBUG_OBJECT (ts_pad,
@ -995,11 +994,23 @@ gst_base_ts_mux_create_or_update_stream (GstBaseTsMux * mux,
ts_pad->stream->pmt_descriptor = pmt_descriptor;
}
pmt_name = g_strdup_printf ("PMT_%d", ts_pad->pid);
if (mux->prog_map && gst_structure_has_field (mux->prog_map, pmt_name)) {
gst_structure_get_int (mux->prog_map, pmt_name, &ts_pad->stream->pmt_index);
if (mux->prog_map) {
gchar *pmt_name = g_strdup_printf ("PMT_ORDER_%d", ts_pad->pid);
if (!gst_structure_get_int (mux->prog_map, pmt_name,
&ts_pad->stream->pmt_index)) {
gchar *pmt_name_2 = g_strdup_printf ("PMT_%d", ts_pad->pid);
if (gst_structure_get_int (mux->prog_map, pmt_name_2,
&ts_pad->stream->pmt_index))
GST_FIXME_OBJECT (mux, "Use of ambiguous prog-map entry %s, prefer %s",
pmt_name_2, pmt_name);
g_free (pmt_name_2);
}
g_free (pmt_name);
}
g_free (pmt_name);
interlace_mode = gst_structure_get_string (s, "interlace-mode");
gst_structure_get_int (s, "rate", &ts_pad->stream->audio_sampling);