[FFmpeg-devel] [PATCH] '-longest' command-line argument realization

Michael Niedermayer michaelni
Fri Feb 6 19:03:20 CET 2009


On Tue, Feb 03, 2009 at 03:01:58PM +0300, Michael N. Pritula wrote:
> Hello.
> I suggest patch to realize '-longest' key with following semantics:
> All video and audio streams with needed encoding in output file will be 
> same time length and this length will be equal to longest stream in output 
> file. For every shorter audio stream it will be continued with silence, and 
> for every shorter video stream it will be continued with last picture, 
> encoded to this stream.
> Waiting for your comments.

for what is it good to lengthen streams to a common point?


[...]

> +            if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
> +                opts = ost->sync_opts * av_q2d(ost->st->codec->time_base);
> +            else

a {} between if/else would simplify future patches without adding any lines


[...]
> +                if (granularity < 0)
> +                    granularity = 0;

FFMAX()


[...]
> +                                while (count_to_write > 0) {
> +                                    int data_size = FFMIN(AVCODEC_MAX_AUDIO_FRAME_SIZE, count_to_write);
> +                                    if (samples_size < data_size) {
> +                                        if (samples)
> +                                            av_free(samples);
> +                                        samples_size = data_size;

> +                                        samples = av_malloc(samples_size);
> +                                        memset(samples, 0, samples_size);

av_mallocz()


> +                                    }
> +                                    do_audio_out(os, ost, ist, samples, data_size);
> +                                    count_to_write -= data_size;
> +                                }
> +                                opts = ost->st->pts.val * av_q2d(ost->st->time_base);
> +                            }

> +                            if (samples)
> +                                av_free(samples);

av_free(NULL) is safe

[...]

missing changelog entry

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- 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/20090206/05228cac/attachment.pgp>



More information about the ffmpeg-devel mailing list