[FFmpeg-cvslog] mxfenc: explicitly truncate continuity count.

Michael Niedermayer git at videolan.org
Tue Oct 16 03:15:00 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Oct 15 15:58:44 2012 +0200| [3896cd11a107f241f06b06a336322aef2f372fdd] | committer: Michael Niedermayer

mxfenc: explicitly truncate continuity count.

The field is intended to overflow and have only its low 16bits stored.
This commit avoids the implicit truncation and clarifies that its
intended and not a bug

S326m section 7.6 ("Continuity count"):
> The continuity count word consists of 2 bytes allow-
> ing a number to be created by a modulo 65536
> counter (bits C15 to C0 in figure 7). The continuity
> count shall increment by 1 for each newly transmit-
> ted content package with the same SDTI source and
> destination addresses. The continuity count may
> be used to detect whether the content package
> sequence has been broken by an operation such as
> a routing switch.

Approved-by: Tjoppen
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/mxfenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index b7e9449..6a27d2a 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1820,7 +1820,7 @@ static void mxf_write_system_item(AVFormatContext *s)
     avio_w8(pb, 0x04); // content package rate
     avio_w8(pb, 0x00); // content package type
     avio_wb16(pb, 0x00); // channel handle
-    avio_wb16(pb, mxf->tc.start + frame); // continuity count
+    avio_wb16(pb, (mxf->tc.start + frame) & 0xFFFF); // continuity count, supposed to overflow
     if (mxf->essence_container_count > 1)
         avio_write(pb, multiple_desc_ul, 16);
     else {



More information about the ffmpeg-cvslog mailing list