Skip to content

Commit 055b782

Browse files
Merge pull request #43 from madphysicist/patch-1
Selecting the first video stream in HelloWorld
2 parents cdd616c + 4a746e3 commit 055b782

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

0_hello_world.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ int main(int argc, const char *argv[])
105105

106106
// when the stream is a video we store its index, codec parameters and codec
107107
if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) {
108-
video_stream_index = i;
109-
pCodec = pLocalCodec;
110-
pCodecParameters = pLocalCodecParameters;
108+
if (video_stream_index == -1) {
109+
video_stream_index = i;
110+
pCodec = pLocalCodec;
111+
pCodecParameters = pLocalCodecParameters;
112+
}
111113

112114
logging("Video Codec: resolution %d x %d", pLocalCodecParameters->width, pLocalCodecParameters->height);
113115
} else if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_AUDIO) {

0 commit comments

Comments
 (0)