annotate oggdec.c @ 3071:c4121744e2a7 libavformat

remove useless casts
author bcoudurier
date Mon, 25 Feb 2008 12:15:26 +0000
parents 61ea9e6ee162
children 7a0230981402
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
1 /*
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
2 * Ogg bitstream support
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
3 * Luca Barbato <lu_zero@gentoo.org>
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
4 * Based on tcvp implementation
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 877
diff changeset
5 *
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
6 */
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
7
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
8 /**
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
9 Copyright (C) 2005 Michael Ahlberg, Måns Rullgård
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
10
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
11 Permission is hereby granted, free of charge, to any person
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
12 obtaining a copy of this software and associated documentation
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
13 files (the "Software"), to deal in the Software without
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
14 restriction, including without limitation the rights to use, copy,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
15 modify, merge, publish, distribute, sublicense, and/or sell copies
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
16 of the Software, and to permit persons to whom the Software is
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
17 furnished to do so, subject to the following conditions:
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
18
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
19 The above copyright notice and this permission notice shall be
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
20 included in all copies or substantial portions of the Software.
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
21
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
26 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
27 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
28 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
29 DEALINGS IN THE SOFTWARE.
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
30 **/
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
31
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
32
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
33 #include <stdio.h>
2714
b22ba392ac21 Rename ogg2.[ch] to oggdec.[ch].
diego
parents: 2713
diff changeset
34 #include "oggdec.h"
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
35 #include "avformat.h"
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
36
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
37 #define MAX_PAGE_SIZE 65307
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
38 #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
39
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
40 static ogg_codec_t *ogg_codecs[] = {
3023
61ea9e6ee162 Add support for speex in ogg
reimar
parents: 2994
diff changeset
41 &speex_codec,
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
42 &vorbis_codec,
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
43 &theora_codec,
756
677bad57fca2 flac in ogg support
mru
parents: 755
diff changeset
44 &flac_codec,
2378
214978878a19 add support for old flac in ogg
michael
parents: 2274
diff changeset
45 &old_flac_codec,
1076
a1c07ce3943c ogm demuxing
mru
parents: 887
diff changeset
46 &ogm_video_codec,
a1c07ce3943c ogm demuxing
mru
parents: 887
diff changeset
47 &ogm_audio_codec,
2994
35b3eaafd9fe Add support for ogg text subtitles.
reimar
parents: 2841
diff changeset
48 &ogm_text_codec,
1076
a1c07ce3943c ogm demuxing
mru
parents: 887
diff changeset
49 &ogm_old_codec,
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
50 NULL
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
51 };
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
52
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
53 //FIXME We could avoid some structure duplication
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
54 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
55 ogg_save (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
56 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
57 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
58 ogg_state_t *ost =
727
a827309802b5 pre-c99 compatibility
mru
parents: 726
diff changeset
59 av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
60 int i;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
61 ost->pos = url_ftell (s->pb);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
62 ost->curidx = ogg->curidx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
63 ost->next = ogg->state;
1657
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
64 ost->nstreams = ogg->nstreams;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
65 memcpy(ost->streams, ogg->streams, ogg->nstreams * sizeof(*ogg->streams));
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
66
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
67 for (i = 0; i < ogg->nstreams; i++){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
68 ogg_stream_t *os = ogg->streams + i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
69 os->buf = av_malloc (os->bufsize);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
70 memset (os->buf, 0, os->bufsize);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
71 memcpy (os->buf, ost->streams[i].buf, os->bufpos);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
72 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
73
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
74 ogg->state = ost;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
75
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
76 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
77 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
78
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
79 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
80 ogg_restore (AVFormatContext * s, int discard)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
81 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
82 ogg_t *ogg = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
83 ByteIOContext *bc = s->pb;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
84 ogg_state_t *ost = ogg->state;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
85 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
86
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
87 if (!ost)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
88 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
89
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
90 ogg->state = ost->next;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
91
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
92 if (!discard){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
93 for (i = 0; i < ogg->nstreams; i++)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
94 av_free (ogg->streams[i].buf);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
95
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
96 url_fseek (bc, ost->pos, SEEK_SET);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
97 ogg->curidx = ost->curidx;
1657
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
98 ogg->nstreams = ost->nstreams;
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
99 memcpy(ogg->streams, ost->streams,
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
100 ost->nstreams * sizeof(*ogg->streams));
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
101 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
102
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
103 av_free (ost);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
104
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
105 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
106 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
107
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
108 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
109 ogg_reset (ogg_t * ogg)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
110 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
111 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
112
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
113 for (i = 0; i < ogg->nstreams; i++){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
114 ogg_stream_t *os = ogg->streams + i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
115 os->bufpos = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
116 os->pstart = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
117 os->psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
118 os->granule = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
119 os->lastgp = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
120 os->nsegs = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
121 os->segp = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
122 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
123
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
124 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
125
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
126 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
127 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
128
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
129 static ogg_codec_t *
728
db6846a618bd s/u_char/uint8_t/
mru
parents: 727
diff changeset
130 ogg_find_codec (uint8_t * buf, int size)
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
131 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
132 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
133
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
134 for (i = 0; ogg_codecs[i]; i++)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
135 if (size >= ogg_codecs[i]->magicsize &&
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
136 !memcmp (buf, ogg_codecs[i]->magic, ogg_codecs[i]->magicsize))
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
137 return ogg_codecs[i];
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
138
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
139 return NULL;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
140 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
141
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
142 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
143 ogg_find_stream (ogg_t * ogg, int serial)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
144 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
145 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
146
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
147 for (i = 0; i < ogg->nstreams; i++)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
148 if (ogg->streams[i].serial == serial)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
149 return i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
150
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
151 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
152 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
153
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
154 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
155 ogg_new_stream (AVFormatContext * s, uint32_t serial)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
156 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
157
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
158 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
159 int idx = ogg->nstreams++;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
160 AVStream *st;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
161 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
162
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
163 ogg->streams = av_realloc (ogg->streams,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
164 ogg->nstreams * sizeof (*ogg->streams));
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
165 memset (ogg->streams + idx, 0, sizeof (*ogg->streams));
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
166 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
167 os->serial = serial;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
168 os->bufsize = DECODER_BUFFER_SIZE;
1133
554cc16341da 10l: don't allocate a new buffer quite so often
mru
parents: 1132
diff changeset
169 os->buf = av_malloc(os->bufsize);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
170 os->header = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
171
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
172 st = av_new_stream (s, idx);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
173 if (!st)
2273
7eb456c4ed8a Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents: 2001
diff changeset
174 return AVERROR(ENOMEM);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
175
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
176 av_set_pts_info(st, 64, 1, 1000000);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
177
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
178 return idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
179 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
180
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
181 static int
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
182 ogg_new_buf(ogg_t *ogg, int idx)
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
183 {
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
184 ogg_stream_t *os = ogg->streams + idx;
1134
19ceddeafe2e s/u_char/uint8_t/ accidentally copied from tcvp
mru
parents: 1133
diff changeset
185 uint8_t *nb = av_malloc(os->bufsize);
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
186 int size = os->bufpos - os->pstart;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
187 if(os->buf){
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
188 memcpy(nb, os->buf + os->pstart, size);
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
189 av_free(os->buf);
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
190 }
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
191 os->buf = nb;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
192 os->bufpos = size;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
193 os->pstart = 0;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
194
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
195 return 0;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
196 }
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
197
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
198 static int
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
199 ogg_read_page (AVFormatContext * s, int *str)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
200 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
201 ByteIOContext *bc = s->pb;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
202 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
203 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
204 int i = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
205 int flags, nsegs;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
206 uint64_t gp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
207 uint32_t serial;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
208 uint32_t seq;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
209 uint32_t crc;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
210 int size, idx;
1332
7474cc6383d4 fix some signedness warnings
mru
parents: 1331
diff changeset
211 uint8_t sync[4];
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
212 int sp = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
213
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
214 if (get_buffer (bc, sync, 4) < 4)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
215 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
216
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
217 do{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
218 int c;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
219
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
220 if (sync[sp & 3] == 'O' &&
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
221 sync[(sp + 1) & 3] == 'g' &&
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
222 sync[(sp + 2) & 3] == 'g' && sync[(sp + 3) & 3] == 'S')
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
223 break;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
224
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
225 c = url_fgetc (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
226 if (c < 0)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
227 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
228 sync[sp++ & 3] = c;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
229 }while (i++ < MAX_PAGE_SIZE);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
230
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
231 if (i >= MAX_PAGE_SIZE){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
232 av_log (s, AV_LOG_INFO, "ogg, can't find sync word\n");
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
233 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
234 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
235
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
236 if (url_fgetc (bc) != 0) /* version */
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
237 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
238
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
239 flags = url_fgetc (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
240 gp = get_le64 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
241 serial = get_le32 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
242 seq = get_le32 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
243 crc = get_le32 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
244 nsegs = url_fgetc (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
245
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
246 idx = ogg_find_stream (ogg, serial);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
247 if (idx < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
248 idx = ogg_new_stream (s, serial);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
249 if (idx < 0)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
250 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
251 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
252
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
253 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
254
1133
554cc16341da 10l: don't allocate a new buffer quite so often
mru
parents: 1132
diff changeset
255 if(os->psize > 0)
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
256 ogg_new_buf(ogg, idx);
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
257
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
258 if (get_buffer (bc, os->segments, nsegs) < nsegs)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
259 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
260
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
261 os->nsegs = nsegs;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
262 os->segp = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
263
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
264 size = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
265 for (i = 0; i < nsegs; i++)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
266 size += os->segments[i];
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
267
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
268 if (flags & OGG_FLAG_CONT){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
269 if (!os->psize){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
270 while (os->segp < os->nsegs){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
271 int seg = os->segments[os->segp++];
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
272 os->pstart += seg;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
273 if (seg < 255)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
274 break;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
275 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
276 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
277 }else{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
278 os->psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
279 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
280
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
281 if (os->bufsize - os->bufpos < size){
728
db6846a618bd s/u_char/uint8_t/
mru
parents: 727
diff changeset
282 uint8_t *nb = av_malloc (os->bufsize *= 2);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
283 memcpy (nb, os->buf, os->bufpos);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
284 av_free (os->buf);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
285 os->buf = nb;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
286 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
287
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
288 if (get_buffer (bc, os->buf + os->bufpos, size) < size)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
289 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
290
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
291 os->lastgp = os->granule;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
292 os->bufpos += size;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
293 os->granule = gp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
294 os->flags = flags;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
295
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
296 if (str)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
297 *str = idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
298
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
299 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
300 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
301
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
302 static int
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
303 ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
304 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
305 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
306 int idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
307 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
308 int complete = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
309 int segp = 0, psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
310
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
311 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
312 av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
313 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
314
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
315 do{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
316 idx = ogg->curidx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
317
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
318 while (idx < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
319 if (ogg_read_page (s, &idx) < 0)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
320 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
321 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
322
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
323 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
324
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
325 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
326 av_log (s, AV_LOG_DEBUG,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
327 "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n",
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
328 idx, os->pstart, os->psize, os->segp, os->nsegs);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
329 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
330
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
331 if (!os->codec){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
332 if (os->header < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
333 os->codec = ogg_find_codec (os->buf, os->bufpos);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
334 if (!os->codec){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
335 os->header = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
336 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
337 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
338 }else{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
339 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
340 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
341 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
342
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
343 segp = os->segp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
344 psize = os->psize;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
345
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
346 while (os->segp < os->nsegs){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
347 int ss = os->segments[os->segp++];
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
348 os->psize += ss;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
349 if (ss < 255){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
350 complete = 1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
351 break;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
352 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
353 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
354
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
355 if (!complete && os->segp == os->nsegs){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
356 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
357 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
358 }while (!complete);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
359
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
360 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
361 av_log (s, AV_LOG_DEBUG,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
362 "ogg_packet: idx %i, frame size %i, start %i\n",
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
363 idx, os->psize, os->pstart);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
364 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
365
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
366 ogg->curidx = idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
367
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
368 if (os->header < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
369 int hdr = os->codec->header (s, idx);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
370 if (!hdr){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
371 os->header = os->seq;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
372 os->segp = segp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
373 os->psize = psize;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
374 ogg->headers = 1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
375 }else{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
376 os->pstart += os->psize;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
377 os->psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
378 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
379 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
380
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
381 if (os->header > -1 && os->seq > os->header){
2732
2b101e9d25c0 set PKT_FLAG_KEY for Theora and OGM streams
mru
parents: 2714
diff changeset
382 os->pflags = 0;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
383 if (os->codec && os->codec->packet)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
384 os->codec->packet (s, idx);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
385 if (str)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
386 *str = idx;
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
387 if (dstart)
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
388 *dstart = os->pstart;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
389 if (dsize)
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
390 *dsize = os->psize;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
391 os->pstart += os->psize;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
392 os->psize = 0;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
393 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
394
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
395 os->seq++;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
396 if (os->segp == os->nsegs)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
397 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
398
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
399 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
400 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
401
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
402 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
403 ogg_get_headers (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
404 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
405 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
406
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
407 do{
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
408 if (ogg_packet (s, NULL, NULL, NULL) < 0)
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
409 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
410 }while (!ogg->headers);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
411
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
412 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
413 av_log (s, AV_LOG_DEBUG, "found headers\n");
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
414 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
415
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
416 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
417 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
418
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
419 static uint64_t
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
420 ogg_gptopts (AVFormatContext * s, int i, uint64_t gp)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
421 {
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
422 ogg_t *ogg = s->priv_data;
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
423 ogg_stream_t *os = ogg->streams + i;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
424 uint64_t pts = AV_NOPTS_VALUE;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
425
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
426 if(os->codec->gptopts){
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
427 pts = os->codec->gptopts(s, i, gp);
1077
91677ac6fb19 set stream time_base properly
mru
parents: 1076
diff changeset
428 } else {
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
429 pts = gp;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
430 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
431
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
432 return pts;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
433 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
434
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
435
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
436 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
437 ogg_get_length (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
438 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
439 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
440 int idx = -1, i;
1104
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
441 offset_t size, end;
766
ed249b9caa2f don't try to find file length if streaming
mru
parents: 764
diff changeset
442
2841
a41a1ec2213c use proper url_is_streamed() API
aurel
parents: 2771
diff changeset
443 if(url_is_streamed(s->pb))
766
ed249b9caa2f don't try to find file length if streaming
mru
parents: 764
diff changeset
444 return 0;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
445
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
446 // already set
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
447 if (s->duration != AV_NOPTS_VALUE)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
448 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
449
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
450 size = url_fsize(s->pb);
1104
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
451 if(size < 0)
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
452 return 0;
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
453 end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: size;
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
454
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
455 ogg_save (s);
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
456 url_fseek (s->pb, end, SEEK_SET);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
457
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
458 while (!ogg_read_page (s, &i)){
1658
2400a22af998 check for sane values in ogg_get_length(), fix lol-ffplay.ogm fuzz test
mru
parents: 1657
diff changeset
459 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
2400a22af998 check for sane values in ogg_get_length(), fix lol-ffplay.ogm fuzz test
mru
parents: 1657
diff changeset
460 ogg->streams[i].codec)
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
461 idx = i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
462 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
463
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
464 if (idx != -1){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
465 s->streams[idx]->duration =
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
466 ogg_gptopts (s, idx, ogg->streams[idx].granule);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
467 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
468
1104
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
469 ogg->size = size;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
470 ogg_restore (s, 0);
1185
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
471 ogg_save (s);
1397
21755fe31dd7 10l inverted condition check generated an endless loop
aurel
parents: 1379
diff changeset
472 while (!ogg_read_page (s, &i)) {
1185
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
473 if (i == idx && ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0)
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
474 break;
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
475 }
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
476 if (i == idx) {
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
477 s->streams[idx]->start_time = ogg_gptopts (s, idx, ogg->streams[idx].granule);
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
478 s->streams[idx]->duration -= s->streams[idx]->start_time;
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
479 }
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
480 ogg_restore (s, 0);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
481
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
482 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
483 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
484
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
485
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
486 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
487 ogg_read_header (AVFormatContext * s, AVFormatParameters * ap)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
488 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
489 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
490 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
491 //linear headers seek from start
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
492 if (ogg_get_headers (s) < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
493 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
494 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
495
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
496 //linear granulepos seek from end
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
497 ogg_get_length (s);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
498
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
499 //fill the extradata in the per codec callbacks
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
500 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
501 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
502
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
503
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
504 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
505 ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
506 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
507 ogg_t *ogg;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
508 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
509 int idx = -1;
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
510 int pstart, psize;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
511
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 877
diff changeset
512 //Get an ogg packet
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
513 do{
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
514 if (ogg_packet (s, &idx, &pstart, &psize) < 0)
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
515 return AVERROR(EIO);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
516 }while (idx < 0 || !s->streams[idx]);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
517
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
518 ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
519 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
520
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
521 //Alloc a pkt
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
522 if (av_new_packet (pkt, psize) < 0)
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
523 return AVERROR(EIO);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
524 pkt->stream_index = idx;
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
525 memcpy (pkt->data, os->buf + pstart, psize);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
526 if (os->lastgp != -1LL){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
527 pkt->pts = ogg_gptopts (s, idx, os->lastgp);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
528 os->lastgp = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
529 }
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
530
2732
2b101e9d25c0 set PKT_FLAG_KEY for Theora and OGM streams
mru
parents: 2714
diff changeset
531 pkt->flags = os->pflags;
2b101e9d25c0 set PKT_FLAG_KEY for Theora and OGM streams
mru
parents: 2714
diff changeset
532
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
533 return psize;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
534 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
535
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
536
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
537 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
538 ogg_read_close (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
539 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
540 ogg_t *ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
541 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
542
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
543 for (i = 0; i < ogg->nstreams; i++){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
544 av_free (ogg->streams[i].buf);
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
545 av_free (ogg->streams[i].private);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
546 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
547 av_free (ogg->streams);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
548 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
549 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
550
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
551
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
552 static int64_t
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
553 ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
554 int64_t pos_limit)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
555 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
556 ogg_t *ogg = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
557 ByteIOContext *bc = s->pb;
2592
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
558 int64_t pts = AV_NOPTS_VALUE;
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
559 int i;
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
560 url_fseek(bc, *pos_arg, SEEK_SET);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
561 while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) {
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
562 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
563 ogg->streams[i].codec && i == stream_index) {
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
564 pts = ogg_gptopts(s, i, ogg->streams[i].granule);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
565 // FIXME: this is the position of the packet after the one with above
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
566 // pts.
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
567 *pos_arg = url_ftell(bc);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
568 break;
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
569 }
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
570 }
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
571 ogg_reset(ogg);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
572 return pts;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
573 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
574
877
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
575 static int ogg_probe(AVProbeData *p)
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
576 {
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
577 if (p->buf[0] == 'O' && p->buf[1] == 'g' &&
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
578 p->buf[2] == 'g' && p->buf[3] == 'S' &&
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
579 p->buf[4] == 0x0 && p->buf[5] <= 0x7 )
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
580 return AVPROBE_SCORE_MAX;
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
581 else
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
582 return 0;
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
583 }
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
584
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
585 AVInputFormat ogg_demuxer = {
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
586 "ogg",
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
587 "Ogg",
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
588 sizeof (ogg_t),
877
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
589 ogg_probe,
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
590 ogg_read_header,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
591 ogg_read_packet,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
592 ogg_read_close,
2593
16aa09b0f20f Remove ogg seek function, instead use generic seek via read_timestamp function
reimar
parents: 2592
diff changeset
593 NULL,
2592
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
594 ogg_read_timestamp,
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
595 .extensions = "ogg",
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
596 };