Browse code

cmdutils: K&R reformatting cosmetics

Signed-off-by: Diego Biurrun <diego@biurrun.de>

Aneesh Dogra authored on 2011/12/31 21:31:54
Showing 1 changed files
... ...
@@ -58,7 +58,8 @@ static const int this_year = 2011;
58 58
 void init_opts(void)
59 59
 {
60 60
 #if CONFIG_SWSCALE
61
-    sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL);
61
+    sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC,
62
+                              NULL, NULL, NULL);
62 63
 #endif
63 64
 }
64 65
 
... ...
@@ -72,24 +73,25 @@ void uninit_opts(void)
72 72
     av_dict_free(&codec_opts);
73 73
 }
74 74
 
75
-void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
75
+void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
76 76
 {
77 77
     vfprintf(stdout, fmt, vl);
78 78
 }
79 79
 
80
-double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
80
+double parse_number_or_die(const char *context, const char *numstr, int type,
81
+                           double min, double max)
81 82
 {
82 83
     char *tail;
83 84
     const char *error;
84 85
     double d = av_strtod(numstr, &tail);
85 86
     if (*tail)
86
-        error= "Expected number for %s but found: %s\n";
87
+        error = "Expected number for %s but found: %s\n";
87 88
     else if (d < min || d > max)
88
-        error= "The value for %s was %s which is not within %f - %f\n";
89
-    else if(type == OPT_INT64 && (int64_t)d != d)
90
-        error= "Expected int64 for %s but found %s\n";
89
+        error = "The value for %s was %s which is not within %f - %f\n";
90
+    else if (type == OPT_INT64 && (int64_t)d != d)
91
+        error = "Expected int64 for %s but found %s\n";
91 92
     else if (type == OPT_INT && (int)d != d)
92
-        error= "Expected int for %s but found %s\n";
93
+        error = "Expected int for %s but found %s\n";
93 94
     else
94 95
         return d;
95 96
     av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max);
... ...
@@ -97,7 +99,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
97 97
     return 0;
98 98
 }
99 99
 
100
-int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
100
+int64_t parse_time_or_die(const char *context, const char *timestr,
101
+                          int is_duration)
101 102
 {
102 103
     int64_t us;
103 104
     if (av_parse_time(&us, timestr, is_duration) < 0) {
... ...
@@ -108,13 +111,14 @@ int64_t parse_time_or_die(const char *context, const char *timestr, int is_durat
108 108
     return us;
109 109
 }
110 110
 
111
-void show_help_options(const OptionDef *options, const char *msg, int mask, int value)
111
+void show_help_options(const OptionDef *options, const char *msg, int mask,
112
+                       int value)
112 113
 {
113 114
     const OptionDef *po;
114 115
     int first;
115 116
 
116 117
     first = 1;
117
-    for(po = options; po->name != NULL; po++) {
118
+    for (po = options; po->name != NULL; po++) {
118 119
         char buf[64];
119 120
         if ((po->flags & mask) == value) {
120 121
             if (first) {
... ...
@@ -141,7 +145,8 @@ void show_help_children(const AVClass *class, int flags)
141 141
         show_help_children(child, flags);
142 142
 }
143 143
 
144
-static const OptionDef* find_option(const OptionDef *po, const char *name){
144
+static const OptionDef *find_option(const OptionDef *po, const char *name)
145
+{
145 146
     const char *p = strchr(name, ':');
146 147
     int len = p ? p - name : strlen(name);
147 148
 
... ...
@@ -188,8 +193,8 @@ static void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
188 188
         buffsize += WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1,
189 189
                                         NULL, 0, NULL, NULL);
190 190
 
191
-    win32_argv_utf8 = av_mallocz(sizeof(char*) * (win32_argc + 1) + buffsize);
192
-    argstr_flat     = (char*)win32_argv_utf8 + sizeof(char*) * (win32_argc + 1);
191
+    win32_argv_utf8 = av_mallocz(sizeof(char *) * (win32_argc + 1) + buffsize);
192
+    argstr_flat     = (char *)win32_argv_utf8 + sizeof(char *) * (win32_argc + 1);
193 193
     if (win32_argv_utf8 == NULL) {
194 194
         LocalFree(argv_w);
195 195
         return;
... ...
@@ -214,7 +219,8 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
214 214
 }
215 215
 #endif /* WIN32 && !__MINGW32CE__ */
216 216
 
217
-int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
217
+int parse_option(void *optctx, const char *opt, const char *arg,
218
+                 const OptionDef *options)
218 219
 {
219 220
     const OptionDef *po;
220 221
     int bool_val = 1;
... ...
@@ -243,13 +249,14 @@ unknown_opt:
243 243
 
244 244
     /* new-style options contain an offset into optctx, old-style address of
245 245
      * a global var*/
246
-    dst = po->flags & (OPT_OFFSET|OPT_SPEC) ? (uint8_t*)optctx + po->u.off : po->u.dst_ptr;
246
+    dst = po->flags & (OPT_OFFSET | OPT_SPEC) ? (uint8_t *)optctx + po->u.off
247
+                                              : po->u.dst_ptr;
247 248
 
248 249
     if (po->flags & OPT_SPEC) {
249 250
         SpecifierOpt **so = dst;
250 251
         char *p = strchr(opt, ':');
251 252
 
252
-        dstcount = (int*)(so + 1);
253
+        dstcount = (int *)(so + 1);
253 254
         *so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1);
254 255
         (*so)[*dstcount - 1].specifier = av_strdup(p ? p + 1 : "");
255 256
         dst = &(*so)[*dstcount - 1].u;
... ...
@@ -258,24 +265,25 @@ unknown_opt:
258 258
     if (po->flags & OPT_STRING) {
259 259
         char *str;
260 260
         str = av_strdup(arg);
261
-        *(char**)dst = str;
261
+        *(char **)dst = str;
262 262
     } else if (po->flags & OPT_BOOL) {
263
-        *(int*)dst = bool_val;
263
+        *(int *)dst = bool_val;
264 264
     } else if (po->flags & OPT_INT) {
265
-        *(int*)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
265
+        *(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
266 266
     } else if (po->flags & OPT_INT64) {
267
-        *(int64_t*)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
267
+        *(int64_t *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
268 268
     } else if (po->flags & OPT_TIME) {
269
-        *(int64_t*)dst = parse_time_or_die(opt, arg, 1);
269
+        *(int64_t *)dst = parse_time_or_die(opt, arg, 1);
270 270
     } else if (po->flags & OPT_FLOAT) {
271
-        *(float*)dst = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
271
+        *(float *)dst = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
272 272
     } else if (po->flags & OPT_DOUBLE) {
273
-        *(double*)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY);
273
+        *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY);
274 274
     } else if (po->u.func_arg) {
275
-        int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg) :
276
-                                          po->u.func_arg(opt, arg);
275
+        int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg)
276
+                                        : po->u.func_arg(opt, arg);
277 277
         if (ret < 0) {
278
-            av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", arg, opt);
278
+            av_log(NULL, AV_LOG_ERROR,
279
+                   "Failed to set value '%s' for option '%s'\n", arg, opt);
279 280
             return ret;
280 281
         }
281 282
     }
... ...
@@ -285,7 +293,7 @@ unknown_opt:
285 285
 }
286 286
 
287 287
 void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
288
-                   void (* parse_arg_function)(void *, const char*))
288
+                   void (*parse_arg_function)(void *, const char*))
289 289
 {
290 290
     const char *opt;
291 291
     int optindex, handleoptions = 1, ret;
... ...
@@ -318,7 +326,8 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options
318 318
 /*
319 319
  * Return index of option opt in argv or 0 if not found.
320 320
  */
321
-static int locate_option(int argc, char **argv, const OptionDef *options, const char *optname)
321
+static int locate_option(int argc, char **argv, const OptionDef *options,
322
+                         const char *optname)
322 323
 {
323 324
     const OptionDef *po;
324 325
     int i;
... ...
@@ -364,13 +373,16 @@ int opt_default(const char *opt, const char *arg)
364 364
         p = opt + strlen(opt);
365 365
     av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));
366 366
 
367
-    if ((o = av_opt_find(&cc, opt_stripped, NULL, 0, AV_OPT_SEARCH_CHILDREN|AV_OPT_SEARCH_FAKE_OBJ)) ||
368
-         ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
369
-          (o = av_opt_find(&cc, opt+1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))
367
+    if ((o = av_opt_find(&cc, opt_stripped, NULL, 0,
368
+                         AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) ||
369
+        ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
370
+         (o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))
370 371
         av_dict_set(&codec_opts, opt, arg, FLAGS);
371
-    else if ((o = av_opt_find(&fc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
372
+    else if ((o = av_opt_find(&fc, opt, NULL, 0,
373
+                              AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
372 374
         av_dict_set(&format_opts, opt, arg, FLAGS);
373
-    else if ((o = av_opt_find(&sc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
375
+    else if ((o = av_opt_find(&sc, opt, NULL, 0,
376
+                              AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
374 377
         // XXX we only support sws_flags, not arbitrary sws options
375 378
         int ret = av_opt_set(sws_opts, opt, arg, 0);
376 379
         if (ret < 0) {
... ...
@@ -489,7 +501,8 @@ static void print_all_libs_info(int flags, int level)
489 489
 
490 490
 void show_banner(void)
491 491
 {
492
-    av_log(NULL, AV_LOG_INFO, "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n",
492
+    av_log(NULL, AV_LOG_INFO,
493
+           "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n",
493 494
            program_name, program_birth_year, this_year);
494 495
     av_log(NULL, AV_LOG_INFO, "  built on %s %s with %s %s\n",
495 496
            __DATE__, __TIME__, CC_TYPE, CC_VERSION);
... ...
@@ -575,93 +588,92 @@ void show_license(void)
575 575
 
576 576
 void show_formats(void)
577 577
 {
578
-    AVInputFormat *ifmt=NULL;
579
-    AVOutputFormat *ofmt=NULL;
578
+    AVInputFormat *ifmt  = NULL;
579
+    AVOutputFormat *ofmt = NULL;
580 580
     const char *last_name;
581 581
 
582
-    printf(
583
-        "File formats:\n"
584
-        " D. = Demuxing supported\n"
585
-        " .E = Muxing supported\n"
586
-        " --\n");
587
-    last_name= "000";
588
-    for(;;){
589
-        int decode=0;
590
-        int encode=0;
591
-        const char *name=NULL;
592
-        const char *long_name=NULL;
593
-
594
-        while((ofmt= av_oformat_next(ofmt))) {
595
-            if((name == NULL || strcmp(ofmt->name, name)<0) &&
596
-                strcmp(ofmt->name, last_name)>0){
597
-                name= ofmt->name;
598
-                long_name= ofmt->long_name;
599
-                encode=1;
582
+    printf("File formats:\n"
583
+           " D. = Demuxing supported\n"
584
+           " .E = Muxing supported\n"
585
+           " --\n");
586
+    last_name = "000";
587
+    for (;;) {
588
+        int decode = 0;
589
+        int encode = 0;
590
+        const char *name      = NULL;
591
+        const char *long_name = NULL;
592
+
593
+        while ((ofmt = av_oformat_next(ofmt))) {
594
+            if ((name == NULL || strcmp(ofmt->name, name) < 0) &&
595
+                strcmp(ofmt->name, last_name) > 0) {
596
+                name      = ofmt->name;
597
+                long_name = ofmt->long_name;
598
+                encode    = 1;
600 599
             }
601 600
         }
602
-        while((ifmt= av_iformat_next(ifmt))) {
603
-            if((name == NULL || strcmp(ifmt->name, name)<0) &&
604
-                strcmp(ifmt->name, last_name)>0){
605
-                name= ifmt->name;
606
-                long_name= ifmt->long_name;
607
-                encode=0;
601
+        while ((ifmt = av_iformat_next(ifmt))) {
602
+            if ((name == NULL || strcmp(ifmt->name, name) < 0) &&
603
+                strcmp(ifmt->name, last_name) > 0) {
604
+                name      = ifmt->name;
605
+                long_name = ifmt->long_name;
606
+                encode    = 0;
608 607
             }
609
-            if(name && strcmp(ifmt->name, name)==0)
610
-                decode=1;
608
+            if (name && strcmp(ifmt->name, name) == 0)
609
+                decode = 1;
611 610
         }
612
-        if(name==NULL)
611
+        if (name == NULL)
613 612
             break;
614
-        last_name= name;
613
+        last_name = name;
615 614
 
616
-        printf(
617
-            " %s%s %-15s %s\n",
618
-            decode ? "D":" ",
619
-            encode ? "E":" ",
620
-            name,
615
+        printf(" %s%s %-15s %s\n",
616
+               decode ? "D" : " ",
617
+               encode ? "E" : " ",
618
+               name,
621 619
             long_name ? long_name:" ");
622 620
     }
623 621
 }
624 622
 
625 623
 void show_codecs(void)
626 624
 {
627
-    AVCodec *p=NULL, *p2;
625
+    AVCodec *p = NULL, *p2;
628 626
     const char *last_name;
629
-    printf(
630
-        "Codecs:\n"
631
-        " D..... = Decoding supported\n"
632
-        " .E.... = Encoding supported\n"
633
-        " ..V... = Video codec\n"
634
-        " ..A... = Audio codec\n"
635
-        " ..S... = Subtitle codec\n"
636
-        " ...S.. = Supports draw_horiz_band\n"
637
-        " ....D. = Supports direct rendering method 1\n"
638
-        " .....T = Supports weird frame truncation\n"
639
-        " ------\n");
627
+    printf("Codecs:\n"
628
+           " D..... = Decoding supported\n"
629
+           " .E.... = Encoding supported\n"
630
+           " ..V... = Video codec\n"
631
+           " ..A... = Audio codec\n"
632
+           " ..S... = Subtitle codec\n"
633
+           " ...S.. = Supports draw_horiz_band\n"
634
+           " ....D. = Supports direct rendering method 1\n"
635
+           " .....T = Supports weird frame truncation\n"
636
+           " ------\n");
640 637
     last_name= "000";
641
-    for(;;){
642
-        int decode=0;
643
-        int encode=0;
644
-        int cap=0;
638
+    for (;;) {
639
+        int decode = 0;
640
+        int encode = 0;
641
+        int cap    = 0;
645 642
         const char *type_str;
646 643
 
647
-        p2=NULL;
648
-        while((p= av_codec_next(p))) {
649
-            if((p2==NULL || strcmp(p->name, p2->name)<0) &&
650
-                strcmp(p->name, last_name)>0){
651
-                p2= p;
652
-                decode= encode= cap=0;
644
+        p2 = NULL;
645
+        while ((p = av_codec_next(p))) {
646
+            if ((p2 == NULL || strcmp(p->name, p2->name) < 0) &&
647
+                strcmp(p->name, last_name) > 0) {
648
+                p2 = p;
649
+                decode = encode = cap = 0;
653 650
             }
654
-            if(p2 && strcmp(p->name, p2->name)==0){
655
-                if(p->decode) decode=1;
656
-                if(p->encode) encode=1;
651
+            if (p2 && strcmp(p->name, p2->name) == 0) {
652
+                if (p->decode)
653
+                    decode = 1;
654
+                if (p->encode)
655
+                    encode = 1;
657 656
                 cap |= p->capabilities;
658 657
             }
659 658
         }
660
-        if(p2==NULL)
659
+        if (p2 == NULL)
661 660
             break;
662
-        last_name= p2->name;
661
+        last_name = p2->name;
663 662
 
664
-        switch(p2->type) {
663
+        switch (p2->type) {
665 664
         case AVMEDIA_TYPE_VIDEO:
666 665
             type_str = "V";
667 666
             break;
... ...
@@ -675,35 +687,35 @@ void show_codecs(void)
675 675
             type_str = "?";
676 676
             break;
677 677
         }
678
-        printf(
679
-            " %s%s%s%s%s%s %-15s %s",
680
-            decode ? "D": (/*p2->decoder ? "d":*/" "),
681
-            encode ? "E":" ",
682
-            type_str,
683
-            cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S":" ",
684
-            cap & CODEC_CAP_DR1 ? "D":" ",
685
-            cap & CODEC_CAP_TRUNCATED ? "T":" ",
686
-            p2->name,
687
-            p2->long_name ? p2->long_name : "");
688
-       /* if(p2->decoder && decode==0)
689
-            printf(" use %s for decoding", p2->decoder->name);*/
678
+        printf(" %s%s%s%s%s%s %-15s %s",
679
+               decode ? "D" : (/* p2->decoder ? "d" : */ " "),
680
+               encode ? "E" : " ",
681
+               type_str,
682
+               cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ",
683
+               cap & CODEC_CAP_DR1 ? "D" : " ",
684
+               cap & CODEC_CAP_TRUNCATED ? "T" : " ",
685
+               p2->name,
686
+               p2->long_name ? p2->long_name : "");
687
+#if 0
688
+            if (p2->decoder && decode == 0)
689
+                printf(" use %s for decoding", p2->decoder->name);
690
+#endif
690 691
         printf("\n");
691 692
     }
692 693
     printf("\n");
693
-    printf(
694
-"Note, the names of encoders and decoders do not always match, so there are\n"
695
-"several cases where the above table shows encoder only or decoder only entries\n"
696
-"even though both encoding and decoding are supported. For example, the h263\n"
697
-"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
698
-"worse.\n");
694
+    printf("Note, the names of encoders and decoders do not always match, so there are\n"
695
+           "several cases where the above table shows encoder only or decoder only entries\n"
696
+           "even though both encoding and decoding are supported. For example, the h263\n"
697
+           "decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
698
+           "worse.\n");
699 699
 }
700 700
 
701 701
 void show_bsfs(void)
702 702
 {
703
-    AVBitStreamFilter *bsf=NULL;
703
+    AVBitStreamFilter *bsf = NULL;
704 704
 
705 705
     printf("Bitstream filters:\n");
706
-    while((bsf = av_bitstream_filter_next(bsf)))
706
+    while ((bsf = av_bitstream_filter_next(bsf)))
707 707
         printf("%s\n", bsf->name);
708 708
     printf("\n");
709 709
 }
... ...
@@ -737,15 +749,14 @@ void show_pix_fmts(void)
737 737
 {
738 738
     enum PixelFormat pix_fmt;
739 739
 
740
-    printf(
741
-        "Pixel formats:\n"
742
-        "I.... = Supported Input  format for conversion\n"
743
-        ".O... = Supported Output format for conversion\n"
744
-        "..H.. = Hardware accelerated format\n"
745
-        "...P. = Paletted format\n"
746
-        "....B = Bitstream format\n"
747
-        "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL\n"
748
-        "-----\n");
740
+    printf("Pixel formats:\n"
741
+           "I.... = Supported Input  format for conversion\n"
742
+           ".O... = Supported Output format for conversion\n"
743
+           "..H.. = Hardware accelerated format\n"
744
+           "...P. = Paletted format\n"
745
+           "....B = Bitstream format\n"
746
+           "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL\n"
747
+           "-----\n");
749 748
 
750 749
 #if !CONFIG_SWSCALE
751 750
 #   define sws_isSupportedInput(x)  0
... ...
@@ -792,7 +803,8 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
792 792
     FILE *f = fopen(filename, "rb");
793 793
 
794 794
     if (!f) {
795
-        av_log(NULL, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename, strerror(errno));
795
+        av_log(NULL, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename,
796
+               strerror(errno));
796 797
         return AVERROR(errno);
797 798
     }
798 799
     fseek(f, 0, SEEK_END);
... ...
@@ -828,7 +840,8 @@ void init_pts_correction(PtsCorrectionContext *ctx)
828 828
     ctx->last_pts = ctx->last_dts = INT64_MIN;
829 829
 }
830 830
 
831
-int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, int64_t dts)
831
+int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts,
832
+                          int64_t dts)
832 833
 {
833 834
     int64_t pts = AV_NOPTS_VALUE;
834 835
 
... ...
@@ -841,7 +854,7 @@ int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, int6
841 841
         ctx->last_pts = reordered_pts;
842 842
     }
843 843
     if ((ctx->num_faulty_pts<=ctx->num_faulty_dts || dts == AV_NOPTS_VALUE)
844
-       && reordered_pts != AV_NOPTS_VALUE)
844
+        && reordered_pts != AV_NOPTS_VALUE)
845 845
         pts = reordered_pts;
846 846
     else
847 847
         pts = dts;
... ...
@@ -850,14 +863,14 @@ int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, int6
850 850
 }
851 851
 
852 852
 FILE *get_preset_file(char *filename, size_t filename_size,
853
-                      const char *preset_name, int is_path, const char *codec_name)
853
+                      const char *preset_name, int is_path,
854
+                      const char *codec_name)
854 855
 {
855 856
     FILE *f = NULL;
856 857
     int i;
857
-    const char *base[3]= { getenv("AVCONV_DATADIR"),
858
-                           getenv("HOME"),
859
-                           AVCONV_DATADIR,
860
-                         };
858
+    const char *base[3] = { getenv("AVCONV_DATADIR"),
859
+                            getenv("HOME"),
860
+                            AVCONV_DATADIR, };
861 861
 
862 862
     if (is_path) {
863 863
         av_strlcpy(filename, preset_name, filename_size);
... ...
@@ -866,11 +879,14 @@ FILE *get_preset_file(char *filename, size_t filename_size,
866 866
         for (i = 0; i < 3 && !f; i++) {
867 867
             if (!base[i])
868 868
                 continue;
869
-            snprintf(filename, filename_size, "%s%s/%s.ffpreset", base[i], i != 1 ? "" : "/.avconv", preset_name);
869
+            snprintf(filename, filename_size, "%s%s/%s.ffpreset", base[i],
870
+                     i != 1 ? "" : "/.avconv", preset_name);
870 871
             f = fopen(filename, "r");
871 872
             if (!f && codec_name) {
872 873
                 snprintf(filename, filename_size,
873
-                         "%s%s/%s-%s.ffpreset", base[i],  i != 1 ? "" : "/.avconv", codec_name, preset_name);
874
+                         "%s%s/%s-%s.ffpreset",
875
+                         base[i], i != 1 ? "" : "/.avconv", codec_name,
876
+                         preset_name);
874 877
                 f = fopen(filename, "r");
875 878
             }
876 879
         }
... ...
@@ -881,21 +897,22 @@ FILE *get_preset_file(char *filename, size_t filename_size,
881 881
 
882 882
 int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
883 883
 {
884
-    if (*spec <= '9' && *spec >= '0')                                        /* opt:index */
884
+    if (*spec <= '9' && *spec >= '0') /* opt:index */
885 885
         return strtol(spec, NULL, 0) == st->index;
886
-    else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' || *spec == 't') { /* opt:[vasdt] */
886
+    else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
887
+             *spec == 't') { /* opt:[vasdt] */
887 888
         enum AVMediaType type;
888 889
 
889 890
         switch (*spec++) {
890
-        case 'v': type = AVMEDIA_TYPE_VIDEO;    break;
891
-        case 'a': type = AVMEDIA_TYPE_AUDIO;    break;
892
-        case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
893
-        case 'd': type = AVMEDIA_TYPE_DATA;     break;
891
+        case 'v': type = AVMEDIA_TYPE_VIDEO;      break;
892
+        case 'a': type = AVMEDIA_TYPE_AUDIO;      break;
893
+        case 's': type = AVMEDIA_TYPE_SUBTITLE;   break;
894
+        case 'd': type = AVMEDIA_TYPE_DATA;       break;
894 895
         case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
895 896
         }
896 897
         if (type != st->codec->codec_type)
897 898
             return 0;
898
-        if (*spec++ == ':') {                                   /* possibly followed by :index */
899
+        if (*spec++ == ':') { /* possibly followed by :index */
899 900
             int i, index = strtol(spec, NULL, 0);
900 901
             for (i = 0; i < s->nb_streams; i++)
901 902
                 if (s->streams[i]->codec->codec_type == type && index-- == 0)
... ...
@@ -931,12 +948,15 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
931 931
     return AVERROR(EINVAL);
932 932
 }
933 933
 
934
-AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, AVFormatContext *s, AVStream *st)
934
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id,
935
+                                AVFormatContext *s, AVStream *st)
935 936
 {
936 937
     AVDictionary    *ret = NULL;
937 938
     AVDictionaryEntry *t = NULL;
938
-    AVCodec       *codec = s->oformat ? avcodec_find_encoder(codec_id) : avcodec_find_decoder(codec_id);
939
-    int            flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM : AV_OPT_FLAG_DECODING_PARAM;
939
+    AVCodec       *codec = s->oformat ? avcodec_find_encoder(codec_id)
940
+                                      : avcodec_find_decoder(codec_id);
941
+    int            flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM
942
+                                      : AV_OPT_FLAG_DECODING_PARAM;
940 943
     char          prefix = 0;
941 944
     const AVClass    *cc = avcodec_get_class();
942 945
 
... ...
@@ -944,9 +964,18 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, AVFor
944 944
         return NULL;
945 945
 
946 946
     switch (codec->type) {
947
-    case AVMEDIA_TYPE_VIDEO:    prefix = 'v'; flags |= AV_OPT_FLAG_VIDEO_PARAM;    break;
948
-    case AVMEDIA_TYPE_AUDIO:    prefix = 'a'; flags |= AV_OPT_FLAG_AUDIO_PARAM;    break;
949
-    case AVMEDIA_TYPE_SUBTITLE: prefix = 's'; flags |= AV_OPT_FLAG_SUBTITLE_PARAM; break;
947
+    case AVMEDIA_TYPE_VIDEO:
948
+        prefix  = 'v';
949
+        flags  |= AV_OPT_FLAG_VIDEO_PARAM;
950
+        break;
951
+    case AVMEDIA_TYPE_AUDIO:
952
+        prefix  = 'a';
953
+        flags  |= AV_OPT_FLAG_AUDIO_PARAM;
954
+        break;
955
+    case AVMEDIA_TYPE_SUBTITLE:
956
+        prefix  = 's';
957
+        flags  |= AV_OPT_FLAG_SUBTITLE_PARAM;
958
+        break;
950 959
     }
951 960
 
952 961
     while (t = av_dict_get(opts, "", t, AV_DICT_IGNORE_SUFFIX)) {
... ...
@@ -961,10 +990,14 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, AVFor
961 961
             }
962 962
 
963 963
         if (av_opt_find(&cc, t->key, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ) ||
964
-            (codec && codec->priv_class && av_opt_find(&codec->priv_class, t->key, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ)))
964
+            (codec && codec->priv_class &&
965
+             av_opt_find(&codec->priv_class, t->key, NULL, flags,
966
+                         AV_OPT_SEARCH_FAKE_OBJ)))
965 967
             av_dict_set(&ret, t->key, t->value, 0);
966
-        else if (t->key[0] == prefix && av_opt_find(&cc, t->key+1, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ))
967
-            av_dict_set(&ret, t->key+1, t->value, 0);
968
+        else if (t->key[0] == prefix &&
969
+                 av_opt_find(&cc, t->key + 1, NULL, flags,
970
+                             AV_OPT_SEARCH_FAKE_OBJ))
971
+            av_dict_set(&ret, t->key + 1, t->value, 0);
968 972
 
969 973
         if (p)
970 974
             *p = ':';
... ...
@@ -972,7 +1005,8 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, AVFor
972 972
     return ret;
973 973
 }
974 974
 
975
-AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
975
+AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
976
+                                           AVDictionary *codec_opts)
976 977
 {
977 978
     int i;
978 979
     AVDictionary **opts;
... ...
@@ -981,11 +1015,13 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *cod
981 981
         return NULL;
982 982
     opts = av_mallocz(s->nb_streams * sizeof(*opts));
983 983
     if (!opts) {
984
-        av_log(NULL, AV_LOG_ERROR, "Could not alloc memory for stream options.\n");
984
+        av_log(NULL, AV_LOG_ERROR,
985
+               "Could not alloc memory for stream options.\n");
985 986
         return NULL;
986 987
     }
987 988
     for (i = 0; i < s->nb_streams; i++)
988
-        opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id, s, s->streams[i]);
989
+        opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id,
990
+                                    s, s->streams[i]);
989 991
     return opts;
990 992
 }
991 993
 
... ...
@@ -1044,10 +1080,10 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
1044 1044
 
1045 1045
     memcpy(frame->data,     picref->data,     sizeof(frame->data));
1046 1046
     memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
1047
-    frame->interlaced_frame = picref->video->interlaced;
1048
-    frame->top_field_first  = picref->video->top_field_first;
1049
-    frame->key_frame        = picref->video->key_frame;
1050
-    frame->pict_type        = picref->video->pict_type;
1047
+    frame->interlaced_frame    = picref->video->interlaced;
1048
+    frame->top_field_first     = picref->video->top_field_first;
1049
+    frame->key_frame           = picref->video->key_frame;
1050
+    frame->pict_type           = picref->video->pict_type;
1051 1051
     frame->sample_aspect_ratio = picref->video->pixel_aspect;
1052 1052
 
1053 1053
     return 1;