[FFmpeg-devel] [PATCH] mpegts: pcr period option for variable bitrate multiplexing
Michael Niedermayer
michael at niedermayer.cc
Fri Mar 25 01:50:12 CET 2016
On Thu, Mar 24, 2016 at 03:14:56PM -0400, Predrag Filipovic wrote:
> PCR insertion with specified period is functional when muxrate
> is also specified (contant bitrate) as required by DVB and ATSC
> (and other) specifications. Feature was non-functional for
> variable bitrate (muxrate not specified). Insertion timing
> is based on video frame keys and frame period (dts) thus, in
> this patch (work in progress), pcr period precision is limited
> to +/- one video frame period
>
> Signed-off-by: Predrag Filipovic <predrag at agora-cs.com>
> ---
> libavformat/mpegtsenc.c | 80
> +++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 61 insertions(+), 19 deletions(-)
>
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 7656720..8600ba6 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -105,6 +105,7 @@ typedef struct MpegTSWrite {
> int tables_version;
> double pat_period;
> double sdt_period;
> + int64_t last_pcr_ts;
> int64_t last_pat_ts;
> int64_t last_sdt_ts;
>
> @@ -903,6 +904,9 @@ static int mpegts_init(AVFormatContext *s)
> ts_st = pcr_st->priv_data;
>
> if (ts->mux_rate > 1) {
> + if (ts->pcr_period >= INT_MAX/2) {
> + ts->pcr_period = PCR_RETRANS_TIME;
> + }
> service->pcr_packet_period = (int64_t)ts->mux_rate *
> ts->pcr_period /
> (TS_PACKET_SIZE * 8 * 1000);
> ts->sdt_packet_period = (int64_t)ts->mux_rate *
> SDT_RETRANS_TIME /
> @@ -931,10 +935,19 @@ static int mpegts_init(AVFormatContext *s)
this patch contains random linebreaks and cannot be applied as a
result
make sure your MUA doesnt wordwrap the patch
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160325/582545dc/attachment.sig>
More information about the ffmpeg-devel
mailing list