diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2003-02-25 09:56:56 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2003-02-25 09:56:56 +0000 |
commit | e2f9490eab2fba465a0b611eb4524597b7286673 (patch) | |
tree | b0f0163a41cb2af3421549fa03514e201e67c58c /libavcodec/mpeg12.c | |
parent | a28fbb3fc88f9b12be31e173e0753a0f3205270d (diff) | |
download | ffmpeg-e2f9490eab2fba465a0b611eb4524597b7286673.tar.gz |
added DTG active format information
Originally committed as revision 1605 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r-- | libavcodec/mpeg12.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index c7622e86ec..35fb5c819a 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2009,6 +2009,35 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, return 0; } +static void mpeg_decode_user_data(AVCodecContext *avctx, + const uint8_t *buf, int buf_size) +{ + const uint8_t *p; + int len, flags; + p = buf; + len = buf_size; + + /* we parse the DTG active format information */ + if (len >= 5 && + p[0] == 'D' && p[1] == 'T' && p[2] == 'G' && p[3] == '1') { + flags = p[4]; + p += 5; + len -= 5; + if (flags & 0x80) { + /* skip event id */ + if (len < 2) + return; + p += 2; + len -= 2; + } + if (flags & 0x40) { + if (len < 1) + return; + avctx->dtg_active_format = p[0] & 0x0f; + } + } +} + /* handle buffering and image synchronisation */ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size, @@ -2099,6 +2128,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx, mpeg_decode_extension(avctx, s->buffer, input_size); break; + case USER_START_CODE: + mpeg_decode_user_data(avctx, + s->buffer, input_size); + break; default: if (start_code >= SLICE_MIN_START_CODE && start_code <= SLICE_MAX_START_CODE) { |