[FFmpeg-devel] [PATCH] Video decoder and demuxer for AMV files

Diego Biurrun diego
Thu Sep 27 10:58:14 CEST 2007


On Mon, Sep 24, 2007 at 08:14:36PM +0700, Vladimir Voroshilov wrote:
> 
> amv_codec_ffmpeg.patch: Decoder for modified MJPEG, used it AMV files.
> 
> All video frames in this file are JPEG's without header, with applied
> coded entropy data (i.e. added 0x00 bytes after each 0xff), enclosed
> in SOI and EOI markers.
> sp5x decoder code was reused.
> 
> amv_demux_ffmpeg.patch: AMV file demuxer.
> 
> AMV files contains ugly headers: strh sections are filled by zero,
> strf sections contains movie duration, image size and frame duration
> for video and waveformatex structure for audio respectively.
> Index is absent.
> Patch uses simplified version of avi_read_header routine for
> extracting needed info.
> 
> I tested patches with several samples from mplayes samples collection
> (SP5x files was tested too to avoid regression in decoder) and are
> works enough good for me.
> 
> P.S. I also use new fourcc (AMVV) to allow further interaction with mplayer.
> 
> Opinions? Suggestions?
> 
> --- ../mplayer/libavcodec/sp5xdec.c	(revision 10560)
> +++ ../mplayer/libavcodec/sp5xdec.c	(working copy)
> @@ -194,3 +200,16 @@
> +
> +AVCodec amvvideo_decoder = {
> +    "amvv",
> +    CODEC_TYPE_VIDEO,
> +    CODEC_ID_AMVVIDEO,
> +    sizeof(MJpegDecodeContext),
> +    ff_mjpeg_decode_init,
> +    NULL,
> +    ff_mjpeg_decode_end,
> +    sp5x_decode_frame,
> +    CODEC_CAP_DR1,
> +    NULL
> +};

This file should be compiled conditional to AMV now, i.e. add a line to
the Makefile.

Why do you call it "amvv"?  Just "amv" would be better.

> --- ../mplayer/libavcodec/allcodecs.c	(revision 10560)
> +++ ../mplayer/libavcodec/allcodecs.c	(working copy)
> @@ -137,6 +137,7 @@
>      REGISTER_DECODER (SMC, smc);
>      REGISTER_ENCDEC  (SNOW, snow);
>      REGISTER_DECODER (SP5X, sp5x);
> +    REGISTER_DECODER (AMVVIDEO, amvvideo);

And now you call it AMVVIDEO.  I still prefer AMV.

Also, this needs to be in alphabetical order.

> --- ../mplayer/libavcodec/avcodec.h	(revision 10560)
> +++ ../mplayer/libavcodec/avcodec.h	(working copy)
> @@ -68,6 +68,7 @@
>      CODEC_ID_MJPEGB,
>      CODEC_ID_LJPEG,
>      CODEC_ID_SP5X,
> +    CODEC_ID_AMVVIDEO,
>      CODEC_ID_JPEGLS,
>      CODEC_ID_MPEG4,
>      CODEC_ID_RAWVIDEO,

Aurelien already commented on this one.

> Index: ../mplayer/libavformat/avidec.c
> ===================================================================
> --- ../mplayer/libavformat/avidec.c	(revision 10560)
> +++ ../mplayer/libavformat/avidec.c	(working copy)
> --- ../mplayer/libavformat/allformats.c	(revision 10560)
> +++ ../mplayer/libavformat/allformats.c	(working copy)
> @@ -64,6 +64,7 @@
>      REGISTER_MUXDEMUX (AU, au);
>      REGISTER_MUXDEMUX (AUDIO_BEOS, audio_beos);
>      REGISTER_MUXDEMUX (AVI, avi);
> +    REGISTER_DEMUXER (AMV, amv);

Keep alignment and alphabetical order.

Diego




More information about the ffmpeg-devel mailing list