[FFmpeg-devel] [PATCH 2/3] mpegtsenc: Allow user to set PAT/PMT retransmission period
Derek Buitenhuis
derek.buitenhuis at gmail.com
Sun Apr 5 20:37:07 CEST 2015
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
libavformat/mpegtsenc.c | 10 +++++++---
libavformat/version.h | 2 +-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 861da95..e1158f8 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -97,6 +97,7 @@ typedef struct MpegTSWrite {
int pcr_period;
int sdt_period;
+ int pat_period;
#define MPEGTS_FLAG_REEMIT_PAT_PMT 0x01
#define MPEGTS_FLAG_AAC_LATM 0x02
int flags;
@@ -207,7 +208,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
/* we retransmit the SI info at this rate */
#define SDT_RETRANS_TIME 200
-#define PAT_RETRANS_TIME 100
+#define PAT_RETRANS_TIME 40
#define PCR_RETRANS_TIME 20
typedef struct MpegTSWriteStream {
@@ -756,7 +757,7 @@ static int mpegts_write_header(AVFormatContext *s)
(TS_PACKET_SIZE * 8 * 1000);
ts->sdt_packet_period = (ts->mux_rate * ts->sdt_period) /
(TS_PACKET_SIZE * 8 * 1000);
- ts->pat_packet_period = (ts->mux_rate * PAT_RETRANS_TIME) /
+ ts->pat_packet_period = (ts->mux_rate * ts->pat_period) /
(TS_PACKET_SIZE * 8 * 1000);
if (ts->copyts < 1)
@@ -764,7 +765,7 @@ static int mpegts_write_header(AVFormatContext *s)
} else {
/* Arbitrary values, PAT/PMT will also be written on video key frames */
ts->sdt_packet_period = ts->sdt_period;
- ts->pat_packet_period = 40;
+ ts->pat_packet_period = ts->pat_period;
if (pcr_st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
if (!pcr_st->codec->frame_size) {
av_log(s, AV_LOG_WARNING, "frame size not set\n");
@@ -1524,6 +1525,9 @@ static const AVOption options[] = {
{ "sdt_period", "SDT retransmission time",
offsetof(MpegTSWrite, sdt_period), AV_OPT_TYPE_INT,
{ .i64 = SDT_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+ { "pat_period", "PAT retransmission time",
+ offsetof(MpegTSWrite, pat_period), AV_OPT_TYPE_INT,
+ { .i64 = PAT_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
};
diff --git a/libavformat/version.h b/libavformat/version.h
index 55287ae..381c071 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 56
-#define LIBAVFORMAT_VERSION_MINOR 30
+#define LIBAVFORMAT_VERSION_MINOR 31
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
--
2.1.4
More information about the ffmpeg-devel
mailing list