[FFmpeg-devel] [PATCH] add MicroDVD muxer and demuxer
Michael Niedermayer
michaelni at gmx.at
Tue Mar 29 16:06:05 CEST 2011
On Tue, Mar 29, 2011 at 09:33:12AM +0200, Tomas Härdin wrote:
> Aurelien Jacobs skrev 2011-03-29 00:42:
[...]
>> + }
>> + return AVPROBE_SCORE_MAX;
>> +}
>> +
>> +static int microdvd_read_header(AVFormatContext *s, AVFormatParameters *ap)
>> +{
>> + AVRational pts_info = (AVRational){ 2997, 125 }; /* default: 23.976 fps */
>> + MicroDVDContext *microdvd = s->priv_data;
>> + AVStream *st = av_new_stream(s, 0);
>> + int i, frame;
>> + float fps;
>> + char c;
>> +
>> + if (!st)
>> + return -1;
>> + for (i=0; i<FF_ARRAY_ELEMS(microdvd->lines); i++) {
>> + microdvd->pos[i] = avio_tell(s->pb);
>> + ff_get_line(s->pb, microdvd->lines[i], sizeof(microdvd->lines[i]));
>> + if ((sscanf(microdvd->lines[i], "{%d}{}%5f",&frame,&fps) == 2 ||
>> + sscanf(microdvd->lines[i], "{%d}{%*d}%5f",&frame,&fps) == 2)
>> +&& frame<= 1&& fps> 3&& fps< 100)
>
> Uhm, really odd indent.. Also, why not frame > 1 or slightly strange
> frame rates?
>
>> + pts_info = av_d2q(fps, 100000);
>
> Does this always do "the right thing", considering the limited precision
> of float? Maybe I'm nitpicking, but parsing %d.%d seems more stable.
i think a float with n bit mantisse should be good enough to recover
about a n bit fraction.
with 100000 a double should do
using integers if its similarly complex might be a good idea too but
i dont think it makes a diference in reality
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110329/e23a0704/attachment.asc>
More information about the ffmpeg-devel
mailing list