On Fri, Jan 17, 2014 at 02:00:06PM +0100, Janne Grunau wrote:
> On 2014-01-16 03:55:44 +0100, Diego Biurrun wrote:
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -163,21 +160,21 @@ AVInputFormat *av_probe_input_format2(AVProbeData
> > *pd, int is_opened, int *score
> >
> > - /* a hack for files with huge id3v2 tags -- try to guess by file
> > extension. */
> > + // A hack for files with huge id3v2 tags -- try to guess by file
> > extension
>
> sneaky way to shorten the line to 80 chars
I'm kinda proud of myself ;)
> > @@ -218,8 +219,10 @@ static int set_codec_from_probe_data(AVFormatContext
> > *s, AVStream *st, AVProbeDa
> >
> > if (fmt) {
> > int i;
> > - av_log(s, AV_LOG_DEBUG, "Probe with size=%d, packets=%d detected
> > %s with score=%d\n",
> > - pd->buf_size, MAX_PROBE_PACKETS - st->probe_packets,
> > fmt->name, score);
> > + av_log(s, AV_LOG_DEBUG,
> > + "Probe with size=%d, packets=%d detected %s with
> > score=%d\n",
> > + pd->buf_size, MAX_PROBE_PACKETS - st->probe_packets,
> > + fmt->name, score);
>
> if you split the format string you could get rid of one line, also
> 'av_log(s, AV_LOG_DEBUG,\n' lloks ugly
I find this "logical grouping" of av_log parameters more readable.
> > @@ -283,11 +286,15 @@ int av_probe_input_buffer(AVIOContext *pb,
> > AVInputFormat **fmt,
> >
> > /* guess file format */
> > *fmt = av_probe_input_format2(&pd, 1, &score);
> > - if(*fmt){
> > - if(score <= AVPROBE_SCORE_MAX/4){ //this can only be true in
> > the last iteration
> > - av_log(logctx, AV_LOG_WARNING, "Format detected only with
> > low score of %d, misdetection possible!\n", score);
> > - }else
> > - av_log(logctx, AV_LOG_DEBUG, "Probed with size=%d and
> > score=%d\n", probe_size, score);
> > + if (*fmt) {
> > + /* this can only be true in the last iteration */
> > + if (score <= AVPROBE_SCORE_MAX / 4) {
> > + av_log(logctx, AV_LOG_WARNING,
> > + "Format detected only with low score of %d, "
> > + "misdetection possible!\n", score);
> > + } else
> > + av_log(logctx, AV_LOG_DEBUG,
> > + "Probed with size=%d and score=%d\n", probe_size,
> > score);
>
> see above
ditto
> > @@ -738,49 +757,58 @@ static void compute_pkt_fields(AVFormatContext *s,
> > AVStream *st,
> >
> > if (pkt->duration == 0 && st->codec->codec_type != AVMEDIA_TYPE_AUDIO)
> > {
> > ff_compute_frame_duration(&num, &den, st, pc, pkt);
> > if (den && num) {
> > - pkt->duration = av_rescale_rnd(1, num *
> > (int64_t)st->time_base.den, den * (int64_t)st->time_base.num,
> > AV_ROUND_DOWN);
> > + pkt->duration = av_rescale_rnd(1,
> > + num * (int64_t)
> > st->time_base.den,
> > + den * (int64_t)
> > st->time_base.num,
> > + AV_ROUND_DOWN);
>
> please don't this makes my eyes bleed. if the resulting is sligtly above
> 80 chars let it be
The line is 131 so surely worth splitting; alternatives
pkt->duration = av_rescale_rnd(1, num * (int64_t) st->time_base.den,
den * (int64_t) st->time_base.num,
AV_ROUND_DOWN);
pkt->duration = av_rescale_rnd(1, num * (int64_t) st->time_base.den,
den * (int64_t) st->time_base.num,
AV_ROUND_DOWN);
pkt->duration = av_rescale_rnd(1,
num * (int64_t) st->time_base.den,
den * (int64_t) st->time_base.num,
AV_ROUND_DOWN);
The first is still too long, the third nicely aligns parameters, that's
why I went for that solution.
> sigh, just 20% but I don't want to review the rest
This was also painful to produce :-/
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel