diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2014-08-03 19:27:07 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-08-08 14:27:27 +0200 |
commit | d86df7dd497ead1132bd95df7c4c18d91fbe3def (patch) | |
tree | 60439638ce5173d5d2cc6e459c18ffa3f7bdca5a /libavformat | |
parent | a79e58cdc6e46c62346d13e7ddd4da2008714200 (diff) | |
download | ffmpeg-d86df7dd497ead1132bd95df7c4c18d91fbe3def.tar.gz |
mpegts: Define the section length with a constant
The specification says the value is expressed in 10 bits including
the 4-byte CRC.
(cherry picked from commit 694b7cd873f8b06af109036eff1ccd741afdd28e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Conflicts:
libavformat/mpegtsenc.c
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mpegtsenc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 90f223273e..87cf726c73 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -106,6 +106,10 @@ static const AVClass mpegts_muxer_class = { .version = LIBAVUTIL_VERSION_INT, }; +/* The section length is 12 bits. The first 2 are set to 0, the remaining + * 10 bits should not exceed 1021. */ +#define SECTION_LENGTH 1020 + /* NOTE: 4 bytes must be left at the end for the crc32 */ static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len) { @@ -217,7 +221,7 @@ static void mpegts_write_pat(AVFormatContext *s) { MpegTSWrite *ts = s->priv_data; MpegTSService *service; - uint8_t data[1012], *q; + uint8_t data[SECTION_LENGTH], *q; int i; q = data; @@ -232,8 +236,7 @@ static void mpegts_write_pat(AVFormatContext *s) static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) { - // MpegTSWrite *ts = s->priv_data; - uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr; + uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int val, stream_type, i; q = data; @@ -385,7 +388,7 @@ static void mpegts_write_sdt(AVFormatContext *s) { MpegTSWrite *ts = s->priv_data; MpegTSService *service; - uint8_t data[1012], *q, *desc_list_len_ptr, *desc_len_ptr; + uint8_t data[SECTION_LENGTH], *q, *desc_list_len_ptr, *desc_len_ptr; int i, running_status, free_ca_mode, val; q = data; |