Commit 57580e2a authored by Marton Balint's avatar Marton Balint

avformat/utils: fix indentation

Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent d4ae28e4
...@@ -5111,147 +5111,147 @@ static int match_stream_specifier(AVFormatContext *s, AVStream *st, ...@@ -5111,147 +5111,147 @@ static int match_stream_specifier(AVFormatContext *s, AVStream *st,
{ {
int match = 1; /* Stores if the specifier matches so far. */ int match = 1; /* Stores if the specifier matches so far. */
while (*spec) { while (*spec) {
if (*spec <= '9' && *spec >= '0') { /* opt:index */ if (*spec <= '9' && *spec >= '0') { /* opt:index */
if (indexptr) if (indexptr)
*indexptr = spec; *indexptr = spec;
return match; return match;
} else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' || } else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||
*spec == 't' || *spec == 'V') { /* opt:[vasdtV] */ *spec == 't' || *spec == 'V') { /* opt:[vasdtV] */
enum AVMediaType type; enum AVMediaType type;
int nopic = 0; int nopic = 0;
switch (*spec++) { switch (*spec++) {
case 'v': type = AVMEDIA_TYPE_VIDEO; break; case 'v': type = AVMEDIA_TYPE_VIDEO; break;
case 'a': type = AVMEDIA_TYPE_AUDIO; break; case 'a': type = AVMEDIA_TYPE_AUDIO; break;
case 's': type = AVMEDIA_TYPE_SUBTITLE; break; case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': type = AVMEDIA_TYPE_DATA; break; case 'd': type = AVMEDIA_TYPE_DATA; break;
case 't': type = AVMEDIA_TYPE_ATTACHMENT; break; case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
case 'V': type = AVMEDIA_TYPE_VIDEO; nopic = 1; break; case 'V': type = AVMEDIA_TYPE_VIDEO; nopic = 1; break;
default: av_assert0(0); default: av_assert0(0);
} }
if (*spec && *spec++ != ':') /* If we are not at the end, then another specifier must follow. */ if (*spec && *spec++ != ':') /* If we are not at the end, then another specifier must follow. */
return AVERROR(EINVAL); return AVERROR(EINVAL);
#if FF_API_LAVF_AVCTX #if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS FF_DISABLE_DEPRECATION_WARNINGS
if (type != st->codecpar->codec_type if (type != st->codecpar->codec_type
&& (st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN || st->codec->codec_type != type)) && (st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN || st->codec->codec_type != type))
match = 0; match = 0;
FF_ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
#else #else
if (type != st->codecpar->codec_type) if (type != st->codecpar->codec_type)
match = 0; match = 0;
#endif #endif
if (nopic && (st->disposition & AV_DISPOSITION_ATTACHED_PIC)) if (nopic && (st->disposition & AV_DISPOSITION_ATTACHED_PIC))
match = 0; match = 0;
} else if (*spec == 'p' && *(spec + 1) == ':') { } else if (*spec == 'p' && *(spec + 1) == ':') {
int prog_id, i, j; int prog_id, i, j;
int found = 0; int found = 0;
char *endptr; char *endptr;
spec += 2; spec += 2;
prog_id = strtol(spec, &endptr, 0); prog_id = strtol(spec, &endptr, 0);
/* Disallow empty id and make sure that if we are not at the end, then another specifier must follow. */ /* Disallow empty id and make sure that if we are not at the end, then another specifier must follow. */
if (spec == endptr || (*endptr && *endptr++ != ':')) if (spec == endptr || (*endptr && *endptr++ != ':'))
return AVERROR(EINVAL); return AVERROR(EINVAL);
spec = endptr; spec = endptr;
if (match) { if (match) {
for (i = 0; i < s->nb_programs; i++) { for (i = 0; i < s->nb_programs; i++) {
if (s->programs[i]->id != prog_id) if (s->programs[i]->id != prog_id)
continue; continue;
for (j = 0; j < s->programs[i]->nb_stream_indexes; j++) { for (j = 0; j < s->programs[i]->nb_stream_indexes; j++) {
if (st->index == s->programs[i]->stream_index[j]) { if (st->index == s->programs[i]->stream_index[j]) {
found = 1; found = 1;
i = s->nb_programs; i = s->nb_programs;
break; break;
}
}
} }
} }
} if (!found)
} match = 0;
if (!found) } else if (*spec == '#' ||
match = 0; (*spec == 'i' && *(spec + 1) == ':')) {
} else if (*spec == '#' || int stream_id;
(*spec == 'i' && *(spec + 1) == ':')) { char *endptr;
int stream_id; spec += 1 + (*spec == 'i');
char *endptr; stream_id = strtol(spec, &endptr, 0);
spec += 1 + (*spec == 'i'); if (spec == endptr || *endptr) /* Disallow empty id and make sure we are at the end. */
stream_id = strtol(spec, &endptr, 0); return AVERROR(EINVAL);
if (spec == endptr || *endptr) /* Disallow empty id and make sure we are at the end. */ return match && (stream_id == st->id);
return AVERROR(EINVAL); } else if (*spec == 'm' && *(spec + 1) == ':') {
return match && (stream_id == st->id); AVDictionaryEntry *tag;
} else if (*spec == 'm' && *(spec + 1) == ':') { char *key, *val;
AVDictionaryEntry *tag; int ret;
char *key, *val;
int ret; if (match) {
spec += 2;
if (match) { val = strchr(spec, ':');
spec += 2;
val = strchr(spec, ':'); key = val ? av_strndup(spec, val - spec) : av_strdup(spec);
if (!key)
key = val ? av_strndup(spec, val - spec) : av_strdup(spec); return AVERROR(ENOMEM);
if (!key)
return AVERROR(ENOMEM); tag = av_dict_get(st->metadata, key, NULL, 0);
if (tag) {
tag = av_dict_get(st->metadata, key, NULL, 0); if (!val || !strcmp(tag->value, val + 1))
if (tag) { ret = 1;
if (!val || !strcmp(tag->value, val + 1)) else
ret = 1; ret = 0;
else } else
ret = 0; ret = 0;
} else
ret = 0; av_freep(&key);
}
av_freep(&key); return match && ret;
} } else if (*spec == 'u' && *(spec + 1) == '\0') {
return match && ret; AVCodecParameters *par = st->codecpar;
} else if (*spec == 'u' && *(spec + 1) == '\0') {
AVCodecParameters *par = st->codecpar;
#if FF_API_LAVF_AVCTX #if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS FF_DISABLE_DEPRECATION_WARNINGS
AVCodecContext *codec = st->codec; AVCodecContext *codec = st->codec;
FF_ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
#endif #endif
int val; int val;
switch (par->codec_type) { switch (par->codec_type) {
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
val = par->sample_rate && par->channels; val = par->sample_rate && par->channels;
#if FF_API_LAVF_AVCTX #if FF_API_LAVF_AVCTX
val = val || (codec->sample_rate && codec->channels); val = val || (codec->sample_rate && codec->channels);
#endif #endif
if (par->format == AV_SAMPLE_FMT_NONE if (par->format == AV_SAMPLE_FMT_NONE
#if FF_API_LAVF_AVCTX #if FF_API_LAVF_AVCTX
&& codec->sample_fmt == AV_SAMPLE_FMT_NONE && codec->sample_fmt == AV_SAMPLE_FMT_NONE
#endif #endif
) )
return 0; return 0;
break; break;
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
val = par->width && par->height; val = par->width && par->height;
#if FF_API_LAVF_AVCTX #if FF_API_LAVF_AVCTX
val = val || (codec->width && codec->height); val = val || (codec->width && codec->height);
#endif #endif
if (par->format == AV_PIX_FMT_NONE if (par->format == AV_PIX_FMT_NONE
#if FF_API_LAVF_AVCTX #if FF_API_LAVF_AVCTX
&& codec->pix_fmt == AV_PIX_FMT_NONE && codec->pix_fmt == AV_PIX_FMT_NONE
#endif #endif
) )
return 0; return 0;
break; break;
case AVMEDIA_TYPE_UNKNOWN: case AVMEDIA_TYPE_UNKNOWN:
val = 0; val = 0;
break; break;
default: default:
val = 1; val = 1;
break; break;
} }
#if FF_API_LAVF_AVCTX #if FF_API_LAVF_AVCTX
return match && ((par->codec_id != AV_CODEC_ID_NONE || codec->codec_id != AV_CODEC_ID_NONE) && val != 0); return match && ((par->codec_id != AV_CODEC_ID_NONE || codec->codec_id != AV_CODEC_ID_NONE) && val != 0);
#else #else
return match && (par->codec_id != AV_CODEC_ID_NONE && val != 0); return match && (par->codec_id != AV_CODEC_ID_NONE && val != 0);
#endif #endif
} else { } else {
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
} }
return match; return match;
......
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