[FFmpeg-devel] [PATCH] MTH demuxer (Gamecube format)

Michael Niedermayer michaelni
Wed Feb 4 02:42:40 CET 2009


On Tue, Feb 03, 2009 at 06:09:34PM -0500, Michael Montanye wrote:
> Michael Niedermayer wrote:
>
> [...]
>
>>> +    framerate            = av_d2q(fps, INT_MAX);
>>>     
>> [...]
>>   
>>> +    st->codec->sample_rate  = av_q2d(framerate);
>>>     
>>
>> this code looks rather suboptimal
>>
>>   
> It is.  Fixed.
>>   
>>> +
>>> +    return 0;
>>> +}
>>> +
>>> +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);
>>>     
>>
>> unneeded
>>   

> 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


[...]
> +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)


> +    if (ret != size) {
> +		if (ret >= 0) {
> +        	av_free_packet(pkt);
> +		}

tabs


> +        return AVERROR(EIO);
> +    }
> +    return 0;
> +}
> +
> +AVInputFormat mth_demuxer = {
> +    "mth",
> +    NULL_IF_CONFIG_SMALL("MTH"),
> +    sizeof(MthDemuxContext),
> +    mth_probe,
> +    mth_read_header,
> +    mth_read_packet
> +};

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- 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/2f0972b5/attachment.pgp>



More information about the ffmpeg-devel mailing list