[FFmpeg-cvslog] mpegts: Define the section length with a constant
Luca Barbato
git at videolan.org
Sat Aug 30 20:36:31 CEST 2014
ffmpeg | branch: release/1.1 | Luca Barbato <lu_zero at gentoo.org> | Sun Aug 3 19:27:07 2014 +0200| [694b7cd873f8b06af109036eff1ccd741afdd28e] | committer: Luca Barbato
mpegts: Define the section length with a constant
The specification says the value is expressed in 10 bits including
the 4-byte CRC.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=694b7cd873f8b06af109036eff1ccd741afdd28e
---
libavformat/mpegtsenc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 29d83c6..86fc631 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -122,6 +122,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)
{
@@ -233,7 +237,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;
@@ -249,7 +253,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;
@@ -401,7 +405,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;
More information about the ffmpeg-cvslog
mailing list