On Wed, Dec 21, 2011 at 12:35:06AM +0530, Aneesh Dogra wrote:
> ---
> avconv.c | 398
> +++++++++++++++++++++++++++++++-------------------------------
> 1 files changed, 200 insertions(+), 198 deletions(-)
cosmetics (lowercase)
> --- a/avconv.c
> +++ b/avconv.c
> @@ -648,41 +648,41 @@ static void update_sample_fmt(AVCodecContext *dec,
> AVCodec *dec_codec,
>
> static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
> {
> - if(codec && codec->pix_fmts){
> - const enum PixelFormat *p= codec->pix_fmts;
> - if(st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){
> - if(st->codec->codec_id==CODEC_ID_MJPEG){
> - p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P,
> PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE};
> - }else if(st->codec->codec_id==CODEC_ID_LJPEG){
> - p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P,
> PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P,
> PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE};
> + if (codec && codec->pix_fmts) {
> + const enum PixelFormat *p = codec->pix_fmts;
> + if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
> + if (st->codec->codec_id == CODEC_ID_MJPEG) {
> + p = (const enum PixelFormat[]) {PIX_FMT_YUVJ420P,
> PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE};
> + } else if (st->codec->codec_id == CODEC_ID_LJPEG) {
> + p = (const enum PixelFormat[]) {PIX_FMT_YUVJ420P,
> PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P,
> PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE};
spaces inside {}
Also, these lines are excessively long and could be broken.
> 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,
You failed to notice that indentation is off here.
> @@ -698,22 +698,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) {
{ should go on the next line after function declarations.
Also, this line is long and can easily be broken.
> - 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);
Indentation is broken after your change.
> @@ -758,25 +758,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
> + audio_buf_size = FFMAX(audio_buf_size, enc->frame_size);
> + audio_buf_size *= osize * enc->channels;
Consistently add space around '*', more below.
> @@ -836,45 +836,45 @@ need_realloc:
>
> - if(audio_sync_method){
> + if (audio_sync_method) {
> double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts
> - av_fifo_size(ost->fifo)/(enc->channels * osize);
This line is weirdly indented.
> - ist->is_start=0;
> - }else{
> - static uint8_t *input_tmp= NULL;
> + ist->is_start = 0;
> + } else {
> + static uint8_t *input_tmp = NULL;
> input_tmp= av_realloc(input_tmp, byte_delta + size);
spaces around =
>
> - if(byte_delta > allocated_for_size - size){
> - allocated_for_size= byte_delta + (int64_t)size;
> + if (byte_delta > allocated_for_size - size) {
> + allocated_for_size = byte_delta + (int64_t)size;
> goto need_realloc;
> }
> ist->is_start=0;
ditto
> - }else if(audio_sync_method>1){
> - int comp= av_clip(delta, -audio_sync_method,
> audio_sync_method);
> + } else if (audio_sync_method>1) {
> + int comp = av_clip(delta, -audio_sync_method,
> audio_sync_method);
spaces around >
Please check the remainder of the patch/file yourself.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel