|
@@ -1264,7 +1264,7 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int ff_find_stream_index(AVFormatContext *s, int id)
|
|
|
|
|
|
|
+int ff_find_stream_index(const AVFormatContext *s, int id)
|
|
|
{
|
|
{
|
|
|
for (unsigned i = 0; i < s->nb_streams; i++)
|
|
for (unsigned i = 0; i < s->nb_streams; i++)
|
|
|
if (s->streams[i]->id == id)
|
|
if (s->streams[i]->id == id)
|
|
@@ -1407,8 +1407,9 @@ AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *f
|
|
|
* 0 if st is NOT a matching stream
|
|
* 0 if st is NOT a matching stream
|
|
|
* >0 if st is a matching stream
|
|
* >0 if st is a matching stream
|
|
|
*/
|
|
*/
|
|
|
-static int match_stream_specifier(AVFormatContext *s, AVStream *st,
|
|
|
|
|
- const char *spec, const char **indexptr, AVProgram **p)
|
|
|
|
|
|
|
+static int match_stream_specifier(const AVFormatContext *s, const AVStream *st,
|
|
|
|
|
+ const char *spec, const char **indexptr,
|
|
|
|
|
+ const AVProgram **p)
|
|
|
{
|
|
{
|
|
|
int match = 1; /* Stores if the specifier matches so far. */
|
|
int match = 1; /* Stores if the specifier matches so far. */
|
|
|
while (*spec) {
|
|
while (*spec) {
|
|
@@ -1475,7 +1476,7 @@ static int match_stream_specifier(AVFormatContext *s, AVStream *st,
|
|
|
return AVERROR(EINVAL);
|
|
return AVERROR(EINVAL);
|
|
|
return match && (stream_id == st->id);
|
|
return match && (stream_id == st->id);
|
|
|
} else if (*spec == 'm' && *(spec + 1) == ':') {
|
|
} else if (*spec == 'm' && *(spec + 1) == ':') {
|
|
|
- AVDictionaryEntry *tag;
|
|
|
|
|
|
|
+ const AVDictionaryEntry *tag;
|
|
|
char *key, *val;
|
|
char *key, *val;
|
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
|
@@ -1500,7 +1501,7 @@ static int match_stream_specifier(AVFormatContext *s, AVStream *st,
|
|
|
}
|
|
}
|
|
|
return match && ret;
|
|
return match && ret;
|
|
|
} else if (*spec == 'u' && *(spec + 1) == '\0') {
|
|
} else if (*spec == 'u' && *(spec + 1) == '\0') {
|
|
|
- AVCodecParameters *par = st->codecpar;
|
|
|
|
|
|
|
+ const AVCodecParameters *par = st->codecpar;
|
|
|
int val;
|
|
int val;
|
|
|
switch (par->codec_type) {
|
|
switch (par->codec_type) {
|
|
|
case AVMEDIA_TYPE_AUDIO:
|
|
case AVMEDIA_TYPE_AUDIO:
|
|
@@ -1536,7 +1537,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
|
|
|
int ret, index;
|
|
int ret, index;
|
|
|
char *endptr;
|
|
char *endptr;
|
|
|
const char *indexptr = NULL;
|
|
const char *indexptr = NULL;
|
|
|
- AVProgram *p = NULL;
|
|
|
|
|
|
|
+ const AVProgram *p = NULL;
|
|
|
int nb_streams;
|
|
int nb_streams;
|
|
|
|
|
|
|
|
ret = match_stream_specifier(s, st, spec, &indexptr, &p);
|
|
ret = match_stream_specifier(s, st, spec, &indexptr, &p);
|
|
@@ -1559,7 +1560,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
|
|
|
/* If we requested a matching stream index, we have to ensure st is that. */
|
|
/* If we requested a matching stream index, we have to ensure st is that. */
|
|
|
nb_streams = p ? p->nb_stream_indexes : s->nb_streams;
|
|
nb_streams = p ? p->nb_stream_indexes : s->nb_streams;
|
|
|
for (int i = 0; i < nb_streams && index >= 0; i++) {
|
|
for (int i = 0; i < nb_streams && index >= 0; i++) {
|
|
|
- AVStream *candidate = p ? s->streams[p->stream_index[i]] : s->streams[i];
|
|
|
|
|
|
|
+ const AVStream *candidate = s->streams[p ? p->stream_index[i] : i];
|
|
|
ret = match_stream_specifier(s, candidate, spec, NULL, NULL);
|
|
ret = match_stream_specifier(s, candidate, spec, NULL, NULL);
|
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
|
goto error;
|
|
goto error;
|