Mercurial > libavformat.hg
comparison oggparsetheora.c @ 820:feca73904e67 libavformat
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
author | michael |
---|---|
date | Sun, 17 Jul 2005 22:24:36 +0000 |
parents | 7bbe565d50db |
children | da1d5db0ce5c |
comparison
equal
deleted
inserted
replaced
819:a6c035e7f429 | 820:feca73904e67 |
---|---|
38 { | 38 { |
39 ogg_t *ogg = s->priv_data; | 39 ogg_t *ogg = s->priv_data; |
40 ogg_stream_t *os = ogg->streams + idx; | 40 ogg_stream_t *os = ogg->streams + idx; |
41 AVStream *st = s->streams[idx]; | 41 AVStream *st = s->streams[idx]; |
42 theora_params_t *thp = os->private; | 42 theora_params_t *thp = os->private; |
43 int cds = st->codec.extradata_size + os->psize + 2; | 43 int cds = st->codec->extradata_size + os->psize + 2; |
44 uint8_t *cdp; | 44 uint8_t *cdp; |
45 | 45 |
46 if(!(os->buf[os->pstart] & 0x80)) | 46 if(!(os->buf[os->pstart] & 0x80)) |
47 return 0; | 47 return 0; |
48 | 48 |
60 return -1; | 60 return -1; |
61 if(get_bits(&gb, 8) != 2) /* minor version */ | 61 if(get_bits(&gb, 8) != 2) /* minor version */ |
62 return -1; | 62 return -1; |
63 skip_bits(&gb, 8); /* revision */ | 63 skip_bits(&gb, 8); /* revision */ |
64 | 64 |
65 st->codec.width = get_bits(&gb, 16) << 4; | 65 st->codec->width = get_bits(&gb, 16) << 4; |
66 st->codec.height = get_bits(&gb, 16) << 4; | 66 st->codec->height = get_bits(&gb, 16) << 4; |
67 | 67 |
68 skip_bits(&gb, 64); | 68 skip_bits(&gb, 64); |
69 st->codec.time_base.den = get_bits(&gb, 32); | 69 st->codec->time_base.den = get_bits(&gb, 32); |
70 st->codec.time_base.num = get_bits(&gb, 32); | 70 st->codec->time_base.num = get_bits(&gb, 32); |
71 | 71 |
72 st->codec.sample_aspect_ratio.num = get_bits(&gb, 24); | 72 st->codec->sample_aspect_ratio.num = get_bits(&gb, 24); |
73 st->codec.sample_aspect_ratio.den = get_bits(&gb, 24); | 73 st->codec->sample_aspect_ratio.den = get_bits(&gb, 24); |
74 | 74 |
75 skip_bits(&gb, 38); | 75 skip_bits(&gb, 38); |
76 thp->gpshift = get_bits(&gb, 5); | 76 thp->gpshift = get_bits(&gb, 5); |
77 thp->gpmask = (1 << thp->gpshift) - 1; | 77 thp->gpmask = (1 << thp->gpshift) - 1; |
78 | 78 |
79 st->codec.codec_type = CODEC_TYPE_VIDEO; | 79 st->codec->codec_type = CODEC_TYPE_VIDEO; |
80 st->codec.codec_id = CODEC_ID_THEORA; | 80 st->codec->codec_id = CODEC_ID_THEORA; |
81 | 81 |
82 } else if (os->buf[os->pstart] == 0x83) { | 82 } else if (os->buf[os->pstart] == 0x83) { |
83 vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8); | 83 vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8); |
84 } | 84 } |
85 | 85 |
86 st->codec.extradata = av_realloc (st->codec.extradata, cds); | 86 st->codec->extradata = av_realloc (st->codec->extradata, cds); |
87 cdp = st->codec.extradata + st->codec.extradata_size; | 87 cdp = st->codec->extradata + st->codec->extradata_size; |
88 *cdp++ = os->psize >> 8; | 88 *cdp++ = os->psize >> 8; |
89 *cdp++ = os->psize & 0xff; | 89 *cdp++ = os->psize & 0xff; |
90 memcpy (cdp, os->buf + os->pstart, os->psize); | 90 memcpy (cdp, os->buf + os->pstart, os->psize); |
91 st->codec.extradata_size = cds; | 91 st->codec->extradata_size = cds; |
92 | 92 |
93 return 1; | 93 return 1; |
94 } | 94 } |
95 | 95 |
96 static uint64_t | 96 static uint64_t |
101 ogg_stream_t *os = ogg->streams + idx; | 101 ogg_stream_t *os = ogg->streams + idx; |
102 theora_params_t *thp = os->private; | 102 theora_params_t *thp = os->private; |
103 uint64_t iframe = gp >> thp->gpshift; | 103 uint64_t iframe = gp >> thp->gpshift; |
104 uint64_t pframe = gp & thp->gpmask; | 104 uint64_t pframe = gp & thp->gpmask; |
105 | 105 |
106 return (iframe + pframe) * AV_TIME_BASE * st->codec.time_base.num / | 106 return (iframe + pframe) * AV_TIME_BASE * st->codec->time_base.num / |
107 st->codec.time_base.den; | 107 st->codec->time_base.den; |
108 } | 108 } |
109 | 109 |
110 ogg_codec_t theora_codec = { | 110 ogg_codec_t theora_codec = { |
111 .magic = "\200theora", | 111 .magic = "\200theora", |
112 .magicsize = 7, | 112 .magicsize = 7, |