annotate oggdec.c @ 3021:6f393e79e896 libavformat

Fix issue 338: Correctly interleave ogg packets per granule and set eos correctly, 2 packets buffering is needed. It duplicates interleave_per_dts a bit, if someone has a good solution, I'll implement it.
author bcoudurier
date Tue, 05 Feb 2008 01:16:47 +0000
parents 35b3eaafd9fe
children 61ea9e6ee162
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[] = {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
41 &vorbis_codec,
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
42 &theora_codec,
756
677bad57fca2 flac in ogg support
mru
parents: 755
diff changeset
43 &flac_codec,
2378
214978878a19 add support for old flac in ogg
michael
parents: 2274
diff changeset
44 &old_flac_codec,
1076
a1c07ce3943c ogm demuxing
mru
parents: 887
diff changeset
45 &ogm_video_codec,
a1c07ce3943c ogm demuxing
mru
parents: 887
diff changeset
46 &ogm_audio_codec,
2994
35b3eaafd9fe Add support for ogg text subtitles.
reimar
parents: 2841
diff changeset
47 &ogm_text_codec,
1076
a1c07ce3943c ogm demuxing
mru
parents: 887
diff changeset
48 &ogm_old_codec,
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
49 NULL
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
50 };
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 //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
53 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
54 ogg_save (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
55 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
56 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
57 ogg_state_t *ost =
727
a827309802b5 pre-c99 compatibility
mru
parents: 726
diff changeset
58 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
59 int i;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
60 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
61 ost->curidx = ogg->curidx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
62 ost->next = ogg->state;
1657
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
63 ost->nstreams = ogg->nstreams;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
64 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
65
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
66 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
67 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
68 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
69 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
70 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
71 }
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 ogg->state = ost;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
74
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
75 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
76 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
79 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
80 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
81 ogg_t *ogg = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
82 ByteIOContext *bc = s->pb;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
83 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
84 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
85
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
86 if (!ost)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
87 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
88
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
89 ogg->state = ost->next;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
90
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
91 if (!discard){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
92 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
93 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
94
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
95 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
96 ogg->curidx = ost->curidx;
1657
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
97 ogg->nstreams = ost->nstreams;
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
98 memcpy(ogg->streams, ost->streams,
a472266b5d39 save/restore number of streams
mru
parents: 1397
diff changeset
99 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
100 }
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 av_free (ost);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
103
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
104 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
105 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
108 ogg_reset (ogg_t * ogg)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
109 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
110 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
111
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
112 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
113 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
114 os->bufpos = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
115 os->pstart = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
116 os->psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
117 os->granule = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
118 os->lastgp = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
119 os->nsegs = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
120 os->segp = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
121 }
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 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
124
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
125 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
126 }
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 static ogg_codec_t *
728
db6846a618bd s/u_char/uint8_t/
mru
parents: 727
diff changeset
129 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
130 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
131 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
132
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
133 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
134 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
135 !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
136 return ogg_codecs[i];
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
137
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
138 return NULL;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
139 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
142 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
143 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
144 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
145
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
146 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
147 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
148 return i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
149
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
150 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
151 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
154 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
155 {
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 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
158 int idx = ogg->nstreams++;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
159 AVStream *st;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
160 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
161
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
162 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
163 ogg->nstreams * sizeof (*ogg->streams));
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
164 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
165 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
166 os->serial = serial;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
167 os->bufsize = DECODER_BUFFER_SIZE;
1133
554cc16341da 10l: don't allocate a new buffer quite so often
mru
parents: 1132
diff changeset
168 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
169 os->header = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
170
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
171 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
172 if (!st)
2273
7eb456c4ed8a Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents: 2001
diff changeset
173 return AVERROR(ENOMEM);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
174
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
175 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
176
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
177 return idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
178 }
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 static int
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
181 ogg_new_buf(ogg_t *ogg, int idx)
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
182 {
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
183 ogg_stream_t *os = ogg->streams + idx;
1134
19ceddeafe2e s/u_char/uint8_t/ accidentally copied from tcvp
mru
parents: 1133
diff changeset
184 uint8_t *nb = av_malloc(os->bufsize);
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
185 int size = os->bufpos - os->pstart;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
186 if(os->buf){
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
187 memcpy(nb, os->buf + os->pstart, size);
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
188 av_free(os->buf);
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
189 }
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
190 os->buf = nb;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
191 os->bufpos = size;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
192 os->pstart = 0;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
193
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
194 return 0;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
195 }
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
196
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
197 static int
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
198 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
199 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
200 ByteIOContext *bc = s->pb;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
201 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
202 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
203 int i = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
204 int flags, nsegs;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
205 uint64_t gp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
206 uint32_t serial;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
207 uint32_t seq;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
208 uint32_t crc;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
209 int size, idx;
1332
7474cc6383d4 fix some signedness warnings
mru
parents: 1331
diff changeset
210 uint8_t sync[4];
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
211 int sp = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
212
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
213 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
214 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
215
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
216 do{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
217 int c;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
218
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
219 if (sync[sp & 3] == 'O' &&
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
220 sync[(sp + 1) & 3] == 'g' &&
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
221 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
222 break;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
223
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
224 c = url_fgetc (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
225 if (c < 0)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
226 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
227 sync[sp++ & 3] = c;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
228 }while (i++ < MAX_PAGE_SIZE);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
229
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
230 if (i >= MAX_PAGE_SIZE){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
231 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
232 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
233 }
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 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
236 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
237
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
238 flags = url_fgetc (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
239 gp = get_le64 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
240 serial = get_le32 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
241 seq = get_le32 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
242 crc = get_le32 (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
243 nsegs = url_fgetc (bc);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
244
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
245 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
246 if (idx < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
247 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
248 if (idx < 0)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
249 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
250 }
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 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
253
1133
554cc16341da 10l: don't allocate a new buffer quite so often
mru
parents: 1132
diff changeset
254 if(os->psize > 0)
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
255 ogg_new_buf(ogg, idx);
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
256
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
257 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
258 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
259
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
260 os->nsegs = nsegs;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
261 os->segp = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
262
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
263 size = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
264 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
265 size += os->segments[i];
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
266
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
267 if (flags & OGG_FLAG_CONT){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
268 if (!os->psize){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
269 while (os->segp < os->nsegs){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
270 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
271 os->pstart += seg;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
272 if (seg < 255)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
273 break;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
274 }
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 }else{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
277 os->psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
278 }
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 if (os->bufsize - os->bufpos < size){
728
db6846a618bd s/u_char/uint8_t/
mru
parents: 727
diff changeset
281 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
282 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
283 av_free (os->buf);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
284 os->buf = nb;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
285 }
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 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
288 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
289
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
290 os->lastgp = os->granule;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
291 os->bufpos += size;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
292 os->granule = gp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
293 os->flags = flags;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
294
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
295 if (str)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
296 *str = idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
297
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
298 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
299 }
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 static int
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
302 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
303 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
304 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
305 int idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
306 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
307 int complete = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
308 int segp = 0, psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
309
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
310 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
311 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
312 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
313
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
314 do{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
315 idx = ogg->curidx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
316
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
317 while (idx < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
318 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
319 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
320 }
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 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
323
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
324 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
325 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
326 "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
327 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
328 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
329
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
330 if (!os->codec){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
331 if (os->header < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
332 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
333 if (!os->codec){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
334 os->header = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
335 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
336 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
337 }else{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
338 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
339 }
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 segp = os->segp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
343 psize = os->psize;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
344
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
345 while (os->segp < os->nsegs){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
346 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
347 os->psize += ss;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
348 if (ss < 255){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
349 complete = 1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
350 break;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
351 }
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 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
355 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
356 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
357 }while (!complete);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
358
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
359 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
360 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
361 "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
362 idx, os->psize, os->pstart);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
363 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
364
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
365 ogg->curidx = idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
366
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
367 if (os->header < 0){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
368 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
369 if (!hdr){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
370 os->header = os->seq;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
371 os->segp = segp;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
372 os->psize = psize;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
373 ogg->headers = 1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
374 }else{
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
375 os->pstart += os->psize;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
376 os->psize = 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
377 }
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 if (os->header > -1 && os->seq > os->header){
2732
2b101e9d25c0 set PKT_FLAG_KEY for Theora and OGM streams
mru
parents: 2714
diff changeset
381 os->pflags = 0;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
382 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
383 os->codec->packet (s, idx);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
384 if (str)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
385 *str = idx;
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
386 if (dstart)
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
387 *dstart = os->pstart;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
388 if (dsize)
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
389 *dsize = os->psize;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
390 os->pstart += os->psize;
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
391 os->psize = 0;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
392 }
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 os->seq++;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
395 if (os->segp == os->nsegs)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
396 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
397
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
398 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
399 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
402 ogg_get_headers (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
403 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
404 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
405
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
406 do{
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
407 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
408 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
409 }while (!ogg->headers);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
410
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
411 #if 0
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
412 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
413 #endif
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
414
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
415 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
416 }
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 static uint64_t
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
419 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
420 {
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
421 ogg_t *ogg = s->priv_data;
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
422 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
423 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
424
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
425 if(os->codec->gptopts){
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
426 pts = os->codec->gptopts(s, i, gp);
1077
91677ac6fb19 set stream time_base properly
mru
parents: 1076
diff changeset
427 } else {
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
428 pts = gp;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
429 }
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 return pts;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
432 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
436 ogg_get_length (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
437 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
438 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
439 int idx = -1, i;
1104
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
440 offset_t size, end;
766
ed249b9caa2f don't try to find file length if streaming
mru
parents: 764
diff changeset
441
2841
a41a1ec2213c use proper url_is_streamed() API
aurel
parents: 2771
diff changeset
442 if(url_is_streamed(s->pb))
766
ed249b9caa2f don't try to find file length if streaming
mru
parents: 764
diff changeset
443 return 0;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
444
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
445 // already set
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
446 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
447 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
448
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
449 size = url_fsize(s->pb);
1104
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
450 if(size < 0)
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
451 return 0;
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
452 end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: size;
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
453
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
454 ogg_save (s);
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
455 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
456
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
457 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
458 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
459 ogg->streams[i].codec)
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
460 idx = i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
461 }
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 if (idx != -1){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
464 s->streams[idx]->duration =
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
465 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
466 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
467
1104
2a31a69400f3 fix seek related bugs
mru
parents: 1077
diff changeset
468 ogg->size = size;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
469 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
470 ogg_save (s);
1397
21755fe31dd7 10l inverted condition check generated an endless loop
aurel
parents: 1379
diff changeset
471 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
472 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
473 break;
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
474 }
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
475 if (i == idx) {
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
476 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
477 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
478 }
13dc486b272b Try to find out correct start time to make seeking faster and add some
reimar
parents: 1169
diff changeset
479 ogg_restore (s, 0);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
480
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
481 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
482 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
486 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
487 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
488 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
489 ogg->curidx = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
490 //linear headers seek from start
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
491 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
492 return -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
493 }
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 //linear granulepos seek from end
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
496 ogg_get_length (s);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
497
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
498 //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
499 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
500 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
504 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
505 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
506 ogg_t *ogg;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
507 ogg_stream_t *os;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
508 int idx = -1;
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
509 int pstart, psize;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
510
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 877
diff changeset
511 //Get an ogg packet
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
512 do{
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
513 if (ogg_packet (s, &idx, &pstart, &psize) < 0)
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
514 return AVERROR(EIO);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
515 }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
516
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
517 ogg = s->priv_data;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
518 os = ogg->streams + idx;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
519
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
520 //Alloc a pkt
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
521 if (av_new_packet (pkt, psize) < 0)
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
522 return AVERROR(EIO);
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
523 pkt->stream_index = idx;
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
524 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
525 if (os->lastgp != -1LL){
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
526 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
527 os->lastgp = -1;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
528 }
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
529
2732
2b101e9d25c0 set PKT_FLAG_KEY for Theora and OGM streams
mru
parents: 2714
diff changeset
530 pkt->flags = os->pflags;
2b101e9d25c0 set PKT_FLAG_KEY for Theora and OGM streams
mru
parents: 2714
diff changeset
531
1132
a5487f44bbfa cleaned up buffer management
mru
parents: 1120
diff changeset
532 return psize;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
533 }
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 static int
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
537 ogg_read_close (AVFormatContext * s)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
538 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
539 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
540 int i;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
541
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
542 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
543 av_free (ogg->streams[i].buf);
755
27449ee55201 support theora in ogg, plus required ogg core changes
mru
parents: 730
diff changeset
544 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
545 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
546 av_free (ogg->streams);
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
547 return 0;
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
548 }
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 static int64_t
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
552 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
553 int64_t pos_limit)
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
554 {
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
555 ogg_t *ogg = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2732
diff changeset
556 ByteIOContext *bc = s->pb;
2592
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
557 int64_t pts = AV_NOPTS_VALUE;
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
558 int i;
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
559 url_fseek(bc, *pos_arg, SEEK_SET);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
560 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
561 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
562 ogg->streams[i].codec && i == stream_index) {
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
563 pts = ogg_gptopts(s, i, ogg->streams[i].granule);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
564 // 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
565 // pts.
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
566 *pos_arg = url_ftell(bc);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
567 break;
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
568 }
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 ogg_reset(ogg);
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
571 return pts;
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
572 }
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
573
877
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
574 static int ogg_probe(AVProbeData *p)
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
575 {
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
576 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
577 p->buf[2] == 'g' && p->buf[3] == 'S' &&
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
578 p->buf[4] == 0x0 && p->buf[5] <= 0x7 )
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
579 return AVPROBE_SCORE_MAX;
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
580 else
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
581 return 0;
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
582 }
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
583
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
584 AVInputFormat ogg_demuxer = {
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
585 "ogg",
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 sizeof (ogg_t),
877
7e42b4e47dfc ogg format probe function by Ivo <ivop at euronet nl>
mru
parents: 858
diff changeset
588 ogg_probe,
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
589 ogg_read_header,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
590 ogg_read_packet,
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
591 ogg_read_close,
2593
16aa09b0f20f Remove ogg seek function, instead use generic seek via read_timestamp function
reimar
parents: 2592
diff changeset
592 NULL,
2592
c2f4fba2c234 Add a read_timestamp function to ogg demuxer
reimar
parents: 2378
diff changeset
593 ogg_read_timestamp,
726
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
594 .extensions = "ogg",
17178af951b4 Ogg demuxer ported from tcvp by Luca Barbato <lu_zero at gentoo dot org>,
mru
parents:
diff changeset
595 };