diff options
author | Marton Balint <cus@passwd.hu> | 2019-08-02 23:28:22 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2019-08-14 22:50:11 +0200 |
commit | 9de40bf624a460c46984c1d6e460c9777b680b81 (patch) | |
tree | a28803833e0220195757475a5660440bae48c3d9 /libavformat/mpegtsenc.c | |
parent | 47ea654bd8d112f5770b541a5a270fb8d9e71385 (diff) | |
download | ffmpeg-9de40bf624a460c46984c1d6e460c9777b680b81.tar.gz |
avformat/mpegtsenc: remove section_write_packet forward declaration
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/mpegtsenc.c')
-rw-r--r-- | libavformat/mpegtsenc.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 13fdb6ff97..68af45d8b5 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -717,7 +717,30 @@ invalid: return 0; } -static void section_write_packet(MpegTSSection *s, const uint8_t *packet); +static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) +{ + return av_rescale(avio_tell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + + ts->first_pcr; +} + +static void mpegts_prefix_m2ts_header(AVFormatContext *s) +{ + MpegTSWrite *ts = s->priv_data; + if (ts->m2ts_mode) { + int64_t pcr = get_pcr(s->priv_data, s->pb); + uint32_t tp_extra_header = pcr % 0x3fffffff; + tp_extra_header = AV_RB32(&tp_extra_header); + avio_write(s->pb, (unsigned char *) &tp_extra_header, + sizeof(tp_extra_header)); + } +} + +static void section_write_packet(MpegTSSection *s, const uint8_t *packet) +{ + AVFormatContext *ctx = s->opaque; + mpegts_prefix_m2ts_header(ctx); + avio_write(ctx->pb, packet, TS_PACKET_SIZE); +} static MpegTSService *mpegts_add_service(AVFormatContext *s, int sid, const AVDictionary *metadata, @@ -762,31 +785,6 @@ fail: return NULL; } -static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) -{ - return av_rescale(avio_tell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + - ts->first_pcr; -} - -static void mpegts_prefix_m2ts_header(AVFormatContext *s) -{ - MpegTSWrite *ts = s->priv_data; - if (ts->m2ts_mode) { - int64_t pcr = get_pcr(s->priv_data, s->pb); - uint32_t tp_extra_header = pcr % 0x3fffffff; - tp_extra_header = AV_RB32(&tp_extra_header); - avio_write(s->pb, (unsigned char *) &tp_extra_header, - sizeof(tp_extra_header)); - } -} - -static void section_write_packet(MpegTSSection *s, const uint8_t *packet) -{ - AVFormatContext *ctx = s->opaque; - mpegts_prefix_m2ts_header(ctx); - avio_write(ctx->pb, packet, TS_PACKET_SIZE); -} - static void enable_pcr_generation_for_stream(AVFormatContext *s, AVStream *pcr_st) { MpegTSWrite *ts = s->priv_data; |