aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAlexander Strasser <eclipse7@gmx.net>2005-08-15 20:42:56 +0000
committerAlexander Strasser <eclipse7@gmx.net>2005-08-15 20:42:56 +0000
commit30545b2f479935e6a78231788b47b0a52538993f (patch)
treef234c256f9ff4ce69023c7f6f77f907e0e027f7e /libavformat
parent7cbaa7bafa16b572aaae692722a9f8db90b65cb8 (diff)
downloadffmpeg-30545b2f479935e6a78231788b47b0a52538993f.tar.gz
Make ogg `muxer' expect new vorbis extradata format.
This makes for example encoding vorbis in ogg again. Originally committed as revision 4528 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/ogg.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/libavformat/ogg.c b/libavformat/ogg.c
index b2767a22d5..861596cc0d 100644
--- a/libavformat/ogg.c
+++ b/libavformat/ogg.c
@@ -40,15 +40,32 @@ static int ogg_write_header(AVFormatContext *avfcontext)
for(n = 0 ; n < avfcontext->nb_streams ; n++) {
AVCodecContext *codec = avfcontext->streams[n]->codec;
- uint8_t *p= codec->extradata;
+ uint8_t *headers = codec->extradata;
+ int headers_len = codec->extradata_size;
+ uint8_t *header_start[3];
+ int header_len[3];
+ int i, j, hdr_type;
av_set_pts_info(avfcontext->streams[n], 60, 1, AV_TIME_BASE);
- for(i=0; i < codec->extradata_size; i+= op->bytes){
- op->bytes = p[i++]<<8;
- op->bytes+= p[i++];
+ for(j=1,i=0;i<2;++i, ++j) {
+ header_len[i]=0;
+ while(j<headers_len && headers[j]==0xff) {
+ header_len[i]+=0xff;
+ ++j;
+ }
+ header_len[i]+=headers[j];
+ }
+ header_len[2]=headers_len-header_len[0]-header_len[1]-j;
+ headers+=j;
+ header_start[0] = headers;
+ header_start[1] = header_start[0] + header_len[0];
+ header_start[2] = header_start[1] + header_len[1];
+
+ for(i=0; i < 3; ++i){
+ op->bytes = header_len[i];
- op->packet= &p[i];
+ op->packet= header_start[i];
op->b_o_s= op->packetno==0;
ogg_stream_packetin(&context->os, op);