comparison ogg2.c @ 755:27449ee55201 libavformat

support theora in ogg, plus required ogg core changes
author mru
date Wed, 11 May 2005 16:38:34 +0000
parents 9ae2511d1849
children 677bad57fca2
comparison
equal deleted inserted replaced
754:aa52767bb802 755:27449ee55201
37 #define MAX_PAGE_SIZE 65307 37 #define MAX_PAGE_SIZE 65307
38 #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE 38 #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
39 39
40 static ogg_codec_t *ogg_codecs[] = { 40 static ogg_codec_t *ogg_codecs[] = {
41 &vorbis_codec, 41 &vorbis_codec,
42 &theora_codec,
42 NULL 43 NULL
43 }; 44 };
44 45
45 #if 0 // CONFIG_ENCODERS 46 #if 0 // CONFIG_ENCODERS
46 static int 47 static int
423 } 424 }
424 425
425 static uint64_t 426 static uint64_t
426 ogg_gptopts (AVFormatContext * s, int i, uint64_t gp) 427 ogg_gptopts (AVFormatContext * s, int i, uint64_t gp)
427 { 428 {
429 ogg_t *ogg = s->priv_data;
430 ogg_stream_t *os = ogg->streams + i;
428 AVStream *st = s->streams[i]; 431 AVStream *st = s->streams[i];
429 AVCodecContext *codec = &st->codec; 432 AVCodecContext *codec = &st->codec;
430 uint64_t pts = AV_NOPTS_VALUE; 433 uint64_t pts = AV_NOPTS_VALUE;
431 434
432 if (codec->codec_type == CODEC_TYPE_AUDIO){ 435 if(os->codec->gptopts){
436 pts = os->codec->gptopts(s, i, gp);
437 } else if (codec->codec_type == CODEC_TYPE_AUDIO){
433 pts = gp * 1000000LL / codec->sample_rate; 438 pts = gp * 1000000LL / codec->sample_rate;
434 }else if (codec->codec_type == CODEC_TYPE_VIDEO){ 439 }else if (codec->codec_type == CODEC_TYPE_VIDEO){
435 //FIXME 440 pts = gp;
436 pts = gp * 1000000LL / codec->sample_rate;
437 // pts = gp * st->video.frame_rate.den * 27000000LL /
438 // st->video.frame_rate.num;
439 } 441 }
440 442
441 return pts; 443 return pts;
442 } 444 }
443 445
532 ogg_t *ogg = s->priv_data; 534 ogg_t *ogg = s->priv_data;
533 int i; 535 int i;
534 536
535 for (i = 0; i < ogg->nstreams; i++){ 537 for (i = 0; i < ogg->nstreams; i++){
536 av_free (ogg->streams[i].buf); 538 av_free (ogg->streams[i].buf);
539 av_free (ogg->streams[i].private);
537 av_freep (&s->streams[i]->codec.extradata); 540 av_freep (&s->streams[i]->codec.extradata);
538 } 541 }
539 av_free (ogg->streams); 542 av_free (ogg->streams);
540 return 0; 543 return 0;
541 } 544 }