[FFmpeg-devel] [PATCH] ARMovie/RPL demuxer rev3

Michael Niedermayer michaelni
Fri Mar 28 14:42:12 CET 2008


On Thu, Mar 27, 2008 at 11:23:36PM -0700, Eli Friedman wrote:
> Per subject, ARMovie/RPL demuxer; I think this addresses all the
> review comments.

[...]

> +    // 10000 is an arbitrary number; I can't imagine anything
> +    // uses a higher fps.  Note that the limits are
> +    // selected so that the calculation of the numerator
> +    // won't overflow.
> +    if (whole > 10000) {
> +        *error = -1;
> +        return result;
> +    }
> +    if (*endptr == '.') {
> +        line = endptr + 1;
> +        frac = strtoul(line, &endptr, 10);
> +        if (frac >= 0xFFFFFFFFUL) {
> +            *error = -1;
> +            return result;
> +        }
> +    }
> +    if (!whole && !frac) {
> +        *error = -1;
> +        return result;
> +    }
> +    den = 1;
> +    for (i = 0; i < endptr - line; i++)
> +        den *= 10;
> +    num = den * whole + frac;

for(c= get_byte(); c>='0' && c<='9'; c= get_byte())
    num= 10*num + c - '0';
if(c == '.')
    c= get_byte();
for(; c>='0' && c<='9'; c= get_byte()){
    num= 10*num + c - '0';
    den*=10;
}
while(c != '\n' && !url_feof())
    c= get_byte()

similar can be used for read_int()


[...]
> +    // ARMovie
> +    error |= read_line(pb, line, sizeof(line));
> +
> +    // Movie name
> +    error |= read_line(pb, s->title, sizeof(s->title));
> +
> +    // Date/copyright
> +    error |= read_line(pb, s->copyright, sizeof(s->copyright));
> +
> +    // Author and other
> +    error |= read_line(pb, s->author, sizeof(s->author));

following is prettier IMHO:

error |= read_line(pb, line        , sizeof(line)        ); // ARMovie
error |= read_line(pb, s->title    , sizeof(s->title)    ); // Movie name
error |= read_line(pb, s->copyright, sizeof(s->copyright)); // Date/copyright
error |= read_line(pb, s->author   , sizeof(s->author)   ); // Author and other


[...]
> +    } else {
> +        url_fseek(pb, index_entry->pos, SEEK_SET);
> +        ret = av_get_packet(pb, pkt, index_entry->size);
> +        if (ret != index_entry->size) {
> +            av_free_packet(pkt);
> +            return AVERROR(EIO);
> +        }
> +

> +        if (stream->codec->codec_type == CODEC_TYPE_VIDEO) {

> +            // There should always be frames_per_chunk frames in a chunk.
> +            pkt->duration = rpl->frames_per_chunk;

There should be only 1 frame in each AVPacket



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20080328/febe321d/attachment.pgp>



More information about the ffmpeg-devel mailing list