comparison libmpdemux/demux_avi.c @ 21404:896a8210ed9f

Make sure we do not hang if no streams are available
author reimar
date Fri, 01 Dec 2006 18:51:44 +0000
parents c91294804a0b
children a120cda87e3e
comparison
equal deleted inserted replaced
21403:c91294804a0b 21404:896a8210ed9f
773 return DEMUXER_CTRL_NOTIMPL; 773 return DEMUXER_CTRL_NOTIMPL;
774 774
775 if (*(int *)arg >= 0) 775 if (*(int *)arg >= 0)
776 ds->id = *(int *)arg; 776 ds->id = *(int *)arg;
777 else { 777 else {
778 int id = ds->id;
778 do { 779 do {
779 if (++ds->id >= maxid) ds->id = 0; 780 if (++id >= maxid) id = 0;
780 } while (!streams[ds->id]); 781 if (id == ds->id) // no streams available
782 return DEMUXER_CTRL_NOTIMPL;
783 } while (!streams[id]);
784 ds->id = id;
781 } 785 }
782 786
783 chunkid = (ds->id / 10 + '0') | (ds->id % 10 + '0') << 8; 787 chunkid = (ds->id / 10 + '0') | (ds->id % 10 + '0') << 8;
784 ds->sh = NULL; 788 ds->sh = NULL;
785 demux_avi_select_stream(demuxer, chunkid); 789 demux_avi_select_stream(demuxer, chunkid);