[Ffmpeg-devel] [PATCH] xan_dpcm in MPlayer + libavformat
Diego Biurrun
diego
Sat Nov 18 13:58:54 CET 2006
On Sat, Nov 18, 2006 at 03:20:24AM +0100, Michael Niedermayer wrote:
>
> On Fri, Nov 17, 2006 at 05:17:58PM -0800, Mike Melanson wrote:
> > Diego Biurrun wrote:
> > >IIUC MPlayer falls back on codec_id if codec_tag is not set. The
> > >problem is that these AVI files mark the xan_dpcm audio as 0x1 (or was
> > >it FourCC Axan + TwoCC 0x1 Roberto?), which is PCM. I don't think there
> > >is a way to support this without hacks..
> >
> > Right. The people (Origin) that developed this format never applied with
> > Microsoft for a specific codec ID; they didn't mean for these files to
> > be played in general media players. They have codec ID 0x0001 (usually
> > reserved for PCM). There is data elsewhere in the AVI file indicating
> > 'Axan'. All written up here:
>
> AVCodecContext.stream_codec_tag i assume, and i would appreciate it if
> someone would remove this dirty "if video is xan then audio is so too"
> hack and instead add Axan to riff.c and check both stream_codec_id and
> codec_id
Dunno if I understood you correctly (probably not), but here is a patch
that contains the hack a bit more based on your suggestion to check
stream_codec_tag. It's better than it was before at least.
BTW, some of the comments in that file seem misplaced. Maybe someone
can fix them.
line 446:
/* special case time: To support Xan DPCM, hardcode
* the format if Xxan is the video codec */
st->need_parsing = 1;
line 452
/* force parsing as several audio frames can be in
one packet */
if (xan_video)
st->codec->codec_id = CODEC_ID_XAN_DPCM;
Diego
-------------- next part --------------
Index: libavformat/avidec.c
===================================================================
--- libavformat/avidec.c (revision 7117)
+++ libavformat/avidec.c (working copy)
@@ -216,7 +216,6 @@
int i, n;
AVStream *st;
AVIStream *ast = NULL;
- int xan_video = 0; /* hack to support Xan A/V */
char str_track[4];
avi->stream_index= -1;
@@ -432,8 +431,6 @@
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_tag = tag1;
st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
- if (st->codec->codec_id == CODEC_ID_XAN_WC4)
- xan_video = 1;
st->need_parsing = 2; //only parse headers dont do slower repacketization, this is needed to get the pict type which is needed for generating correct pts
// url_fskip(pb, size - 5 * 4);
break;
@@ -443,16 +440,18 @@
av_log(s, AV_LOG_DEBUG, "invalid sample size or block align detected\n");
if (size%2) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
url_fskip(pb, 1);
- /* special case time: To support Xan DPCM, hardcode
- * the format if Xxan is the video codec */
st->need_parsing = 1;
/* ADTS header is in extradata, AAC without header must be stored as exact frames, parser not needed and it will fail */
if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size)
st->need_parsing = 0;
/* force parsing as several audio frames can be in
one packet */
- if (xan_video)
- st->codec->codec_id = CODEC_ID_XAN_DPCM;
+ /* AVI files with Xan DPCM audio declare PCM in the
+ * header but have Axan stream_code_tag */
+ if (st->codec->stream_codec_tag == ff_get_fourcc("Axan")){
+ st->codec->codec_id = CODEC_ID_XAN_DPCM;
+ st->codec->codec_tag = 0;
+ }
break;
default:
st->codec->codec_type = CODEC_TYPE_DATA;
More information about the ffmpeg-devel
mailing list