Browse Source

mpegts: Provide an option to override the pcr period

Certain hardware demuxer have specific restrictions for PCR periodicity.
tags/n2.3
Luca Barbato 11 years ago
parent
commit
f121dbd9f7
2 changed files with 7 additions and 1 deletions
  1. +3
    -0
      doc/muxers.texi
  2. +4
    -1
      libavformat/mpegtsenc.c

+ 3
- 0
doc/muxers.texi View File

@@ -405,6 +405,9 @@ Set the first PID for PMT (default 0x1000, max 0x1f00).
Set the first PID for data packets (default 0x0100, max 0x0f00). Set the first PID for data packets (default 0x0100, max 0x0f00).
@item -muxrate @var{number} @item -muxrate @var{number}
Set a constant muxrate (default VBR). Set a constant muxrate (default VBR).
@item -pcr_period @var{numer}
Override the default PCR retransmission time (default 20ms), ignored
if variable muxrate is selected.
@end table @end table


The recognized metadata settings in mpegts muxer are @code{service_provider} The recognized metadata settings in mpegts muxer are @code{service_provider}


+ 4
- 1
libavformat/mpegtsenc.c View File

@@ -79,6 +79,7 @@ typedef struct MpegTSWrite {


int reemit_pat_pmt; // backward compatibility int reemit_pat_pmt; // backward compatibility


int pcr_period;
#define MPEGTS_FLAG_REEMIT_PAT_PMT 0x01 #define MPEGTS_FLAG_REEMIT_PAT_PMT 0x01
#define MPEGTS_FLAG_AAC_LATM 0x02 #define MPEGTS_FLAG_AAC_LATM 0x02
int flags; int flags;
@@ -559,7 +560,7 @@ static int mpegts_write_header(AVFormatContext *s)
} }


if (ts->mux_rate > 1) { if (ts->mux_rate > 1) {
service->pcr_packet_period = (ts->mux_rate * PCR_RETRANS_TIME) /
service->pcr_packet_period = (ts->mux_rate * ts->pcr_period) /
(TS_PACKET_SIZE * 8 * 1000); (TS_PACKET_SIZE * 8 * 1000);
ts->sdt_packet_period = (ts->mux_rate * SDT_RETRANS_TIME) / ts->sdt_packet_period = (ts->mux_rate * SDT_RETRANS_TIME) /
(TS_PACKET_SIZE * 8 * 1000); (TS_PACKET_SIZE * 8 * 1000);
@@ -1154,6 +1155,8 @@ static const AVOption options[] = {
// backward compatibility // backward compatibility
{ "resend_headers", "Reemit PAT/PMT before writing the next packet", { "resend_headers", "Reemit PAT/PMT before writing the next packet",
offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
{ "pcr_period", "PCR retransmission time",
offsetof(MpegTSWrite, pcr_period), AV_OPT_TYPE_INT, { .i64 = PCR_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }, { NULL },
}; };




Loading…
Cancel
Save