diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-07-29 21:56:54 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-12-31 16:57:37 -0300 |
commit | 2852aa50842dae99fc1f2988e256fef1052e7b57 (patch) | |
tree | c0421f7f6344770bed42ccb1267dae470258d0a1 | |
parent | 9db961861aeca15feacb5a711aa5c5f2676ce6e2 (diff) | |
download | ffmpeg-2852aa50842dae99fc1f2988e256fef1052e7b57.tar.gz |
cbs_mpeg2: Decompose Sequence End
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>
(cherry picked from commit 0e66e1b61ea2fd8fd85ebe3b86ff48dad78233dd)
-rw-r--r-- | libavcodec/cbs_mpeg2.c | 3 | ||||
-rw-r--r-- | libavcodec/cbs_mpeg2.h | 4 | ||||
-rw-r--r-- | libavcodec/cbs_mpeg2_syntax_template.c | 12 |
3 files changed, 19 insertions, 0 deletions
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index 3d93fd8a19..9a8603e8c2 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -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 " diff --git a/libavcodec/cbs_mpeg2.h b/libavcodec/cbs_mpeg2.h index 2e506e42e9..5bcafd09f0 100644 --- a/libavcodec/cbs_mpeg2.h +++ b/libavcodec/cbs_mpeg2.h @@ -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. diff --git a/libavcodec/cbs_mpeg2_syntax_template.c b/libavcodec/cbs_mpeg2_syntax_template.c index e7332abe6e..5165a14cd5 100644 --- a/libavcodec/cbs_mpeg2_syntax_template.c +++ b/libavcodec/cbs_mpeg2_syntax_template.c @@ -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; +} |