[PATCH] In mpegts "reserved_future_use" field must be set to 1 in SDT table

Georgi Chorbadzhiyski gf
Tue Jan 25 12:45:25 CET 2011


According to EN 300 468 section 3.1 (Definitions):
   Unless otherwise specified within the present document all
   "reserved_future_use" bits is set to "1".
This was not the case for SDT generation so this patch fixes it.

---

 libavformat/mpegtsenc.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 3c56830..1bbb77f 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -128,6 +128,10 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
 {
     uint8_t section[1024], *q;
     unsigned int tot_len;
+    unsigned int flags = 0xb000;
+
+    if (tid == SDT_TID)
+        flags |= 0xe000; /* reserved_future_use must be set to 1 */
 
     tot_len = 3 + 5 + len + 4;
     /* check if not too big */
@@ -136,7 +140,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
 
     q = section;
     *q++ = tid;
-    put16(&q, 0xb000 | (len + 5 + 4)); /* 5 byte header + 4 byte CRC */
+    put16(&q, flags | (len + 5 + 4)); /* 5 byte header + 4 byte CRC */
     put16(&q, id);
     *q++ = 0xc1 | (version << 1); /* current_next_indicator = 1 */
     *q++ = sec_num;
-- 
1.7.3.5


--=_ns-23687-1296121215-0001-2--



More information about the ffmpeg-devel mailing list