Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
df4237b6
Commit
df4237b6
authored
Dec 02, 2010
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtp input: theora support
Not enabled yet
parent
b43a83e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
22 deletions
+44
-22
modules/access/rtp/xiph.c
modules/access/rtp/xiph.c
+44
-22
No files found.
modules/access/rtp/xiph.c
View file @
df4237b6
...
...
@@ -39,19 +39,17 @@
#include "rtp.h"
/* PT=dynamic
* vorbis: Xiph Vorbis audio (RFC 5215)
*/
typedef
struct
rtp_vorbis_t
typedef
struct
rtp_xiph_t
{
es_out_id_t
*
id
;
block_t
*
block
;
uint32_t
ident
;
}
rtp_vorbis_t
;
bool
vorbis
;
}
rtp_xiph_t
;
static
void
*
vorbis_init
(
demux_t
*
demux
)
static
void
*
xiph_init
(
bool
vorbis
)
{
rtp_
vorbis
_t
*
self
=
malloc
(
sizeof
(
*
self
));
rtp_
xiph
_t
*
self
=
malloc
(
sizeof
(
*
self
));
if
(
self
==
NULL
)
return
NULL
;
...
...
@@ -59,13 +57,31 @@ static void *vorbis_init (demux_t *demux)
self
->
id
=
NULL
;
self
->
block
=
NULL
;
self
->
ident
=
0xffffffff
;
/* impossible value on the wire */
(
void
)
demux
;
self
->
vorbis
=
vorbis
;
return
self
;
}
static
void
vorbis_destroy
(
demux_t
*
demux
,
void
*
data
)
/* PT=dynamic
* vorbis: Xiph Vorbis audio (RFC 5215)
*/
static
void
*
vorbis_init
(
demux_t
*
demux
)
{
(
void
)
demux
;
return
xiph_init
(
true
);
}
/* PT=dynamic
* vorbis: Xiph Theora video
*/
static
void
*
theora_init
(
demux_t
*
demux
)
{
(
void
)
demux
;
return
xiph_init
(
false
);
}
static
void
xiph_destroy
(
demux_t
*
demux
,
void
*
data
)
{
rtp_
vorbis
_t
*
self
=
data
;
rtp_
xiph
_t
*
self
=
data
;
if
(
!
data
)
return
;
...
...
@@ -79,7 +95,7 @@ static void vorbis_destroy (demux_t *demux, void *data)
}
/* Convert configuration from RTP to VLC format */
static
ssize_t
vorbis
_header
(
void
**
pextra
,
const
uint8_t
*
buf
,
size_t
len
)
static
ssize_t
xiph
_header
(
void
**
pextra
,
const
uint8_t
*
buf
,
size_t
len
)
{
/* Headers number */
if
(
len
==
0
)
...
...
@@ -129,14 +145,14 @@ static ssize_t vorbis_header (void **pextra, const uint8_t *buf, size_t len)
}
static
void
vorbis
_decode
(
demux_t
*
demux
,
void
*
data
,
block_t
*
block
)
static
void
xiph
_decode
(
demux_t
*
demux
,
void
*
data
,
block_t
*
block
)
{
rtp_
vorbis
_t
*
self
=
data
;
rtp_
xiph
_t
*
self
=
data
;
if
(
!
data
||
block
->
i_buffer
<
4
)
goto
drop
;
/* 32-bits
Vorbis
RTP header (§2.2) */
/* 32-bits RTP header (§2.2) */
uint32_t
ident
=
GetDWBE
(
block
->
p_buffer
);
block
->
i_buffer
-=
4
;
block
->
p_buffer
+=
4
;
...
...
@@ -146,10 +162,12 @@ static void vorbis_decode (demux_t *demux, void *data, block_t *block)
unsigned
pkts
=
(
ident
)
&
15
;
ident
>>=
8
;
/*
Vorbis
RTP defragmentation */
/* RTP defragmentation */
if
(
self
->
block
&&
(
block
->
i_flags
&
BLOCK_FLAG_DISCONTINUITY
))
{
/* Screwed! discontinuity within a fragmented packet */
msg_Warn
(
demux
,
"discontinuity in fragmented Vorbis packet"
);
msg_Warn
(
demux
,
self
->
vorbis
?
"discontinuity in fragmented Vorbis packet"
:
"discontinuity in fragmented Theora packet"
);
block_Release
(
self
->
block
);
self
->
block
=
NULL
;
}
...
...
@@ -205,7 +223,7 @@ static void vorbis_decode (demux_t *demux, void *data, block_t *block)
pkts
=
1
;
}
/*
Vorbis
RTP payload packets processing */
/* RTP payload packets processing */
while
(
pkts
>
0
)
{
if
(
block
->
i_buffer
<
2
)
...
...
@@ -219,7 +237,7 @@ static void vorbis_decode (demux_t *demux, void *data, block_t *block)
switch
(
datatype
)
{
case
0
:
/* Raw
audio frame
*/
case
0
:
/* Raw
payload
*/
{
if
(
self
->
ident
!=
ident
)
break
;
/* Ignore raw without configuration */
...
...
@@ -236,17 +254,21 @@ static void vorbis_decode (demux_t *demux, void *data, block_t *block)
break
;
/* Ignore config retransmission */
void
*
extv
;
ssize_t
extc
=
vorbis
_header
(
&
extv
,
block
->
p_buffer
,
len
);
ssize_t
extc
=
xiph
_header
(
&
extv
,
block
->
p_buffer
,
len
);
if
(
extc
<
0
)
break
;
es_format_t
fmt
;
es_format_Init
(
&
fmt
,
AUDIO_ES
,
VLC_CODEC_VORBIS
);
es_format_Init
(
&
fmt
,
self
->
vorbis
?
AUDIO_ES
:
VIDEO_ES
,
self
->
vorbis
?
VLC_CODEC_VORBIS
:
VLC_CODEC_THEORA
);
fmt
.
p_extra
=
extv
;
fmt
.
i_extra
=
extc
;
codec_destroy
(
demux
,
self
->
id
);
msg_Dbg
(
demux
,
"Vorbis packed configuration received "
"(%06"
PRIx32
")"
,
ident
);
msg_Dbg
(
demux
,
self
->
vorbis
?
"Vorbis packed configuration received (%06"
PRIx32
")"
:
"Theora packed configuration received (%06"
PRIx32
")"
,
ident
);
self
->
ident
=
ident
;
self
->
id
=
codec_init
(
demux
,
&
fmt
);
break
;
...
...
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