summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-20 19:55:44 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-20 20:15:40 +0100
commit50255b7a865f0dd4fecf8d1e337f96b92b4b406e (patch)
tree56c4827a3de1357eaca5704a17f1303795198269 /libavformat
parent60b9373dbd52bba91d2286d5f8a1366090a9df08 (diff)
parent342fc46c69199b076b7c210f42208ce39a2bde1c (diff)
Merge commit '342fc46c69199b076b7c210f42208ce39a2bde1c'
* commit '342fc46c69199b076b7c210f42208ce39a2bde1c': cmdutils: Add a stream specifier to map usable streams Conflicts: cmdutils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 17ae300a8f..6a0f666a7d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4287,6 +4287,28 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
av_freep(&key);
return ret;
+ } else if (*spec == 'u') {
+ AVCodecContext *avctx = st->codec;
+ int val;
+ switch (avctx->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ val = avctx->sample_rate && avctx->channels;
+ if (avctx->sample_fmt == AV_SAMPLE_FMT_NONE)
+ return 0;
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ val = avctx->width && avctx->height;
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE)
+ return 0;
+ break;
+ case AVMEDIA_TYPE_UNKNOWN:
+ val = 0;
+ break;
+ default:
+ val = 1;
+ break;
+ }
+ return avctx->codec_id != AV_CODEC_ID_NONE && val != 0;
} else if (!*spec) /* empty specifier, matches everything */
return 1;