[FFmpeg-devel] [PATCH 2/2] mpeg12dec: BW10 support
Michael Niedermayer
michaelni at gmx.at
Fri Jan 13 05:57:30 CET 2012
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/mpeg12.c | 18 +++++++++++++-----
libavformat/riff.c | 1 +
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 2677713..c4c611b 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2075,8 +2075,6 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
if (MPV_common_init(s) < 0)
return -1;
- exchange_uv(s); // common init reset pblocks, so we swap them here
- s->swap_uv = 1; // in case of xvmc we need to swap uv for each MB
s1->mpeg_enc_ctx_allocated = 1;
for (i = 0; i < 64; i++) {
@@ -2096,8 +2094,15 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
s->first_field = 0;
s->frame_pred_frame_dct = 1;
s->chroma_format = 1;
- s->codec_id = s->avctx->codec_id = CODEC_ID_MPEG2VIDEO;
- avctx->sub_id = 2; /* indicates MPEG-2 */
+ if (s->codec_tag == AV_RL32("BW10")) {
+ s->codec_id = s->avctx->codec_id = CODEC_ID_MPEG1VIDEO;
+ avctx->sub_id = 1; /* indicates MPEG-1 */
+ } else {
+ exchange_uv(s); // common init reset pblocks, so we swap them here
+ s->swap_uv = 1; // in case of xvmc we need to swap uv for each MB
+ s->codec_id = s->avctx->codec_id = CODEC_ID_MPEG2VIDEO;
+ avctx->sub_id = 2; /* indicates MPEG-2 */
+ }
s1->save_width = s->width;
s1->save_height = s->height;
s1->save_progressive_seq = s->progressive_sequence;
@@ -2268,7 +2273,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
return buf_size;
}
- if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2"))
+ s2->codec_tag = avpriv_toupper4(avctx->codec_tag);
+ if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2")
+ || s2->codec_tag == AV_RL32("BW10")
+ ))
vcr2_init_sequence(avctx);
s->slice_count = 0;
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 17a0260..2e8c836 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -135,6 +135,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ CODEC_ID_MPEG2VIDEO, MKTAG('E', 'M', '2', 'V') },
{ CODEC_ID_MPEG2VIDEO, MKTAG('M', '7', '0', '1') }, /* Matrox MPEG2 intra-only */
{ CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', 'v') },
+ { CODEC_ID_MPEG1VIDEO, MKTAG('B', 'W', '1', '0') },
{ CODEC_ID_MPEG1VIDEO, MKTAG('X', 'M', 'P', 'G') },
{ CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
{ CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') },
--
1.7.5.4
More information about the ffmpeg-devel
mailing list