2009/12/27 Reimar D?ffinger <Reimar.Doeffinger at gmx.de> [...]
+ yop->stream ^= 1;
I think it might be better to do this without extra state, e.g. just check if video_packet.buffer is != NULL?
Did you mean video_packet.data? If so, I don't understand how it can be done since data isn't freed after each read. Could you please elaborate?
+ if (!yop->stream) { + ret = av_new_packet(&yop->video_packet, + yop->frame_size - yop->sound_chunk_length); + if (ret < 0) + return ret; + + yop->video_packet.pos = url_ftell(pb); + ret = get_buffer(pb, yop->video_packet.data, palette_size); + if (ret < 0) { + return ret; + } else if (ret < palette_size) { + yop_free_packets(yop); + return AVERROR_EOF; + }
Please use "goto err_out" instead of duplicating the freeing code.
Duplication removed by rearranging code.
+ // 1840 samples per frame, 1 nibble per sample; hence 1840/2 = 920 + ret = av_get_packet(pb, &yop->sound_packet, 920); + if (ret < 920) { + yop_free_packets(yop); + return AVERROR_EOF; + }
Please return partial data where ever it makes even remotely sense. The decoder should decide what to do with incomplete/broken data, not the demuxer (since the demuxer just can't do anything sensible about it).
Fixed. Partial data is now returned for both audio & video packets (except when palette read fails). [...] Other issues have been fixed. Naufal