aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Beauxis <romain.beauxis@gmail.com>2025-05-09 18:43:22 -0500
committerMichael Niedermayer <michael@niedermayer.cc>2025-05-15 03:03:53 +0200
commita9d39d6eb935a9cd96e9cb5fc10e7ba60abdff90 (patch)
treea8d1b93ccffbc8ebac515abfc6e9224befc58ea5
parent6d54af6599cae41f0948eb84ece4a57ffe3a73a6 (diff)
downloadffmpeg-a9d39d6eb935a9cd96e9cb5fc10e7ba60abdff90.tar.gz
libavformat/oggdec.{c, h}: Implement packet skip on packet return value of 1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/oggdec.c22
-rw-r--r--libavformat/oggdec.h1
2 files changed, 15 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 5225b77a07..bc670d0f1e 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -43,6 +43,7 @@ struct ogg_codec {
* @return < 0 (AVERROR) code or -1 on error
* == 0 if the packet was a regular data packet.
* == 0 or 1 if the packet was a header from a chained bitstream.
+ * (1 will cause the packet to be skiped in calling code (ogg_packet())
*/
int (*packet)(AVFormatContext *, int);
/**