[FFmpeg-cvslog] r10953 - trunk/libavformat/mpeg.c
Måns Rullgård
mans
Thu Nov 8 09:07:49 CET 2007
aurel <subversion at mplayerhq.hu> writes:
> Author: aurel
> Date: Thu Nov 8 00:56:00 2007
> New Revision: 10953
>
> Log:
> correctly set audio codec when demuxing sofdec files
> samples: http://samples.mplayerhq.hu/game-formats/sfd/
>
> Modified:
> trunk/libavformat/mpeg.c
>
> Modified: trunk/libavformat/mpeg.c
> ==============================================================================
> --- trunk/libavformat/mpeg.c (original)
> +++ trunk/libavformat/mpeg.c Thu Nov 8 00:56:00 2007
> @@ -107,15 +107,25 @@ static int mpegps_probe(AVProbeData *p)
> typedef struct MpegDemuxContext {
> int32_t header_state;
> unsigned char psm_es_type[256];
> + int sofdec;
> } MpegDemuxContext;
>
> static int mpegps_read_header(AVFormatContext *s,
> AVFormatParameters *ap)
> {
> MpegDemuxContext *m = s->priv_data;
> + uint8_t buffer[8192];
> + char *p;
> +
> m->header_state = 0xff;
> s->ctx_flags |= AVFMTCTX_NOHEADER;
>
> + get_buffer(&s->pb, buffer, sizeof(buffer));
> + if ((p=memchr(buffer, 'S', sizeof(buffer))))
> + if (!memcmp(p, "Sofdec", 6))
This might read past the buffer.
> + m->sofdec = 1;
> + url_fseek(&s->pb, -sizeof(buffer), SEEK_CUR);
Is there really no better way to detect these files? Scanning 8k for
a magic string seems excessive. Besides, people are saying it breaks
things.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-cvslog
mailing list