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
605 } else {605 } else {
606 os->pflags = 0;606 os->pflags = 0;
607 os->pduration = 0;607 os->pduration = 0;
608
609 ret = 0;
608 if (os->codec && os->codec->packet) {610 if (os->codec && os->codec->packet) {
609 if ((ret = os->codec->packet(s, idx)) < 0) {611 if ((ret = os->codec->packet(s, idx)) < 0) {
610 av_log(s, AV_LOG_ERROR, "Packet processing failed: %s\n", av_err2str(ret));612 av_log(s, AV_LOG_ERROR, "Packet processing failed: %s\n", av_err2str(ret));
611 return ret;613 return ret;
612 }614 }
613 }615 }
614 if (sid)616
615 *sid = idx;617 if (!ret) {
616 if (dstart)618 if (sid)
617 *dstart = os->pstart;619 *sid = idx;
618 if (dsize)620 if (dstart)
619 *dsize = os->psize;621 *dstart = os->pstart;
620 if (fpos)622 if (dsize)
621 *fpos = os->sync_pos;623 *dsize = os->psize;
624 if (fpos)
625 *fpos = os->sync_pos;
626 }
627
622 os->pstart += os->psize;628 os->pstart += os->psize;
623 os->psize = 0;629 os->psize = 0;
624 if(os->pstart == os->bufpos)630 if(os->pstart == os->bufpos)
libavformat/oggdec.h+1−0
@@ -43,6 +43,7 @@ struct ogg_codec { · 42 unmodified lines
43 * @return < 0 (AVERROR) code or -1 on error43 * @return < 0 (AVERROR) code or -1 on error
44 * == 0 if the packet was a regular data packet.44 * == 0 if the packet was a regular data packet.
45 * == 0 or 1 if the packet was a header from a chained bitstream.45 * == 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())
46 */47 */
47 int (*packet)(AVFormatContext *, int);48 int (*packet)(AVFormatContext *, int);
48 /**49 /**

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