Browse code

Merge commit 'c661cb6672af5ebcb900ec8766b24761bd2ab011'

* commit 'c661cb6672af5ebcb900ec8766b24761bd2ab011':
cmdutils: pass number of groups to split_commandline().
mov: handle h263 and flv1 for codec_tag 'H','2','6','3'
h264: fix sps parsing for SVC and CAVLC 4:4:4 Intra profiles

Conflicts:
libavcodec/h264_ps.c
libavformat/isom.c
libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/12/20 20:06:15
Showing 6 changed files
... ...
@@ -537,14 +537,15 @@ int opt_default(void *optctx, const char *opt, const char *arg)
537 537
  *
538 538
  * @return index of the group definition that matched or -1 if none
539 539
  */
540
-static int match_group_separator(const OptionGroupDef *groups, const char *opt)
540
+static int match_group_separator(const OptionGroupDef *groups, int nb_groups,
541
+                                 const char *opt)
541 542
 {
542
-    const OptionGroupDef *p = groups;
543
+    int i;
543 544
 
544
-    while (p->name) {
545
+    for (i = 0; i < nb_groups; i++) {
546
+        const OptionGroupDef *p = &groups[i];
545 547
         if (p->sep && !strcmp(p->sep, opt))
546
-            return p - groups;
547
-        p++;
548
+            return i;
548 549
     }
549 550
 
550 551
     return -1;
... ...
@@ -602,17 +603,14 @@ static void add_opt(OptionParseContext *octx, const OptionDef *opt,
602 602
 }
603 603
 
604 604
 static void init_parse_context(OptionParseContext *octx,
605
-                               const OptionGroupDef *groups)
605
+                               const OptionGroupDef *groups, int nb_groups)
606 606
 {
607 607
     static const OptionGroupDef global_group = { "global" };
608
-    const OptionGroupDef *g = groups;
609 608
     int i;
610 609
 
611 610
     memset(octx, 0, sizeof(*octx));
612 611
 
613
-    while (g->name)
614
-        g++;
615
-    octx->nb_groups = g - groups;
612
+    octx->nb_groups = nb_groups;
616 613
     octx->groups    = av_mallocz(sizeof(*octx->groups) * octx->nb_groups);
617 614
     if (!octx->groups)
618 615
         exit(1);
... ...
@@ -655,14 +653,14 @@ void uninit_parse_context(OptionParseContext *octx)
655 655
 
656 656
 int split_commandline(OptionParseContext *octx, int argc, char *argv[],
657 657
                       const OptionDef *options,
658
-                      const OptionGroupDef *groups)
658
+                      const OptionGroupDef *groups, int nb_groups)
659 659
 {
660 660
     int optindex = 1;
661 661
 
662 662
     /* perform system-dependent conversions for arguments list */
663 663
     prepare_app_arguments(&argc, &argv);
664 664
 
665
-    init_parse_context(octx, groups);
665
+    init_parse_context(octx, groups, nb_groups);
666 666
     av_log(NULL, AV_LOG_DEBUG, "Splitting the commandline.\n");
667 667
 
668 668
     while (optindex < argc) {
... ...
@@ -690,7 +688,7 @@ do {                                                                           \
690 690
 } while (0)
691 691
 
692 692
         /* named group separators, e.g. -i */
693
-        if ((ret = match_group_separator(groups, opt)) >= 0) {
693
+        if ((ret = match_group_separator(groups, nb_groups, opt)) >= 0) {
694 694
             GET_ARG(arg);
695 695
             finish_group(octx, ret, arg);
696 696
             av_log(NULL, AV_LOG_DEBUG, " matched as %s with argument '%s'.\n",
... ...
@@ -305,7 +305,7 @@ int parse_optgroup(void *optctx, OptionGroup *g);
305 305
  */
306 306
 int split_commandline(OptionParseContext *octx, int argc, char *argv[],
307 307
                       const OptionDef *options,
308
-                      const OptionGroupDef *groups);
308
+                      const OptionGroupDef *groups, int nb_groups);
309 309
 
310 310
 /**
311 311
  * Free all allocated memory in an OptionParseContext.
... ...
@@ -2266,7 +2266,6 @@ enum OptGroup {
2266 2266
 static const OptionGroupDef groups[] = {
2267 2267
     [GROUP_OUTFILE] = { "output file",  NULL },
2268 2268
     [GROUP_INFILE]  = { "input file",   "i"  },
2269
-    { 0 },
2270 2269
 };
2271 2270
 
2272 2271
 static int open_files(OptionGroupList *l, const char *inout,
... ...
@@ -2311,7 +2310,8 @@ int ffmpeg_parse_options(int argc, char **argv)
2311 2311
     memset(&octx, 0, sizeof(octx));
2312 2312
 
2313 2313
     /* split the commandline into an internal representation */
2314
-    ret = split_commandline(&octx, argc, argv, options, groups);
2314
+    ret = split_commandline(&octx, argc, argv, options, groups,
2315
+                            FF_ARRAY_ELEMS(groups));
2315 2316
     if (ret < 0) {
2316 2317
         av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: ");
2317 2318
         goto fail;
... ...
@@ -367,10 +367,11 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
367 367
     sps->scaling_matrix_present = 0;
368 368
     sps->colorspace = 2; //AVCOL_SPC_UNSPECIFIED
369 369
 
370
-    if(sps->profile_idc == 100 || sps->profile_idc == 110 ||
371
-       sps->profile_idc == 122 || sps->profile_idc == 244 || sps->profile_idc ==  44 ||
372
-       sps->profile_idc ==  83 || sps->profile_idc ==  86 || sps->profile_idc == 118 ||
373
-       sps->profile_idc == 128 || sps->profile_idc == 144) {
370
+    if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
371
+        sps->profile_idc == 122 || sps->profile_idc == 244 ||
372
+        sps->profile_idc ==  44 || sps->profile_idc ==  83 ||
373
+        sps->profile_idc ==  86 || sps->profile_idc == 118 ||
374
+        sps->profile_idc == 128 || sps->profile_idc == 144) {
374 375
         sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
375 376
         if (sps->chroma_format_idc > 3U) {
376 377
             av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc %d is illegal\n", sps->chroma_format_idc);
... ...
@@ -228,7 +228,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
228 228
 
229 229
     { AV_CODEC_ID_DIRAC,     MKTAG('d', 'r', 'a', 'c') },
230 230
     { AV_CODEC_ID_DNXHD,     MKTAG('A', 'V', 'd', 'n') }, /* AVID DNxHD */
231
-//  { AV_CODEC_ID_FLV1,      MKTAG('H', '2', '6', '3') }, /* Flash Media Server, forced in demuxer */
231
+    { AV_CODEC_ID_H263,      MKTAG('H', '2', '6', '3') },
232 232
     { AV_CODEC_ID_MSMPEG4V3, MKTAG('3', 'I', 'V', 'D') }, /* 3ivx DivX Doctor */
233 233
     { AV_CODEC_ID_RAWVIDEO,  MKTAG('A', 'V', '1', 'x') }, /* AVID 1:1x */
234 234
     { AV_CODEC_ID_RAWVIDEO,  MKTAG('A', 'V', 'u', 'p') },
... ...
@@ -1276,6 +1276,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
1276 1276
             int color_greyscale;
1277 1277
             int color_table_id;
1278 1278
 
1279
+            st->codec->codec_id = id;
1279 1280
             avio_rb16(pb); /* version */
1280 1281
             avio_rb16(pb); /* revision level */
1281 1282
             avio_rb32(pb); /* vendor */
... ...
@@ -1299,11 +1300,10 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
1299 1299
             /* codec_tag YV12 triggers an UV swap in rawdec.c */
1300 1300
             if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
1301 1301
                 st->codec->codec_tag=MKTAG('I', '4', '2', '0');
1302
-            /* Flash Media Server streams files with Sorenson Spark and tag H263 */
1303
-            if (!memcmp(st->codec->codec_name, "Sorenson H263", 13)
1304
-                && format == MKTAG('H','2','6','3'))
1305
-                id = AV_CODEC_ID_FLV1;
1306
-            st->codec->codec_id = id;
1302
+            /* Flash Media Server uses tag H263 with Sorenson Spark */
1303
+            if (format == MKTAG('H','2','6','3') &&
1304
+                !memcmp(st->codec->codec_name, "Sorenson H263", 13))
1305
+                st->codec->codec_id = AV_CODEC_ID_FLV1;
1307 1306
 
1308 1307
             st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */
1309 1308
             color_table_id = avio_rb16(pb); /* colortable id */