On Fri, Dec 23, 2011 at 07:48:41PM +0530, Aneesh Dogra wrote:
> ---
>  avconv.c |  467 
> +++++++++++++++++++++++++++++++-------------------------------
>  1 files changed, 235 insertions(+), 232 deletions(-)
> 
> --- a/avconv.c
> +++ b/avconv.c
> @@ -498,7 +498,7 @@ sigterm_handler(int sig)
>  
>  static void term_init(void)
>  {
> -    signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).  */
> +    signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).    */
>      signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */
>  #ifdef SIGXCPU
>      signal(SIGXCPU, sigterm_handler);

Drop the spaces before ','.

> @@ -517,14 +517,14 @@ void exit_program(int ret)
>          avformat_free_context(s);
>          av_dict_free(&output_files[i].opts);
>      }
> -    for(i=0;i<nb_input_files;i++) {
> +    for (i = 0; i<nb_input_files; i++) {

space around <

> @@ -648,41 +648,42 @@ static void update_sample_fmt(AVCodecContext *dec, 
> AVCodec *dec_codec,
>  
>  static void choose_sample_rate(AVStream *st, AVCodec *codec)
>  {
> -    if(codec && codec->supported_samplerates){
> -        const int *p= codec->supported_samplerates;
> -        int best=0;
> -        int best_dist=INT_MAX;
> -        for(; *p; p++){
> +    if (codec && codec->supported_samplerates) {
> +        const int *p = codec->supported_samplerates;
> +        int best = 0;
> +        int best_dist = INT_MAX;
> +        for (; *p; p++) {
>              int dist= abs(st->codec->sample_rate - *p);
> -            if(dist < best_dist){
> -                best_dist= dist;
> -                best= *p;
> +            if (dist < best_dist) {
> +                best_dist = dist;
> +                best = *p;

nit: some = could be aligned here

>          if (*p == PIX_FMT_NONE) {
> -            if(st->codec->pix_fmt != PIX_FMT_NONE)
> +            if (st->codec->pix_fmt != PIX_FMT_NONE)
>                  av_log(NULL, AV_LOG_WARNING,
>                          "Incompatible pixel format '%s' for codec '%s', 
> auto-selecting format '%s'\n",
>                          av_pix_fmt_descriptors[st->codec->pix_fmt].name,

There is one space too much indentation in that av_log.

> @@ -698,22 +699,22 @@ get_sync_ipts(const OutputStream *ost)
>  
> -static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext 
> *avctx, AVBitStreamFilterContext *bsfc){
> +static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext 
> *avctx, AVBitStreamFilterContext *bsfc) {

Ahem :)

> -    while(bsfc){
> -        AVPacket new_pkt= *pkt;
> -        int a= av_bitstream_filter_filter(bsfc, avctx, NULL,
> +    while (bsfc) {
> +        AVPacket new_pkt = *pkt;
> +        int a = av_bitstream_filter_filter(bsfc, avctx, NULL,
>                                            &new_pkt.data, &new_pkt.size,
>                                            pkt->data, pkt->size,
>                                            pkt->flags & AV_PKT_FLAG_KEY);

And here is one space less than necessary now.

> @@ -758,25 +759,25 @@ static void do_audio_out(AVFormatContext *s, 
> OutputStream *ost,
>  
>  need_realloc:
> -    audio_buf_size= (allocated_for_size + isize*dec->channels - 1) / 
> (isize*dec->channels);
> -    audio_buf_size= (audio_buf_size*enc->sample_rate + dec->sample_rate) / 
> dec->sample_rate;
> -    audio_buf_size= audio_buf_size*2 + 10000; //safety factors for the 
> deprecated resampling API
> -    audio_buf_size= FFMAX(audio_buf_size, enc->frame_size);
> -    audio_buf_size*= osize*enc->channels;
> -
> -    audio_out_size= FFMAX(audio_buf_size, enc->frame_size * osize * 
> enc->channels);
> -    if(coded_bps > 8*osize)
> -        audio_out_size= audio_out_size * coded_bps / (8*osize);
> +    audio_buf_size  = (allocated_for_size + isize * dec->channels - 1) / 
> (isize * dec->channels);
> +    audio_buf_size  = (audio_buf_size * enc->sample_rate + dec->sample_rate) 
> / dec->sample_rate;
> +    audio_buf_size  = audio_buf_size * 2 + 10000; //safety factors for the 
> deprecated resampling API

space after //

> +    audio_buf_size  = FFMAX(audio_buf_size, enc->frame_size);
> +    audio_buf_size *= osize * enc->channels;
> +
> +    audio_out_size = FFMAX(audio_buf_size, enc->frame_size * osize * 
> enc->channels);
> +    if (coded_bps > 8 * osize)
> +        audio_out_size = audio_out_size * coded_bps / (8*osize);

space around *

> @@ -882,9 +883,9 @@ need_realloc:
>                  av_resample_compensate(*(struct 
> AVResampleContext**)ost->resample, comp, enc->sample_rate);
>              }
>          }
> -    }else
> -        ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate)
> -                        - av_fifo_size(ost->fifo)/(enc->channels * osize); 
> //FIXME wrong
> +    } else
> +        ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate) -
> +                            av_fifo_size(ost->fifo) / (enc->channels * 
> osize); //FIXME wrong

spaces aroun = are missing and the spaces before av_fifo_size are wrong.

> @@ -1006,7 +1007,7 @@ static void pre_process_video_frame(InputStream *ist, 
> AVPicture *picture, void *
>          picture2 = &picture_tmp;
>          avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height);
>  
> -        if(avpicture_deinterlace(picture2, picture,
> +        if (avpicture_deinterlace(picture2, picture,
>                                   dec->pix_fmt, dec->width, dec->height) < 0) 
> {

You need to adjust the indentation of the continuing line when
you make these changes.

> @@ -1206,10 +1207,10 @@ static void do_video_out(AVFormatContext *s,
>  
>      /* duplicates frame if needed */
> -    for(i=0;i<nb_frames;i++) {
> +    for (i = 0; i<nb_frames; i++) {

space around <

> @@ -2107,7 +2110,7 @@ static int transcode_init(OutputFile *output_files,
>                      ost->st->sample_aspect_ratio =
>                          ist->st->sample_aspect_ratio.num ? 
> ist->st->sample_aspect_ratio :
>                          ist->st->codec->sample_aspect_ratio.num ?
> -                        ist->st->codec->sample_aspect_ratio : 
> (AVRational){0, 1};
> +                        ist->st->codec->sample_aspect_ratio : (AVRational) 
> {0, 1};
>                  }
>                  break;
>              case AVMEDIA_TYPE_SUBTITLE:
> @@ -2138,7 +2141,7 @@ static int transcode_init(OutputFile *output_files,
>                  if (!codec->sample_rate)
>                      codec->sample_rate = icodec->sample_rate;
>                  choose_sample_rate(ost->st, ost->enc);
> -                codec->time_base = (AVRational){1, codec->sample_rate};
> +                codec->time_base = (AVRational) {1, codec->sample_rate};

Add spaces inside {} everywhere.


Enough for now, please doublecheck the rest yourself.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to