[FFmpeg-devel] [PATCH] MTH demuxer (Gamecube format)
Michael Niedermayer
michaelni
Wed Feb 4 09:36:30 CET 2009
On Tue, Feb 03, 2009 at 10:02:01PM -0500, Michael Montanye wrote:
> Michael Niedermayer wrote:
>>> Without it, decoding terminates on the first frame with an empty frame.
>>>
>> [...]
>>
>>> + mth->first_frame = get_be32(pb);
>>>
>>
>> you need to seek to this at the end of reading the header
>>
>>
> Ah. Fixed.
>>> +static int mth_read_packet(AVFormatContext *s, AVPacket *pkt)
>>> +{
>>> + MthDemuxContext *mth = s->priv_data;
>>> + ByteIOContext *pb = s->pb;
>>> + int size;
>>> + int ret;
>>> +
>>> + url_fseek(pb, mth->next_frame, SEEK_SET);
>>> +
>>> + size = mth->next_framesz;
>>> +
>>> + /* Locate the next frame and read out its size. */
>>> + mth->next_frame += mth->next_framesz;
>>> + mth->next_framesz = get_be32(pb);
>>> +
>>> + ret = av_get_packet(pb, pkt, size);
>>>
>>
>> this looks odd
>> if the value stored is the difference between frames it cant at the
>> same time be the size of the codec frame, (theres should be a 4 byte
>> difference)
> You're right; having the seek in mth_read_packet was hiding that four-byte
> overreach. Fixed.
>
>>> + if (ret != size) {
>>> + if (ret >= 0) {
>>> + av_free_packet(pkt);
>>> + }
>>>
>>
>> tabs
>>
>>
> I thought I had changed that in this editor. Fixed, new patch attached.
[...]
> +#include "libavutil/intreadwrite.h"
is this needed?
> +#include "avformat.h"
> +
> +typedef struct MthDemuxContext {
> + int first_frame;
> + int first_framesz;
unused
> + int next_frame;
can be a local var
[...]
> +static int mth_read_header(AVFormatContext *s,
> + AVFormatParameters *ap)
> +{
> + MthDemuxContext *mth = s->priv_data;
> + AVStream *st;
> + ByteIOContext *pb = s->pb;
> +
> + int width;
> + int height;
> + int fps;
> +
> + /* Read the file header. */
> + get_be32(pb); /* Skip Magic. */
> + get_be32(pb); /* Unknown value */
> + get_be32(pb); /* Unknown value */
> + get_be32(pb); /* Unknown value */
> +
> + width = get_be32(pb);
> + height = get_be32(pb);
> + fps = get_be32(pb);
> +
> + get_be32(pb); /* Framecount, not needed */
maybe AVStream.duration could be set with that
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090204/60ac3cf8/attachment.pgp>
More information about the ffmpeg-devel
mailing list