]> git.sesse.net Git - ffmpeg/commitdiff
cbs_mpeg2: Decompose Sequence End
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 29 Jul 2019 19:56:54 +0000 (21:56 +0200)
committerMark Thompson <sw@jkqxz.net>
Mon, 29 Jul 2019 21:25:10 +0000 (22:25 +0100)
Sequence End units (or actually, sequence_end_codes) have up until now
not been decomposed; in fact due to a bug in cbs_mpeg2_split_fragment they
have mostly been treated as part of the preceding unit. So implement
decomposing them as preparation for fixing said bug.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/cbs_mpeg2.c
libavcodec/cbs_mpeg2.h
libavcodec/cbs_mpeg2_syntax_template.c

index 3e6797bd42502816be25666a4d11b3c3d1586510..9a584246c9a6f5b92fc424dd8d2476ca5c730b0d 100644 (file)
@@ -269,6 +269,8 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx,
                   extension_data,           NULL);
             START(MPEG2_START_GROUP,     MPEG2RawGroupOfPicturesHeader,
                   group_of_pictures_header, NULL);
+            START(MPEG2_START_SEQUENCE_END, MPEG2RawSequenceEnd,
+                  sequence_end,             NULL);
 #undef START
         default:
             return AVERROR(ENOSYS);
@@ -295,6 +297,7 @@ static int cbs_mpeg2_write_header(CodedBitstreamContext *ctx,
         START(MPEG2_START_EXTENSION,       MPEG2RawExtensionData,  extension_data);
         START(MPEG2_START_GROUP,           MPEG2RawGroupOfPicturesHeader,
                                                          group_of_pictures_header);
+        START(MPEG2_START_SEQUENCE_END,    MPEG2RawSequenceEnd,    sequence_end);
 #undef START
     default:
         av_log(ctx->log_ctx, AV_LOG_ERROR, "Write unimplemented for start "
index 2befaab2757dbf1707cee9efce1c322e80d8abfd..118e63d804fb51118958ab621a30a358f9398cb3 100644 (file)
@@ -212,6 +212,10 @@ typedef struct MPEG2RawSlice {
     AVBufferRef *data_ref;
 } MPEG2RawSlice;
 
+typedef struct MPEG2RawSequenceEnd {
+    uint8_t sequence_end_code;
+} MPEG2RawSequenceEnd;
+
 
 typedef struct CodedBitstreamMPEG2Context {
     // Elements stored in headers which are required for other decoding.
index e7332abe6ea51bc3d47d8d2d7250ee8c0f7edbdf..5165a14cd5078b019e43cc4fb8da72a2df082c58 100644 (file)
@@ -411,3 +411,15 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
 
     return 0;
 }
+
+static int FUNC(sequence_end)(CodedBitstreamContext *ctx, RWContext *rw,
+                              MPEG2RawSequenceEnd *current)
+{
+    int err;
+
+    HEADER("Sequence End");
+
+    ui(8, sequence_end_code);
+
+    return 0;
+}