Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
77be08ee
Commit
77be08ee
authored
Nov 06, 2008
by
Måns Rullgård
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OGG: untypedef demuxer structs
Originally committed as revision 15784 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
d00e8b83
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
83 deletions
+83
-83
oggdec.c
libavformat/oggdec.c
+28
-28
oggdec.h
libavformat/oggdec.h
+21
-21
oggparseflac.c
libavformat/oggparseflac.c
+4
-4
oggparseogm.c
libavformat/oggparseogm.c
+10
-10
oggparsespeex.c
libavformat/oggparsespeex.c
+3
-3
oggparsetheora.c
libavformat/oggparsetheora.c
+9
-9
oggparsevorbis.c
libavformat/oggparsevorbis.c
+8
-8
No files found.
libavformat/oggdec.c
View file @
77be08ee
...
...
@@ -37,7 +37,7 @@
#define MAX_PAGE_SIZE 65307
#define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
static
const
ogg_codec_t
*
const
ogg_codecs
[]
=
{
static
const
struct
ogg_codec
*
const
ogg_codecs
[]
=
{
&
ff_speex_codec
,
&
ff_vorbis_codec
,
&
ff_theora_codec
,
...
...
@@ -54,8 +54,8 @@ static const ogg_codec_t * const ogg_codecs[] = {
static
int
ogg_save
(
AVFormatContext
*
s
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_state_t
*
ost
=
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_state
*
ost
=
av_malloc
(
sizeof
(
*
ost
)
+
(
ogg
->
nstreams
-
1
)
*
sizeof
(
*
ogg
->
streams
));
int
i
;
ost
->
pos
=
url_ftell
(
s
->
pb
);
...
...
@@ -65,7 +65,7 @@ ogg_save (AVFormatContext * s)
memcpy
(
ost
->
streams
,
ogg
->
streams
,
ogg
->
nstreams
*
sizeof
(
*
ogg
->
streams
));
for
(
i
=
0
;
i
<
ogg
->
nstreams
;
i
++
){
ogg_stream_t
*
os
=
ogg
->
streams
+
i
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
i
;
os
->
buf
=
av_malloc
(
os
->
bufsize
);
memset
(
os
->
buf
,
0
,
os
->
bufsize
);
memcpy
(
os
->
buf
,
ost
->
streams
[
i
].
buf
,
os
->
bufpos
);
...
...
@@ -79,9 +79,9 @@ ogg_save (AVFormatContext * s)
static
int
ogg_restore
(
AVFormatContext
*
s
,
int
discard
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
ByteIOContext
*
bc
=
s
->
pb
;
ogg_state_t
*
ost
=
ogg
->
state
;
struct
ogg_state
*
ost
=
ogg
->
state
;
int
i
;
if
(
!
ost
)
...
...
@@ -106,12 +106,12 @@ ogg_restore (AVFormatContext * s, int discard)
}
static
int
ogg_reset
(
ogg_t
*
ogg
)
ogg_reset
(
struct
ogg
*
ogg
)
{
int
i
;
for
(
i
=
0
;
i
<
ogg
->
nstreams
;
i
++
){
ogg_stream_t
*
os
=
ogg
->
streams
+
i
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
i
;
os
->
bufpos
=
0
;
os
->
pstart
=
0
;
os
->
psize
=
0
;
...
...
@@ -126,7 +126,7 @@ ogg_reset (ogg_t * ogg)
return
0
;
}
static
const
ogg_codec_t
*
static
const
struct
ogg_codec
*
ogg_find_codec
(
uint8_t
*
buf
,
int
size
)
{
int
i
;
...
...
@@ -140,7 +140,7 @@ ogg_find_codec (uint8_t * buf, int size)
}
static
int
ogg_find_stream
(
ogg_t
*
ogg
,
int
serial
)
ogg_find_stream
(
struct
ogg
*
ogg
,
int
serial
)
{
int
i
;
...
...
@@ -155,10 +155,10 @@ static int
ogg_new_stream
(
AVFormatContext
*
s
,
uint32_t
serial
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
int
idx
=
ogg
->
nstreams
++
;
AVStream
*
st
;
ogg_stream_t
*
os
;
struct
ogg_stream
*
os
;
ogg
->
streams
=
av_realloc
(
ogg
->
streams
,
ogg
->
nstreams
*
sizeof
(
*
ogg
->
streams
));
...
...
@@ -179,9 +179,9 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial)
}
static
int
ogg_new_buf
(
ogg_t
*
ogg
,
int
idx
)
ogg_new_buf
(
struct
ogg
*
ogg
,
int
idx
)
{
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
uint8_t
*
nb
=
av_malloc
(
os
->
bufsize
);
int
size
=
os
->
bufpos
-
os
->
pstart
;
if
(
os
->
buf
){
...
...
@@ -199,8 +199,8 @@ static int
ogg_read_page
(
AVFormatContext
*
s
,
int
*
str
)
{
ByteIOContext
*
bc
=
s
->
pb
;
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
;
int
i
=
0
;
int
flags
,
nsegs
;
uint64_t
gp
;
...
...
@@ -302,9 +302,9 @@ ogg_read_page (AVFormatContext * s, int *str)
static
int
ogg_packet
(
AVFormatContext
*
s
,
int
*
str
,
int
*
dstart
,
int
*
dsize
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
int
idx
;
ogg_stream_t
*
os
;
struct
ogg_stream
*
os
;
int
complete
=
0
;
int
segp
=
0
,
psize
=
0
;
...
...
@@ -402,7 +402,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
static
int
ogg_get_headers
(
AVFormatContext
*
s
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
do
{
if
(
ogg_packet
(
s
,
NULL
,
NULL
,
NULL
)
<
0
)
...
...
@@ -419,8 +419,8 @@ ogg_get_headers (AVFormatContext * s)
static
uint64_t
ogg_gptopts
(
AVFormatContext
*
s
,
int
i
,
uint64_t
gp
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
i
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
i
;
uint64_t
pts
=
AV_NOPTS_VALUE
;
if
(
os
->
codec
->
gptopts
){
...
...
@@ -436,7 +436,7 @@ ogg_gptopts (AVFormatContext * s, int i, uint64_t gp)
static
int
ogg_get_length
(
AVFormatContext
*
s
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
int
idx
=
-
1
,
i
;
int64_t
size
,
end
;
...
...
@@ -476,7 +476,7 @@ ogg_get_length (AVFormatContext * s)
static
int
ogg_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
ogg
->
curidx
=
-
1
;
//linear headers seek from start
if
(
ogg_get_headers
(
s
)
<
0
){
...
...
@@ -494,8 +494,8 @@ ogg_read_header (AVFormatContext * s, AVFormatParameters * ap)
static
int
ogg_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
ogg_t
*
ogg
;
ogg_stream_t
*
os
;
struct
ogg
*
ogg
;
struct
ogg_stream
*
os
;
int
idx
=
-
1
;
int
pstart
,
psize
;
...
...
@@ -527,7 +527,7 @@ ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
static
int
ogg_read_close
(
AVFormatContext
*
s
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
int
i
;
for
(
i
=
0
;
i
<
ogg
->
nstreams
;
i
++
){
...
...
@@ -543,7 +543,7 @@ static int64_t
ogg_read_timestamp
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
*
pos_arg
,
int64_t
pos_limit
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
struct
ogg
*
ogg
=
s
->
priv_data
;
ByteIOContext
*
bc
=
s
->
pb
;
int64_t
pts
=
AV_NOPTS_VALUE
;
int
i
;
...
...
@@ -575,7 +575,7 @@ static int ogg_probe(AVProbeData *p)
AVInputFormat
ogg_demuxer
=
{
"ogg"
,
NULL_IF_CONFIG_SMALL
(
"Ogg"
),
sizeof
(
ogg_t
),
sizeof
(
struct
ogg
),
ogg_probe
,
ogg_read_header
,
ogg_read_packet
,
...
...
libavformat/oggdec.h
View file @
77be08ee
...
...
@@ -27,16 +27,16 @@
#include "avformat.h"
typedef
struct
ogg_codec
{
struct
ogg_codec
{
const
int8_t
*
magic
;
uint8_t
magicsize
;
const
int8_t
*
name
;
int
(
*
header
)(
AVFormatContext
*
,
int
);
int
(
*
packet
)(
AVFormatContext
*
,
int
);
uint64_t
(
*
gptopts
)(
AVFormatContext
*
,
int
,
uint64_t
);
}
ogg_codec_t
;
};
typedef
struct
ogg_stream
{
struct
ogg_stream
{
uint8_t
*
buf
;
unsigned
int
bufsize
;
unsigned
int
bufpos
;
...
...
@@ -47,43 +47,43 @@ typedef struct ogg_stream {
uint32_t
seq
;
uint64_t
granule
,
lastgp
;
int
flags
;
ogg_codec_t
*
codec
;
struct
ogg_codec
*
codec
;
int
header
;
int
nsegs
,
segp
;
uint8_t
segments
[
255
];
void
*
private
;
}
ogg_stream_t
;
};
typedef
struct
ogg_state
{
struct
ogg_state
{
uint64_t
pos
;
int
curidx
;
struct
ogg_state
*
next
;
int
nstreams
;
ogg_stream_t
streams
[
1
];
}
ogg_state_t
;
struct
ogg_stream
streams
[
1
];
};
typedef
struct
ogg
{
ogg_stream_t
*
streams
;
struct
ogg
{
struct
ogg_stream
*
streams
;
int
nstreams
;
int
headers
;
int
curidx
;
uint64_t
size
;
ogg_state_t
*
state
;
}
ogg_t
;
struct
ogg_state
*
state
;
};
#define OGG_FLAG_CONT 1
#define OGG_FLAG_BOS 2
#define OGG_FLAG_EOS 4
extern
const
ogg_codec_t
ff_flac_codec
;
extern
const
ogg_codec_t
ff_ogm_audio_codec
;
extern
const
ogg_codec_t
ff_ogm_old_codec
;
extern
const
ogg_codec_t
ff_ogm_text_codec
;
extern
const
ogg_codec_t
ff_ogm_video_codec
;
extern
const
ogg_codec_t
ff_old_flac_codec
;
extern
const
ogg_codec_t
ff_speex_codec
;
extern
const
ogg_codec_t
ff_theora_codec
;
extern
const
ogg_codec_t
ff_vorbis_codec
;
extern
const
struct
ogg_codec
ff_flac_codec
;
extern
const
struct
ogg_codec
ff_ogm_audio_codec
;
extern
const
struct
ogg_codec
ff_ogm_old_codec
;
extern
const
struct
ogg_codec
ff_ogm_text_codec
;
extern
const
struct
ogg_codec
ff_ogm_video_codec
;
extern
const
struct
ogg_codec
ff_old_flac_codec
;
extern
const
struct
ogg_codec
ff_speex_codec
;
extern
const
struct
ogg_codec
ff_theora_codec
;
extern
const
struct
ogg_codec
ff_vorbis_codec
;
extern
int
vorbis_comment
(
AVFormatContext
*
ms
,
uint8_t
*
buf
,
int
size
);
...
...
libavformat/oggparseflac.c
View file @
77be08ee
...
...
@@ -28,8 +28,8 @@
static
int
flac_header
(
AVFormatContext
*
s
,
int
idx
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
AVStream
*
st
=
s
->
streams
[
idx
];
GetBitContext
gb
;
int
mdt
;
...
...
@@ -85,13 +85,13 @@ old_flac_header (AVFormatContext * s, int idx)
return
0
;
}
const
ogg_codec_t
ff_flac_codec
=
{
const
struct
ogg_codec
ff_flac_codec
=
{
.
magic
=
"
\177
FLAC"
,
.
magicsize
=
5
,
.
header
=
flac_header
};
const
ogg_codec_t
ff_old_flac_codec
=
{
const
struct
ogg_codec
ff_old_flac_codec
=
{
.
magic
=
"fLaC"
,
.
magicsize
=
4
,
.
header
=
old_flac_header
...
...
libavformat/oggparseogm.c
View file @
77be08ee
...
...
@@ -33,8 +33,8 @@
static
int
ogm_header
(
AVFormatContext
*
s
,
int
idx
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
AVStream
*
st
=
s
->
streams
[
idx
];
const
uint8_t
*
p
=
os
->
buf
+
os
->
pstart
;
uint64_t
time_unit
;
...
...
@@ -100,8 +100,8 @@ ogm_header(AVFormatContext *s, int idx)
static
int
ogm_dshow_header
(
AVFormatContext
*
s
,
int
idx
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
AVStream
*
st
=
s
->
streams
[
idx
];
uint8_t
*
p
=
os
->
buf
+
os
->
pstart
;
uint32_t
t
;
...
...
@@ -134,8 +134,8 @@ ogm_dshow_header(AVFormatContext *s, int idx)
static
int
ogm_packet
(
AVFormatContext
*
s
,
int
idx
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
uint8_t
*
p
=
os
->
buf
+
os
->
pstart
;
int
lb
;
...
...
@@ -149,28 +149,28 @@ ogm_packet(AVFormatContext *s, int idx)
return
0
;
}
const
ogg_codec_t
ff_ogm_video_codec
=
{
const
struct
ogg_codec
ff_ogm_video_codec
=
{
.
magic
=
"
\001
video"
,
.
magicsize
=
6
,
.
header
=
ogm_header
,
.
packet
=
ogm_packet
};
const
ogg_codec_t
ff_ogm_audio_codec
=
{
const
struct
ogg_codec
ff_ogm_audio_codec
=
{
.
magic
=
"
\001
audio"
,
.
magicsize
=
6
,
.
header
=
ogm_header
,
.
packet
=
ogm_packet
};
const
ogg_codec_t
ff_ogm_text_codec
=
{
const
struct
ogg_codec
ff_ogm_text_codec
=
{
.
magic
=
"
\001
text"
,
.
magicsize
=
5
,
.
header
=
ogm_header
,
.
packet
=
ogm_packet
};
const
ogg_codec_t
ff_ogm_old_codec
=
{
const
struct
ogg_codec
ff_ogm_old_codec
=
{
.
magic
=
"
\001
Direct Show Samples embedded in Ogg"
,
.
magicsize
=
35
,
.
header
=
ogm_dshow_header
,
...
...
libavformat/oggparsespeex.c
View file @
77be08ee
...
...
@@ -31,8 +31,8 @@
#include "oggdec.h"
static
int
speex_header
(
AVFormatContext
*
s
,
int
idx
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
AVStream
*
st
=
s
->
streams
[
idx
];
uint8_t
*
p
=
os
->
buf
+
os
->
pstart
;
...
...
@@ -54,7 +54,7 @@ static int speex_header(AVFormatContext *s, int idx) {
return
0
;
}
const
ogg_codec_t
ff_speex_codec
=
{
const
struct
ogg_codec
ff_speex_codec
=
{
.
magic
=
"Speex "
,
.
magicsize
=
8
,
.
header
=
speex_header
...
...
libavformat/oggparsetheora.c
View file @
77be08ee
...
...
@@ -28,18 +28,18 @@
#include "avformat.h"
#include "oggdec.h"
typedef
struct
theora_params
{
struct
theora_params
{
int
gpshift
;
int
gpmask
;
}
theora_params_t
;
};
static
int
theora_header
(
AVFormatContext
*
s
,
int
idx
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
AVStream
*
st
=
s
->
streams
[
idx
];
theora_params_t
*
thp
=
os
->
private
;
struct
theora_params
*
thp
=
os
->
private
;
int
cds
=
st
->
codec
->
extradata_size
+
os
->
psize
+
2
;
uint8_t
*
cdp
;
...
...
@@ -119,9 +119,9 @@ theora_header (AVFormatContext * s, int idx)
static
uint64_t
theora_gptopts
(
AVFormatContext
*
ctx
,
int
idx
,
uint64_t
gp
)
{
ogg_t
*
ogg
=
ctx
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
theora_params_t
*
thp
=
os
->
private
;
struct
ogg
*
ogg
=
ctx
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
struct
theora_params
*
thp
=
os
->
private
;
uint64_t
iframe
=
gp
>>
thp
->
gpshift
;
uint64_t
pframe
=
gp
&
thp
->
gpmask
;
...
...
@@ -131,7 +131,7 @@ theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp)
return
iframe
+
pframe
;
}
const
ogg_codec_t
ff_theora_codec
=
{
const
struct
ogg_codec
ff_theora_codec
=
{
.
magic
=
"
\200
theora"
,
.
magicsize
=
7
,
.
header
=
theora_header
,
...
...
libavformat/oggparsevorbis.c
View file @
77be08ee
...
...
@@ -122,14 +122,14 @@ vorbis_comment(AVFormatContext * as, uint8_t *buf, int size)
* [framing_flag] = read one bit | Not Used
* */
typedef
struct
{
struct
oggvorbis_private
{
unsigned
int
len
[
3
];
unsigned
char
*
packet
[
3
];
}
oggvorbis_private_t
;
};
static
unsigned
int
fixup_vorbis_headers
(
AVFormatContext
*
as
,
oggvorbis_private_t
*
priv
,
fixup_vorbis_headers
(
AVFormatContext
*
as
,
struct
oggvorbis_private
*
priv
,
uint8_t
**
buf
)
{
int
i
,
offset
,
len
;
...
...
@@ -154,16 +154,16 @@ fixup_vorbis_headers(AVFormatContext * as, oggvorbis_private_t *priv,
static
int
vorbis_header
(
AVFormatContext
*
s
,
int
idx
)
{
ogg_t
*
ogg
=
s
->
priv_data
;
ogg_stream_t
*
os
=
ogg
->
streams
+
idx
;
struct
ogg
*
ogg
=
s
->
priv_data
;
struct
ogg_stream
*
os
=
ogg
->
streams
+
idx
;
AVStream
*
st
=
s
->
streams
[
idx
];
oggvorbis_private_t
*
priv
;
struct
oggvorbis_private
*
priv
;
if
(
os
->
seq
>
2
)
return
0
;
if
(
os
->
seq
==
0
)
{
os
->
private
=
av_mallocz
(
sizeof
(
oggvorbis_private_t
));
os
->
private
=
av_mallocz
(
sizeof
(
struct
oggvorbis_private
));
if
(
!
os
->
private
)
return
0
;
}
...
...
@@ -219,7 +219,7 @@ vorbis_header (AVFormatContext * s, int idx)
return
os
->
seq
<
3
;
}
const
ogg_codec_t
ff_vorbis_codec
=
{
const
struct
ogg_codec
ff_vorbis_codec
=
{
.
magic
=
"
\001
vorbis"
,
.
magicsize
=
7
,
.
header
=
vorbis_header
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment