Commit 40ea3438 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'c661cb66'

* commit 'c661cb66':
  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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 174c483e c661cb66
...@@ -537,14 +537,15 @@ int opt_default(void *optctx, const char *opt, const char *arg) ...@@ -537,14 +537,15 @@ int opt_default(void *optctx, const char *opt, const char *arg)
* *
* @return index of the group definition that matched or -1 if none * @return index of the group definition that matched or -1 if none
*/ */
static int match_group_separator(const OptionGroupDef *groups, const char *opt) static int match_group_separator(const OptionGroupDef *groups, int nb_groups,
const char *opt)
{ {
const OptionGroupDef *p = groups; int i;
while (p->name) { for (i = 0; i < nb_groups; i++) {
const OptionGroupDef *p = &groups[i];
if (p->sep && !strcmp(p->sep, opt)) if (p->sep && !strcmp(p->sep, opt))
return p - groups; return i;
p++;
} }
return -1; return -1;
...@@ -602,17 +603,14 @@ static void add_opt(OptionParseContext *octx, const OptionDef *opt, ...@@ -602,17 +603,14 @@ static void add_opt(OptionParseContext *octx, const OptionDef *opt,
} }
static void init_parse_context(OptionParseContext *octx, static void init_parse_context(OptionParseContext *octx,
const OptionGroupDef *groups) const OptionGroupDef *groups, int nb_groups)
{ {
static const OptionGroupDef global_group = { "global" }; static const OptionGroupDef global_group = { "global" };
const OptionGroupDef *g = groups;
int i; int i;
memset(octx, 0, sizeof(*octx)); memset(octx, 0, sizeof(*octx));
while (g->name) octx->nb_groups = nb_groups;
g++;
octx->nb_groups = g - groups;
octx->groups = av_mallocz(sizeof(*octx->groups) * octx->nb_groups); octx->groups = av_mallocz(sizeof(*octx->groups) * octx->nb_groups);
if (!octx->groups) if (!octx->groups)
exit(1); exit(1);
...@@ -655,14 +653,14 @@ void uninit_parse_context(OptionParseContext *octx) ...@@ -655,14 +653,14 @@ void uninit_parse_context(OptionParseContext *octx)
int split_commandline(OptionParseContext *octx, int argc, char *argv[], int split_commandline(OptionParseContext *octx, int argc, char *argv[],
const OptionDef *options, const OptionDef *options,
const OptionGroupDef *groups) const OptionGroupDef *groups, int nb_groups)
{ {
int optindex = 1; int optindex = 1;
/* perform system-dependent conversions for arguments list */ /* perform system-dependent conversions for arguments list */
prepare_app_arguments(&argc, &argv); prepare_app_arguments(&argc, &argv);
init_parse_context(octx, groups); init_parse_context(octx, groups, nb_groups);
av_log(NULL, AV_LOG_DEBUG, "Splitting the commandline.\n"); av_log(NULL, AV_LOG_DEBUG, "Splitting the commandline.\n");
while (optindex < argc) { while (optindex < argc) {
...@@ -690,7 +688,7 @@ do { \ ...@@ -690,7 +688,7 @@ do { \
} while (0) } while (0)
/* named group separators, e.g. -i */ /* named group separators, e.g. -i */
if ((ret = match_group_separator(groups, opt)) >= 0) { if ((ret = match_group_separator(groups, nb_groups, opt)) >= 0) {
GET_ARG(arg); GET_ARG(arg);
finish_group(octx, ret, arg); finish_group(octx, ret, arg);
av_log(NULL, AV_LOG_DEBUG, " matched as %s with argument '%s'.\n", 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,7 +305,7 @@ int parse_optgroup(void *optctx, OptionGroup *g);
*/ */
int split_commandline(OptionParseContext *octx, int argc, char *argv[], int split_commandline(OptionParseContext *octx, int argc, char *argv[],
const OptionDef *options, const OptionDef *options,
const OptionGroupDef *groups); const OptionGroupDef *groups, int nb_groups);
/** /**
* Free all allocated memory in an OptionParseContext. * Free all allocated memory in an OptionParseContext.
......
...@@ -2266,7 +2266,6 @@ enum OptGroup { ...@@ -2266,7 +2266,6 @@ enum OptGroup {
static const OptionGroupDef groups[] = { static const OptionGroupDef groups[] = {
[GROUP_OUTFILE] = { "output file", NULL }, [GROUP_OUTFILE] = { "output file", NULL },
[GROUP_INFILE] = { "input file", "i" }, [GROUP_INFILE] = { "input file", "i" },
{ 0 },
}; };
static int open_files(OptionGroupList *l, const char *inout, static int open_files(OptionGroupList *l, const char *inout,
...@@ -2311,7 +2310,8 @@ int ffmpeg_parse_options(int argc, char **argv) ...@@ -2311,7 +2310,8 @@ int ffmpeg_parse_options(int argc, char **argv)
memset(&octx, 0, sizeof(octx)); memset(&octx, 0, sizeof(octx));
/* split the commandline into an internal representation */ /* split the commandline into an internal representation */
ret = split_commandline(&octx, argc, argv, options, groups); ret = split_commandline(&octx, argc, argv, options, groups,
FF_ARRAY_ELEMS(groups));
if (ret < 0) { if (ret < 0) {
av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: "); av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: ");
goto fail; goto fail;
......
...@@ -367,10 +367,11 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ ...@@ -367,10 +367,11 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
sps->scaling_matrix_present = 0; sps->scaling_matrix_present = 0;
sps->colorspace = 2; //AVCOL_SPC_UNSPECIFIED sps->colorspace = 2; //AVCOL_SPC_UNSPECIFIED
if(sps->profile_idc == 100 || sps->profile_idc == 110 || if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
sps->profile_idc == 122 || sps->profile_idc == 244 || sps->profile_idc == 44 || sps->profile_idc == 122 || sps->profile_idc == 244 ||
sps->profile_idc == 83 || sps->profile_idc == 86 || sps->profile_idc == 118 || sps->profile_idc == 44 || sps->profile_idc == 83 ||
sps->profile_idc == 128 || sps->profile_idc == 144) { sps->profile_idc == 86 || sps->profile_idc == 118 ||
sps->profile_idc == 128 || sps->profile_idc == 144) {
sps->chroma_format_idc= get_ue_golomb_31(&s->gb); sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
if (sps->chroma_format_idc > 3U) { if (sps->chroma_format_idc > 3U) {
av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc %d is illegal\n", sps->chroma_format_idc); 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,7 +228,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
{ AV_CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') }, { AV_CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
{ AV_CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n') }, /* AVID DNxHD */ { AV_CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n') }, /* AVID DNxHD */
// { AV_CODEC_ID_FLV1, MKTAG('H', '2', '6', '3') }, /* Flash Media Server, forced in demuxer */ { AV_CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('3', 'I', 'V', 'D') }, /* 3ivx DivX Doctor */ { AV_CODEC_ID_MSMPEG4V3, MKTAG('3', 'I', 'V', 'D') }, /* 3ivx DivX Doctor */
{ AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'V', '1', 'x') }, /* AVID 1:1x */ { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'V', '1', 'x') }, /* AVID 1:1x */
{ AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'V', 'u', 'p') }, { 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,6 +1276,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
int color_greyscale; int color_greyscale;
int color_table_id; int color_table_id;
st->codec->codec_id = id;
avio_rb16(pb); /* version */ avio_rb16(pb); /* version */
avio_rb16(pb); /* revision level */ avio_rb16(pb); /* revision level */
avio_rb32(pb); /* vendor */ avio_rb32(pb); /* vendor */
...@@ -1299,11 +1300,10 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) ...@@ -1299,11 +1300,10 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
/* codec_tag YV12 triggers an UV swap in rawdec.c */ /* codec_tag YV12 triggers an UV swap in rawdec.c */
if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
st->codec->codec_tag=MKTAG('I', '4', '2', '0'); st->codec->codec_tag=MKTAG('I', '4', '2', '0');
/* Flash Media Server streams files with Sorenson Spark and tag H263 */ /* Flash Media Server uses tag H263 with Sorenson Spark */
if (!memcmp(st->codec->codec_name, "Sorenson H263", 13) if (format == MKTAG('H','2','6','3') &&
&& format == MKTAG('H','2','6','3')) !memcmp(st->codec->codec_name, "Sorenson H263", 13))
id = AV_CODEC_ID_FLV1; st->codec->codec_id = AV_CODEC_ID_FLV1;
st->codec->codec_id = id;
st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */ st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */
color_table_id = avio_rb16(pb); /* colortable id */ color_table_id = avio_rb16(pb); /* colortable id */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment