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
164 os->bufsize = DECODER_BUFFER_SIZE;164 os->bufsize = DECODER_BUFFER_SIZE;
165 os->buf = av_malloc(os->bufsize);165 os->buf = av_malloc(os->bufsize);
166 os->header = -1;166 os->header = -1;
167 os->page_begin = 1;
167 168
168 st = av_new_stream (s, idx);169 st = av_new_stream (s, idx);
169 if (!st)170 if (!st)
@@ -241,12 +242,27 @@ ogg_read_page (AVFormatContext * s, int *str) · 71 unmodified lines
241 242
242 idx = ogg_find_stream (ogg, serial);243 idx = ogg_find_stream (ogg, serial);
243 if (idx < 0){244 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 }
244 idx = ogg_new_stream (s, serial);258 idx = ogg_new_stream (s, serial);
245 if (idx < 0)259 if (idx < 0)
246 return -1;260 return -1;
247 }261 }
248 262
249 os = ogg->streams + idx;263 os = ogg->streams + idx;
264 if (!(flags & OGG_FLAG_BOS))
265 os->page_begin = 0;
250 os->page_pos = avio_tell(bc) - 27;266 os->page_pos = avio_tell(bc) - 27;
251 267
252 if(os->psize > 0)268 if(os->psize > 0)
libavformat/oggdec.h+1−0
@@ -75,6 +75,7 @@ struct ogg_stream { · 74 unmodified lines
75 int incomplete; ///< whether we're expecting a continuation in the next page75 int incomplete; ///< whether we're expecting a continuation in the next page
76 int page_end; ///< current packet is the last one completed in the page76 int page_end; ///< current packet is the last one completed in the page
77 int keyframe_seek;77 int keyframe_seek;
78 int page_begin; ///< set to 1 if the stream only received a begin-of-stream packet, otherwise 0
78 void *private;79 void *private;
79};80};
80 81

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