From c655acffb8d9acc97e19553c2e464c0d78586063 Mon Sep 17 00:00:00 2001
From: Dave Rice <dave@dericed.com>
Date: Wed, 13 May 2015 13:38:29 -0400
Subject: [PATCH] ffprobe: print stream_index with frame data

otherwise the frame data can't be associated back to its stream. This
makes it easier to work with data from multi-track outputs such as:
ffprobe -f lavfi
movie=1video_3audio.mov:s=v+a+a+a[out0][out1][out2][out3] -show_streams
-show_frames
---
 doc/ffprobe.xsd | 1 +
 ffprobe.c       | 1 +
 2 files changed, 2 insertions(+)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index d473c9b..5e0f9a9 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -86,6 +86,7 @@
             <xsd:element name="side_data_list" type="ffprobe:frameSideDataListType"   minOccurs="0" maxOccurs="1" />
       </xsd:sequence>
 
+      <xsd:attribute name="stream_index"  type="xsd:int"/>
       <xsd:attribute name="media_type"    type="xsd:string" use="required"/>
       <xsd:attribute name="key_frame"     type="xsd:int"    use="required"/>
       <xsd:attribute name="pts"           type="xsd:long" />
diff --git a/ffprobe.c b/ffprobe.c
index fadcd93..8ee97f5 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1822,6 +1822,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
     writer_print_section_header(w, SECTION_ID_FRAME);
 
     s = av_get_media_type_string(stream->codec->codec_type);
+    print_int ("stream_index",          stream->index);
     if (s) print_str    ("media_type", s);
     else   print_str_opt("media_type", "unknown");
     print_int("key_frame",              frame->key_frame);
-- 
2.3.5

