[FFmpeg-cvslog] mpegts: Define the section length with a constant

Luca Barbato git at videolan.org
Tue Aug 12 19:07:57 CEST 2014


ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Sun Aug  3 19:27:07 2014 +0200| [d86df7dd497ead1132bd95df7c4c18d91fbe3def] | 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.

(cherry picked from commit 694b7cd873f8b06af109036eff1ccd741afdd28e)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

Conflicts:
	libavformat/mpegtsenc.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d86df7dd497ead1132bd95df7c4c18d91fbe3def
---

 libavformat/mpegtsenc.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 90f2232..87cf726 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;



More information about the ffmpeg-cvslog mailing list