mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
mpegtsmux: Set the program number from prog-map
The prog-map property of mpegtsmux only allows you to group pids together in a program. The program number set in the PAT/PMT tables cannot be set explicitly. This patch will set the program number according to the prog-map. If a program id of 0 is given, the first vacant program number starting from 1 will be used. https://bugzilla.gnome.org/show_bug.cgi?id=697239
This commit is contained in:
parent
c3e4fe4edc
commit
e4a0c4d509
3 changed files with 24 additions and 5 deletions
|
@ -738,7 +738,7 @@ mpegtsmux_create_streams (MpegTsMux * mux)
|
|||
|
||||
ts_data->prog = mux->programs[ts_data->prog_id];
|
||||
if (ts_data->prog == NULL) {
|
||||
ts_data->prog = tsmux_program_new (mux->tsmux);
|
||||
ts_data->prog = tsmux_program_new (mux->tsmux, ts_data->prog_id);
|
||||
if (ts_data->prog == NULL)
|
||||
goto no_program;
|
||||
tsmux_set_pmt_interval (ts_data->prog, mux->pmt_interval);
|
||||
|
|
|
@ -247,17 +247,23 @@ tsmux_free (TsMux * mux)
|
|||
g_slice_free (TsMux, mux);
|
||||
}
|
||||
|
||||
static gint
|
||||
tsmux_program_compare (TsMuxProgram * program, gint * needle)
|
||||
{
|
||||
return (program->pgm_number - *needle);
|
||||
}
|
||||
|
||||
/**
|
||||
* tsmux_program_new:
|
||||
* @mux: a #TsMux
|
||||
*
|
||||
* Create a new program in the mising session @mux.
|
||||
*
|
||||
*
|
||||
* Returns: a new #TsMuxProgram or %NULL when the maximum number of programs has
|
||||
* been reached.
|
||||
*/
|
||||
TsMuxProgram *
|
||||
tsmux_program_new (TsMux * mux)
|
||||
tsmux_program_new (TsMux * mux, gint prog_id)
|
||||
{
|
||||
TsMuxProgram *program;
|
||||
|
||||
|
@ -273,7 +279,20 @@ tsmux_program_new (TsMux * mux)
|
|||
program->last_pmt_ts = -1;
|
||||
program->pmt_interval = TSMUX_DEFAULT_PMT_INTERVAL;
|
||||
|
||||
program->pgm_number = mux->next_pgm_no++;
|
||||
if (prog_id == 0) {
|
||||
program->pgm_number = mux->next_pgm_no++;
|
||||
while (g_list_find_custom (mux->programs, &program->pgm_number,
|
||||
(GCompareFunc) tsmux_program_compare) != NULL) {
|
||||
program->pgm_number = mux->next_pgm_no++;
|
||||
}
|
||||
} else {
|
||||
program->pgm_number = prog_id;
|
||||
while (g_list_find_custom (mux->programs, &program->pgm_number,
|
||||
(GCompareFunc) tsmux_program_compare) != NULL) {
|
||||
program->pgm_number++;
|
||||
}
|
||||
}
|
||||
|
||||
program->pmt_pid = mux->next_pmt_pid++;
|
||||
program->pcr_stream = NULL;
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ guint tsmux_get_pat_interval (TsMux *mux);
|
|||
guint16 tsmux_get_new_pid (TsMux *mux);
|
||||
|
||||
/* pid/program management */
|
||||
TsMuxProgram * tsmux_program_new (TsMux *mux);
|
||||
TsMuxProgram * tsmux_program_new (TsMux *mux, gint prog_id);
|
||||
void tsmux_program_free (TsMuxProgram *program);
|
||||
void tsmux_set_pmt_interval (TsMuxProgram *program, guint interval);
|
||||
guint tsmux_get_pmt_interval (TsMuxProgram *program);
|
||||
|
|
Loading…
Reference in a new issue