This is not a bug report, but some barrier I met when I want to do some hack to mplayer. My goal is to get the info of all the a/v streams, such as how many audio/video streams in the file, and fps, sample rate, codec... of each stream. I found the demuxer may be the right place start to understand the overall. in the definition of demuxer_t(which is in demuxer.h) there are members of void* a_streams[MAX_A_STREAMS]; // audio streams (sh_audio_t) void* v_streams[MAX_V_STREAMS]; // video sterams (sh_video_t) each of them is an array of the sh_audio_t/sh_video_t pointers. so just before the playback, I added my code, which are for-loops to look into these arrays. sh_audio_t *a; int num =0; for (int i=0;i < MAX_A_STREAMS; i++) { if (a = demuxer[i]) { num++; printf("%d, aid:%d",i,a->aid); } } My questions are: 1. is there any way more direct to get the number of a/v streams and their infos, rather than a for loop? 2. if there is none... In the for-loop above, the loop will always run MAX_A_STREAMS times, is there any condition to judge so that I could exit the loop earlier? which means how I could make sure there is no sh_audio_t* anymore in the array. 3. I have tested my code at some level, I found that in the array, the valid sh_audio_t* does not always start at index 0 in the array. and the aid is also not always start from 0. for example: ------------------------ a mp4 file, which has only one audio stream: 1, aid:1 ------------------------ ------------------------ a mkv file, which has two audio streams: 2, aid:0 3, aid:1 ------------------------ so how really does the demuxer work with these ids?