Originally committed as revision 26092 to svn://svn.ffmpeg.org/ffmpeg/trunk
#include "libavutil/common.h"
#include "avformat.h"
+#include "internal.h"
#include "gxf.h"
struct gxf_stream_info {
static int get_sindex(AVFormatContext *s, int id, int format) {
int i;
AVStream *st = NULL;
- for (i = 0; i < s->nb_streams; i++) {
- if (s->streams[i]->id == id)
- return i;
- }
+ i = ff_find_stream_index(s, id);
+ if (i >= 0)
+ return i;
st = av_new_stream(s, id);
if (!st)
return AVERROR(ENOMEM);
void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
void *context);
+/**
+ * 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);
+
#endif /* AVFORMAT_INTERNAL_H */
}
}
+int ff_find_stream_index(AVFormatContext *s, int id)
+{
+ int i;
+ for (i = 0; i < s->nb_streams; i++) {
+ if (s->streams[i]->id == id)
+ return i;
+ }
+ return -1;
+}