summaryrefslogtreecommitdiff
path: root/libavformat/mpegtsenc.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-08-03 19:27:07 +0200
committerLuca Barbato <lu_zero@gentoo.org>2014-08-04 22:22:54 +0200
commit89616408e38ac7257e36976723df0e23d6ee1157 (patch)
treeeb45e6d65a69e4b093dcdf3f4d11a2d32c135fb6 /libavformat/mpegtsenc.c
parent701e8b42e12ad625c64ceae2252acb1de390278c (diff)
mpegts: Define the section length with a constant
The specification says the value is expressed in 10 bits including the 4-byte CRC.
Diffstat (limited to 'libavformat/mpegtsenc.c')
-rw-r--r--libavformat/mpegtsenc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 838702e8fa..28ad6ea296 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -89,6 +89,10 @@ typedef struct MpegTSWrite {
#define DEFAULT_PES_HEADER_FREQ 16
#define DEFAULT_PES_PAYLOAD_SIZE ((DEFAULT_PES_HEADER_FREQ - 1) * 184 + 170)
+/* 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)
{
@@ -201,7 +205,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;
@@ -217,7 +221,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;
@@ -372,7 +376,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;