comparison ogg.c @ 462:b69898ffc92a libavformat

move time_base (pts_num/pts_den) from AVFormatContext -> AVStream
author michael
date Fri, 21 May 2004 20:43:21 +0000
parents 7fa377b2f533
children 60f897e8dd2d
comparison
equal deleted inserted replaced
461:63540e5504f7 462:b69898ffc92a
34 { 34 {
35 OggContext *context = avfcontext->priv_data; 35 OggContext *context = avfcontext->priv_data;
36 ogg_packet *op= &context->op; 36 ogg_packet *op= &context->op;
37 int n, i; 37 int n, i;
38 38
39 av_set_pts_info(avfcontext, 60, 1, AV_TIME_BASE);
40
41 ogg_stream_init(&context->os, 31415); 39 ogg_stream_init(&context->os, 31415);
42 40
43 for(n = 0 ; n < avfcontext->nb_streams ; n++) { 41 for(n = 0 ; n < avfcontext->nb_streams ; n++) {
44 AVCodecContext *codec = &avfcontext->streams[n]->codec; 42 AVCodecContext *codec = &avfcontext->streams[n]->codec;
45 uint8_t *p= codec->extradata; 43 uint8_t *p= codec->extradata;
46 44
45 av_set_pts_info(avfcontext->streams[n], 60, 1, AV_TIME_BASE);
46
47 for(i=0; i < codec->extradata_size; i+= op->bytes){ 47 for(i=0; i < codec->extradata_size; i+= op->bytes){
48 op->bytes = p[i++]<<8; 48 op->bytes = p[i++]<<8;
49 op->bytes+= p[i++]; 49 op->bytes+= p[i++];
50 50
51 op->packet= &p[i]; 51 op->packet= &p[i];
170 AVCodecContext *codec; 170 AVCodecContext *codec;
171 uint8_t *p; 171 uint8_t *p;
172 int i; 172 int i;
173 173
174 avfcontext->ctx_flags |= AVFMTCTX_NOHEADER; 174 avfcontext->ctx_flags |= AVFMTCTX_NOHEADER;
175 av_set_pts_info(avfcontext, 60, 1, AV_TIME_BASE);
176 175
177 ogg_sync_init(&context->oy) ; 176 ogg_sync_init(&context->oy) ;
178 buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; 177 buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
179 178
180 if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) 179 if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0)
188 /* currently only one vorbis stream supported */ 187 /* currently only one vorbis stream supported */
189 188
190 ast = av_new_stream(avfcontext, 0) ; 189 ast = av_new_stream(avfcontext, 0) ;
191 if(!ast) 190 if(!ast)
192 return AVERROR_NOMEM ; 191 return AVERROR_NOMEM ;
192 av_set_pts_info(ast, 60, 1, AV_TIME_BASE);
193 193
194 codec= &ast->codec; 194 codec= &ast->codec;
195 codec->codec_type = CODEC_TYPE_AUDIO; 195 codec->codec_type = CODEC_TYPE_AUDIO;
196 codec->codec_id = CODEC_ID_VORBIS; 196 codec->codec_id = CODEC_ID_VORBIS;
197 for(i=0; i<3; i++){ 197 for(i=0; i<3; i++){