* [FFmpeg-devel] [PR] avformat/rtp_mpegts: Pass-through program table to mpegts muxer (PR #21801)
@ 2026-02-19 18:11 Rost Kurylo via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Rost Kurylo via ffmpeg-devel @ 2026-02-19 18:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Rost Kurylo
PR #21801 opened by Rost Kurylo (rost.kurylo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21801
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21801.patch
Previously only the stream list has been passed through to mpegts
muxer, and the program layout, if any has been provided, was lost.
This change copies the program table into the nested mepgts muxer
when initializing rtp_mpegts.
To test:
```
ffmpeg -re -stream_loop -1 -i <any_file_with_at_least_one_video_and_one_audio> -c:v copy -c:a copy -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -program title=Prog1:program_num=101:st=0:st=1 -program title=Prog2:program_num=102:st=2:st=3 -f rtp_mpegts 'rtp://127.0.0.1:5004'
```
Then probe with:
```
ffprobe rtp://127.0.0.1:5004 -show_programs -print_format json
```
Signed-off-by: Rost Kurylo <rost.kurylo@netint.ca>
>From 168d22b0b1e367c55381cb98c3cb0dfb4fef0b1f Mon Sep 17 00:00:00 2001
From: Rost Kurylo <rost.kurylo@netint.ca>
Date: Thu, 19 Feb 2026 10:05:10 -0800
Subject: [PATCH] avformat/rtp_mpegts: Pass-through program table to mpegts
muxer
Previously only the stream list has been passed through to mpegts
muxer, and the program layout, if any has been provided, was lost.
This change copies the program table into the nested mepgts muxer
when initializing rtp_mpegts.
Signed-off-by: Rost Kurylo <rost.kurylo@netint.ca>
---
libavformat/rtpenc_mpegts.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c
index f9ff7e99cd..e7661ce880 100644
--- a/libavformat/rtpenc_mpegts.c
+++ b/libavformat/rtpenc_mpegts.c
@@ -85,6 +85,29 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
st->id = s->streams[i]->id;
avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar);
}
+ for (i = 0; i < s->nb_programs; i++) {
+ AVProgram* program = av_new_program(mpegts_ctx, s->programs[i]->id);
+ if (!program)
+ goto fail;
+ program->id = s->programs[i]->id;
+ program->flags = s->programs[i]->flags;
+ program->discard = s->programs[i]->discard;
+ program->nb_stream_indexes = s->programs[i]->nb_stream_indexes;
+ program->stream_index = av_realloc_array(program->stream_index, program->nb_stream_indexes, sizeof(unsigned int));
+ if (!program->stream_index)
+ goto fail;
+ memcpy(program->stream_index, s->programs[i]->stream_index, program->nb_stream_indexes * sizeof(unsigned int));
+ av_dict_copy(&program->metadata, s->programs[i]->metadata, 0);
+
+ program->program_num = s->programs[i]->program_num;
+ program->pmt_pid = s->programs[i]->pmt_pid;
+ program->pcr_pid = s->programs[i]->pcr_pid;
+ program->pmt_version = s->programs[i]->pmt_version;
+ program->start_time = s->programs[i]->start_time;
+ program->end_time = s->programs[i]->end_time;
+ program->pts_wrap_reference = s->programs[i]->pts_wrap_reference;
+ program->pts_wrap_behavior = s->programs[i]->pts_wrap_behavior;
+ }
if ((ret = avio_open_dyn_buf(&mpegts_ctx->pb)) < 0)
goto fail;
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-19 18:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-19 18:11 [FFmpeg-devel] [PR] avformat/rtp_mpegts: Pass-through program table to mpegts muxer (PR #21801) Rost Kurylo via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git