Commit ccd2a2fe authored by conrad's avatar conrad

Fix regression introduced in 8c2da1

When using a recent liboggz, liboggplay fails to play some files. It
appears it's only files with Kate streams, however some files with
Kate streams do play fine, but liboggplay reports unknown
category/language, so that's probably still failing, but in a way that
liboggplay can recover from.

A sample file which worked before and does not work now is the good old:
This file is seen as correct by oggz-validate.


* when oggz_read() sees the first few packets before it sees a
granulepos, it buffers them in a dlist
* then, oggz_read_deliver_packet() is a dlist callback which goes
through these buffered packets and calls the read callback for each
* the commit you found by bisection returns an error if the
read_callback returns non-zero; previously the read_callback return
values were ignored
* liboggplay's read_predetected(), the read_callback in use during
stream detection, returns 1 (OGGZ_STOP_OK) when it has done what it
needs to do

... hence, the STOP_OK value gets turned into an error value by the
bad commit.

Signed-off-by: conrad's avatarConrad Parker <>
parent 5ed43da6
......@@ -290,6 +290,7 @@ oggz_read_deliver_packet(void *elem) {
OggzBufferedPacket *p = (OggzBufferedPacket *)elem;
ogg_int64_t gp_stored;
ogg_int64_t unit_stored;
int cb_ret;
if (p->calced_granulepos == -1) {
......@@ -304,13 +305,17 @@ oggz_read_deliver_packet(void *elem) {
oggz_get_unit (p->oggz, p->serialno, p->calced_granulepos);
if (p->stream->read_packet) {
if (p->stream->read_packet(p->oggz, &(p->packet), p->serialno,
p->stream->read_user_data) != 0) {
if ((cb_ret = p->stream->read_packet(p->oggz, &(p->packet), p->serialno,
p->stream->read_user_data)) != 0) {
p->oggz->cb_next = cb_ret;
if (cb_ret == -1)
} else if (p->reader->read_packet) {
if (p->reader->read_packet(p->oggz, &(p->packet), p->serialno,
p->reader->read_user_data) != 0) {
if ((cb_ret = p->reader->read_packet(p->oggz, &(p->packet), p->serialno,
p->reader->read_user_data)) != 0) {
p->oggz->cb_next = cb_ret;
if (cb_ret == -1)
......@@ -464,9 +469,16 @@ oggz_read_sync (OGGZ * oggz)
ogg_int64_t gp_stored = stream->last_granulepos;
stream->last_packet = &packet;
oggz_dlist_reverse_iter(oggz->packet_buffer, oggz_read_update_gp);
oggz->cb_next = 0;
if (oggz_dlist_deliter(oggz->packet_buffer, oggz_read_deliver_packet) == -1) {
if (oggz->cb_next > 0) {
cb_ret = oggz->cb_next;
oggz->cb_next = 0;
oggz->cb_next = 0;
* fix up the stream granulepos
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment