--- libavformat/oggdec.c | 22 ++++++++++++++-------- libavformat/oggdec.h | 6 ++++++ 2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 5339fdd32c..9baf8040a9 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -605,20 +605,26 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, } else { os->pflags = 0; os->pduration = 0; + + ret = 0; if (os->codec && os->codec->packet) { if ((ret = os->codec->packet(s, idx)) < 0) { av_log(s, AV_LOG_ERROR, "Packet processing failed: %s\n", av_err2str(ret)); return ret; } } - if (sid) - *sid = idx; - if (dstart) - *dstart = os->pstart; - if (dsize) - *dsize = os->psize; - if (fpos) - *fpos = os->sync_pos; + + if (!ret) { + if (sid) + *sid = idx; + if (dstart) + *dstart = os->pstart; + if (dsize) + *dsize = os->psize; + if (fpos) + *fpos = os->sync_pos; + } + os->pstart += os->psize; os->psize = 0; if(os->pstart == os->bufpos) diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h index 43df23f4cb..09f698f99a 100644 --- a/libavformat/oggdec.h +++ b/libavformat/oggdec.h @@ -38,6 +38,12 @@ struct ogg_codec { * -1 if an error occurred or for unsupported stream */ int (*header)(AVFormatContext *, int); + /** + * Attempt to process a packet as a data packet + * @return 1 if the packet was a header from a chained bitstream. + * 0 if the packet was a regular data packet. + * -1 if an error occurred or for unsupported stream + */ int (*packet)(AVFormatContext *, int); /** * Translate a granule into a timestamp. -- 2.39.5 (Apple Git-154) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".