History

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

Romain Beauxis committed 1 year ago

Commit a9d39d61 parent 6d54af62 files · +15 −8Browse files

Unified · Split

2 files
  1. libavformat/oggdec.c +14 −8
  2. libavformat/oggdec.h +1 −0
libavformat/oggdec.c+14−8
@@ -605,20 +605,26 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, · 604 unmodified lines
605605 } else {
606606 os->pflags = 0;
607607 os->pduration = 0;
608+
609+ ret = 0;
608610 if (os->codec && os->codec->packet) {
609611 if ((ret = os->codec->packet(s, idx)) < 0) {
610612 av_log(s, AV_LOG_ERROR, "Packet processing failed: %s\n", av_err2str(ret));
611613 return ret;
612614 }
613615 }
614− if (sid)
615− *sid = idx;
616− if (dstart)
617− *dstart = os->pstart;
618− if (dsize)
619− *dsize = os->psize;
620− if (fpos)
621− *fpos = os->sync_pos;
616+
617+ if (!ret) {
618+ if (sid)
619+ *sid = idx;
620+ if (dstart)
621+ *dstart = os->pstart;
622+ if (dsize)
623+ *dsize = os->psize;
624+ if (fpos)
625+ *fpos = os->sync_pos;
626+ }
627+
622628 os->pstart += os->psize;
623629 os->psize = 0;
624630 if(os->pstart == os->bufpos)
libavformat/oggdec.h+1−0
@@ -43,6 +43,7 @@ struct ogg_codec { · 42 unmodified lines
4343 * @return < 0 (AVERROR) code or -1 on error
4444 * == 0 if the packet was a regular data packet.
4545 * == 0 or 1 if the packet was a header from a chained bitstream.
46+ * (1 will cause the packet to be skiped in calling code (ogg_packet())
4647 */
4748 int (*packet)(AVFormatContext *, int);
4849 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t