History

oggdec: fix demuxing chained audio streams

Chained ogg served by icecast and mpd should demux properly now. Fixes issue2337

Clément Bœsch committed 15 years ago

Commit 47dec301 parent cbfa93a2 files · +17 −0Browse files

Unified · Split

2 files
  1. libavformat/oggdec.c +16 −0
  2. libavformat/oggdec.h +1 −0
libavformat/oggdec.c+16−0
@@ -164,6 +164,7 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial) · 163 unmodified lines
164164 os->bufsize = DECODER_BUFFER_SIZE;
165165 os->buf = av_malloc(os->bufsize);
166166 os->header = -1;
167+ os->page_begin = 1;
167168
168169 st = av_new_stream (s, idx);
169170 if (!st)
@@ -241,12 +242,27 @@ ogg_read_page (AVFormatContext * s, int *str) · 71 unmodified lines
241242
242243 idx = ogg_find_stream (ogg, serial);
243244 if (idx < 0){
245+ for (i = 0; i < ogg->nstreams; i++) {
246+ if (!ogg->streams[i].page_begin) {
247+ int n;
248+
249+ for (n = 0; n < ogg->nstreams; n++) {
250+ av_free(ogg->streams[n].buf);
251+ av_free(ogg->streams[n].private);
252+ }
253+ ogg->curidx = -1;
254+ ogg->nstreams = 0;
255+ break;
256+ }
257+ }
244258 idx = ogg_new_stream (s, serial);
245259 if (idx < 0)
246260 return -1;
247261 }
248262
249263 os = ogg->streams + idx;
264+ if (!(flags & OGG_FLAG_BOS))
265+ os->page_begin = 0;
250266 os->page_pos = avio_tell(bc) - 27;
251267
252268 if(os->psize > 0)
libavformat/oggdec.h+1−0
@@ -75,6 +75,7 @@ struct ogg_stream { · 74 unmodified lines
7575 int incomplete; ///< whether we're expecting a continuation in the next page
7676 int page_end; ///< current packet is the last one completed in the page
7777 int keyframe_seek;
78+ int page_begin; ///< set to 1 if the stream only received a begin-of-stream packet, otherwise 0
7879 void *private;
7980 };
8081

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