summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/internal.h2
-rw-r--r--libavformat/utils.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/libavformat/internal.h b/libavformat/internal.h
index f43e408548..878c4f1164 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -630,7 +630,7 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
* Find stream index based on format-specific stream ID
* @return stream index, or < 0 on error
*/
-int ff_find_stream_index(AVFormatContext *s, int id);
+int ff_find_stream_index(const AVFormatContext *s, int id);
/**
* Internal version of av_index_search_timestamp
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5b4156cad8..c368b60864 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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++)
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 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. */
while (*spec) {
@@ -1475,7 +1476,7 @@ static int match_stream_specifier(AVFormatContext *s, AVStream *st,
return AVERROR(EINVAL);
return match && (stream_id == st->id);
} else if (*spec == 'm' && *(spec + 1) == ':') {
- AVDictionaryEntry *tag;
+ const AVDictionaryEntry *tag;
char *key, *val;
int ret;
@@ -1500,7 +1501,7 @@ static int match_stream_specifier(AVFormatContext *s, AVStream *st,
}
return match && ret;
} else if (*spec == 'u' && *(spec + 1) == '\0') {
- AVCodecParameters *par = st->codecpar;
+ const AVCodecParameters *par = st->codecpar;
int val;
switch (par->codec_type) {
case AVMEDIA_TYPE_AUDIO:
@@ -1536,7 +1537,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
int ret, index;
char *endptr;
const char *indexptr = NULL;
- AVProgram *p = NULL;
+ const AVProgram *p = NULL;
int nb_streams;
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. */
nb_streams = p ? p->nb_stream_indexes : s->nb_streams;
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);
if (ret < 0)
goto error;