1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

libavformat/oggdec.{c, h}: Implement packet skip on packet return value of 1

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Romain Beauxis
2025-05-09 18:43:22 -05:00
committed by Michael Niedermayer
parent 6d54af6599
commit a9d39d6eb9
2 changed files with 15 additions and 8 deletions

View File

@@ -605,20 +605,26 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize,
} else { } else {
os->pflags = 0; os->pflags = 0;
os->pduration = 0; os->pduration = 0;
ret = 0;
if (os->codec && os->codec->packet) { if (os->codec && os->codec->packet) {
if ((ret = os->codec->packet(s, idx)) < 0) { if ((ret = os->codec->packet(s, idx)) < 0) {
av_log(s, AV_LOG_ERROR, "Packet processing failed: %s\n", av_err2str(ret)); av_log(s, AV_LOG_ERROR, "Packet processing failed: %s\n", av_err2str(ret));
return ret; return ret;
} }
} }
if (sid)
*sid = idx; if (!ret) {
if (dstart) if (sid)
*dstart = os->pstart; *sid = idx;
if (dsize) if (dstart)
*dsize = os->psize; *dstart = os->pstart;
if (fpos) if (dsize)
*fpos = os->sync_pos; *dsize = os->psize;
if (fpos)
*fpos = os->sync_pos;
}
os->pstart += os->psize; os->pstart += os->psize;
os->psize = 0; os->psize = 0;
if(os->pstart == os->bufpos) if(os->pstart == os->bufpos)

View File

@@ -43,6 +43,7 @@ struct ogg_codec {
* @return < 0 (AVERROR) code or -1 on error * @return < 0 (AVERROR) code or -1 on error
* == 0 if the packet was a regular data packet. * == 0 if the packet was a regular data packet.
* == 0 or 1 if the packet was a header from a chained bitstream. * == 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); int (*packet)(AVFormatContext *, int);
/** /**