Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
26e9ba8a
Commit
26e9ba8a
authored
Apr 02, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ogg : demux -> demux2. It needs more testings.
parent
07c2bef6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
110 deletions
+97
-110
modules/demux/ogg.c
modules/demux/ogg.c
+97
-110
No files found.
modules/demux/ogg.c
View file @
26e9ba8a
...
@@ -41,7 +41,7 @@ static void Close( vlc_object_t * );
...
@@ -41,7 +41,7 @@ static void Close( vlc_object_t * );
vlc_module_begin
();
vlc_module_begin
();
set_description
(
_
(
"Ogg stream demuxer"
)
);
set_description
(
_
(
"Ogg stream demuxer"
)
);
set_capability
(
"demux"
,
50
);
set_capability
(
"demux
2
"
,
50
);
set_callbacks
(
Open
,
Close
);
set_callbacks
(
Open
,
Close
);
add_shortcut
(
"ogg"
);
add_shortcut
(
"ogg"
);
vlc_module_end
();
vlc_module_end
();
...
@@ -96,6 +96,9 @@ struct demux_sys_t
...
@@ -96,6 +96,9 @@ struct demux_sys_t
/* stream state */
/* stream state */
int
i_eos
;
int
i_eos
;
/* bitrate */
int
i_bitrate
;
};
};
/* OggDS headers for the new header format (used in ogm files) */
/* OggDS headers for the new header format (used in ogm files) */
...
@@ -147,17 +150,17 @@ typedef struct stream_header
...
@@ -147,17 +150,17 @@ typedef struct stream_header
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
int
Demux
(
input_thread
_t
*
);
static
int
Demux
(
demux
_t
*
);
static
int
Control
(
input_thread
_t
*
,
int
,
va_list
);
static
int
Control
(
demux
_t
*
,
int
,
va_list
);
/* Bitstream manipulation */
/* Bitstream manipulation */
static
int
Ogg_ReadPage
(
input_thread
_t
*
,
ogg_page
*
);
static
int
Ogg_ReadPage
(
demux
_t
*
,
ogg_page
*
);
static
void
Ogg_UpdatePCR
(
logical_stream_t
*
,
ogg_packet
*
);
static
void
Ogg_UpdatePCR
(
logical_stream_t
*
,
ogg_packet
*
);
static
void
Ogg_DecodePacket
(
input_thread
_t
*
,
logical_stream_t
*
,
ogg_packet
*
);
static
void
Ogg_DecodePacket
(
demux
_t
*
,
logical_stream_t
*
,
ogg_packet
*
);
static
int
Ogg_BeginningOfStream
(
input_thread_t
*
p_input
);
static
int
Ogg_BeginningOfStream
(
demux_t
*
p_demux
);
static
int
Ogg_FindLogicalStreams
(
input_thread_t
*
p_input
);
static
int
Ogg_FindLogicalStreams
(
demux_t
*
p_demux
);
static
void
Ogg_EndOfStream
(
input_thread_t
*
p_input
);
static
void
Ogg_EndOfStream
(
demux_t
*
p_demux
);
/* Logical bitstream headers */
/* Logical bitstream headers */
static
void
Ogg_ReadTheoraHeader
(
logical_stream_t
*
p_stream
,
static
void
Ogg_ReadTheoraHeader
(
logical_stream_t
*
p_stream
,
...
@@ -172,39 +175,30 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *, logical_stream_t *p_stream,
...
@@ -172,39 +175,30 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *, logical_stream_t *p_stream,
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
input_thread_t
*
p_input
=
(
input_thread
_t
*
)
p_this
;
demux_t
*
p_demux
=
(
demux
_t
*
)
p_this
;
demux_sys_t
*
p_sys
;
demux_sys_t
*
p_sys
;
uint8_t
*
p_peek
;
uint8_t
*
p_peek
;
/* Check if we are dealing with an ogg stream */
/* Check if we are dealing with an ogg stream */
if
(
stream_Peek
(
p_
input
->
s
,
&
p_peek
,
4
)
<
4
)
if
(
stream_Peek
(
p_
demux
->
s
,
&
p_peek
,
4
)
<
4
)
{
{
msg_Err
(
p_
input
,
"cannot peek"
);
msg_Err
(
p_
demux
,
"cannot peek"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
if
(
strcmp
(
p_
input
->
psz_demux
,
"ogg"
)
&&
strncmp
(
p_peek
,
"OggS"
,
4
)
)
if
(
strcmp
(
p_
demux
->
psz_demux
,
"ogg"
)
&&
strncmp
(
p_peek
,
"OggS"
,
4
)
)
{
{
msg_Warn
(
p_
input
,
"ogg module discarded (invalid header)"
);
msg_Warn
(
p_
demux
,
"ogg module discarded (invalid header)"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/* Create one program */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
if
(
input_InitStream
(
p_input
,
0
)
==
-
1
)
{
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
msg_Err
(
p_input
,
"cannot init stream"
);
return
VLC_EGENERIC
;
}
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
/* Set exported functions */
/* Set exported functions */
p_
input
->
pf_demux
=
Demux
;
p_
demux
->
pf_demux
=
Demux
;
p_
input
->
pf_demux
_control
=
Control
;
p_
demux
->
pf
_control
=
Control
;
p_
input
->
p_demux_data
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_
demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
memset
(
p_sys
,
0
,
sizeof
(
demux_sys_t
)
);
memset
(
p_sys
,
0
,
sizeof
(
demux_sys_t
)
);
p_sys
->
i_bitrate
=
0
;
p_sys
->
pp_stream
=
NULL
;
p_sys
->
pp_stream
=
NULL
;
/* Begnning of stream, tell the demux to look for elementary streams. */
/* Begnning of stream, tell the demux to look for elementary streams. */
...
@@ -221,13 +215,13 @@ static int Open( vlc_object_t * p_this )
...
@@ -221,13 +215,13 @@ static int Open( vlc_object_t * p_this )
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
input_thread_t
*
p_input
=
(
input_thread
_t
*
)
p_this
;
demux_t
*
p_demux
=
(
demux
_t
*
)
p_this
;
demux_sys_t
*
p_sys
=
p_
input
->
p_demux_data
;
demux_sys_t
*
p_sys
=
p_
demux
->
p_sys
;
/* Cleanup the bitstream parser */
/* Cleanup the bitstream parser */
ogg_sync_clear
(
&
p_sys
->
oy
);
ogg_sync_clear
(
&
p_sys
->
oy
);
Ogg_EndOfStream
(
p_
input
);
Ogg_EndOfStream
(
p_
demux
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
@@ -237,9 +231,9 @@ static void Close( vlc_object_t *p_this )
...
@@ -237,9 +231,9 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************
*****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/
*****************************************************************************/
static
int
Demux
(
input_thread_t
*
p_input
)
static
int
Demux
(
demux_t
*
p_demux
)
{
{
demux_sys_t
*
p_sys
=
p_
input
->
p_demux_data
;
demux_sys_t
*
p_sys
=
p_
demux
->
p_sys
;
ogg_page
oggpage
;
ogg_page
oggpage
;
ogg_packet
oggpacket
;
ogg_packet
oggpacket
;
int
i_stream
;
int
i_stream
;
...
@@ -249,21 +243,21 @@ static int Demux( input_thread_t * p_input )
...
@@ -249,21 +243,21 @@ static int Demux( input_thread_t * p_input )
{
{
if
(
p_sys
->
i_eos
)
if
(
p_sys
->
i_eos
)
{
{
msg_Dbg
(
p_
input
,
"end of a group of logical streams"
);
msg_Dbg
(
p_
demux
,
"end of a group of logical streams"
);
Ogg_EndOfStream
(
p_
input
);
Ogg_EndOfStream
(
p_
demux
);
}
}
if
(
Ogg_BeginningOfStream
(
p_
input
)
!=
VLC_SUCCESS
)
return
0
;
if
(
Ogg_BeginningOfStream
(
p_
demux
)
!=
VLC_SUCCESS
)
return
0
;
p_sys
->
i_eos
=
0
;
p_sys
->
i_eos
=
0
;
msg_Dbg
(
p_
input
,
"beginning of a group of logical streams"
);
msg_Dbg
(
p_
demux
,
"beginning of a group of logical streams"
);
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_RESET_PCR
);
es_out_Control
(
p_
demux
->
out
,
ES_OUT_RESET_PCR
);
}
}
/*
/*
* Demux an ogg page from the stream
* Demux an ogg page from the stream
*/
*/
if
(
Ogg_ReadPage
(
p_
input
,
&
oggpage
)
!=
VLC_SUCCESS
)
if
(
Ogg_ReadPage
(
p_
demux
,
&
oggpage
)
!=
VLC_SUCCESS
)
{
{
return
0
;
/* EOF */
return
0
;
/* EOF */
}
}
...
@@ -329,17 +323,17 @@ static int Demux( input_thread_t * p_input )
...
@@ -329,17 +323,17 @@ static int Demux( input_thread_t * p_input )
{
{
if
(
ogg_stream_packetout
(
&
p_stream
->
os
,
&
oggpacket
)
>
0
)
if
(
ogg_stream_packetout
(
&
p_stream
->
os
,
&
oggpacket
)
>
0
)
{
{
Ogg_DecodePacket
(
p_
input
,
p_stream
,
&
oggpacket
);
Ogg_DecodePacket
(
p_
demux
,
p_stream
,
&
oggpacket
);
}
}
else
else
{
{
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_SET_PCR
,
p_stream
->
i_pcr
);
es_out_Control
(
p_
demux
->
out
,
ES_OUT_SET_PCR
,
p_stream
->
i_pcr
);
}
}
continue
;
continue
;
}
}
}
}
Ogg_DecodePacket
(
p_
input
,
p_stream
,
&
oggpacket
);
Ogg_DecodePacket
(
p_
demux
,
p_stream
,
&
oggpacket
);
}
}
break
;
break
;
}
}
...
@@ -360,7 +354,7 @@ static int Demux( input_thread_t * p_input )
...
@@ -360,7 +354,7 @@ static int Demux( input_thread_t * p_input )
if
(
p_sys
->
i_pcr
>=
0
)
if
(
p_sys
->
i_pcr
>=
0
)
{
{
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_SET_PCR
,
p_sys
->
i_pcr
);
es_out_Control
(
p_
demux
->
out
,
ES_OUT_SET_PCR
,
p_sys
->
i_pcr
);
}
}
...
@@ -370,9 +364,9 @@ static int Demux( input_thread_t * p_input )
...
@@ -370,9 +364,9 @@ static int Demux( input_thread_t * p_input )
/*****************************************************************************
/*****************************************************************************
* Control:
* Control:
*****************************************************************************/
*****************************************************************************/
static
int
Control
(
input_thread_t
*
p_input
,
int
i_query
,
va_list
args
)
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
{
demux_sys_t
*
p_sys
=
p_
input
->
p_demux_data
;
demux_sys_t
*
p_sys
=
p_
demux
->
p_sys
;
int64_t
*
pi64
;
int64_t
*
pi64
;
int
i
;
int
i
;
...
@@ -400,7 +394,9 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
...
@@ -400,7 +394,9 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
ogg_sync_reset
(
&
p_sys
->
oy
);
ogg_sync_reset
(
&
p_sys
->
oy
);
default:
default:
return
demux_vaControlDefault
(
p_input
,
i_query
,
args
);
return
demux2_vaControlHelper
(
p_demux
->
s
,
0
,
-
1
,
p_sys
->
i_bitrate
,
1
,
i_query
,
args
);
}
}
}
}
...
@@ -410,23 +406,21 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
...
@@ -410,23 +406,21 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
* Returns VLC_SUCCESS if a page has been read. An error might happen if we
* Returns VLC_SUCCESS if a page has been read. An error might happen if we
* are at the end of stream.
* are at the end of stream.
****************************************************************************/
****************************************************************************/
static
int
Ogg_ReadPage
(
input_thread_t
*
p_input
,
ogg_page
*
p_oggpage
)
static
int
Ogg_ReadPage
(
demux_t
*
p_demux
,
ogg_page
*
p_oggpage
)
{
{
demux_sys_t
*
p_ogg
=
(
demux_sys_t
*
)
p_input
->
p_demux_data
;
demux_sys_t
*
p_ogg
=
p_demux
->
p_sys
;
int
i_read
=
0
;
int
i_read
=
0
;
data_packet_t
*
p_data
;
byte_t
*
p_buffer
;
byte_t
*
p_buffer
;
while
(
ogg_sync_pageout
(
&
p_ogg
->
oy
,
p_oggpage
)
!=
1
)
while
(
ogg_sync_pageout
(
&
p_ogg
->
oy
,
p_oggpage
)
!=
1
)
{
{
i_read
=
input_SplitBuffer
(
p_input
,
&
p_data
,
OGG_BLOCK_SIZE
);
p_buffer
=
ogg_sync_buffer
(
&
p_ogg
->
oy
,
OGG_BLOCK_SIZE
);
i_read
=
stream_Read
(
p_demux
->
s
,
p_buffer
,
OGG_BLOCK_SIZE
);
if
(
i_read
<=
0
)
if
(
i_read
<=
0
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
p_buffer
=
ogg_sync_buffer
(
&
p_ogg
->
oy
,
i_read
);
p_input
->
p_vlc
->
pf_memcpy
(
p_buffer
,
p_data
->
p_payload_start
,
i_read
);
ogg_sync_wrote
(
&
p_ogg
->
oy
,
i_read
);
ogg_sync_wrote
(
&
p_ogg
->
oy
,
i_read
);
input_DeletePacket
(
p_input
->
p_method_data
,
p_data
);
}
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -478,7 +472,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
...
@@ -478,7 +472,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
/****************************************************************************
/****************************************************************************
* Ogg_DecodePacket: Decode an Ogg packet.
* Ogg_DecodePacket: Decode an Ogg packet.
****************************************************************************/
****************************************************************************/
static
void
Ogg_DecodePacket
(
input_thread_t
*
p_input
,
static
void
Ogg_DecodePacket
(
demux_t
*
p_demux
,
logical_stream_t
*
p_stream
,
logical_stream_t
*
p_stream
,
ogg_packet
*
p_oggpacket
)
ogg_packet
*
p_oggpacket
)
{
{
...
@@ -490,7 +484,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -490,7 +484,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
/* Sanity check */
/* Sanity check */
if
(
!
p_oggpacket
->
bytes
)
if
(
!
p_oggpacket
->
bytes
)
{
{
msg_Dbg
(
p_
input
,
"discarding 0 sized packet"
);
msg_Dbg
(
p_
demux
,
"discarding 0 sized packet"
);
return
;
return
;
}
}
...
@@ -537,13 +531,13 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -537,13 +531,13 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
p_stream
->
fmt
.
audio
.
i_channels
=
p_stream
->
fmt
.
audio
.
i_channels
=
bs_read
(
&
s
,
3
)
+
1
;
bs_read
(
&
s
,
3
)
+
1
;
msg_Dbg
(
p_
input
,
"FLAC header, channels: %i, rate: %i"
,
msg_Dbg
(
p_
demux
,
"FLAC header, channels: %i, rate: %i"
,
p_stream
->
fmt
.
audio
.
i_channels
,
p_stream
->
fmt
.
audio
.
i_channels
,
(
int
)
p_stream
->
f_rate
);
(
int
)
p_stream
->
f_rate
);
}
}
else
else
{
{
msg_Dbg
(
p_
input
,
"FLAC STREAMINFO metadata too short"
);
msg_Dbg
(
p_
demux
,
"FLAC STREAMINFO metadata too short"
);
}
}
/* Store STREAMINFO for the decoder and packetizer */
/* Store STREAMINFO for the decoder and packetizer */
...
@@ -556,13 +550,13 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -556,13 +550,13 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
/* Fake this as the last metadata block */
/* Fake this as the last metadata block */
((
uint8_t
*
)
p_stream
->
fmt
.
p_extra
)[
4
]
|=
0x80
;
((
uint8_t
*
)
p_stream
->
fmt
.
p_extra
)[
4
]
|=
0x80
;
p_stream
->
p_es
=
es_out_Add
(
p_
input
->
p_es_
out
,
p_stream
->
p_es
=
es_out_Add
(
p_
demux
->
out
,
&
p_stream
->
fmt
);
&
p_stream
->
fmt
);
}
}
else
else
{
{
/* This ain't a STREAMINFO metadata */
/* This ain't a STREAMINFO metadata */
msg_Dbg
(
p_
input
,
"Invalid FLAC STREAMINFO metadata"
);
msg_Dbg
(
p_
demux
,
"Invalid FLAC STREAMINFO metadata"
);
}
}
p_stream
->
b_force_backup
=
0
;
p_stream
->
b_force_backup
=
0
;
p_stream
->
i_packets_backup
=
0
;
p_stream
->
i_packets_backup
=
0
;
...
@@ -606,7 +600,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -606,7 +600,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
}
}
/* Check the ES is selected */
/* Check the ES is selected */
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_GET_ES_STATE
,
es_out_Control
(
p_
demux
->
out
,
ES_OUT_GET_ES_STATE
,
p_stream
->
p_es
,
&
b_selected
);
p_stream
->
p_es
,
&
b_selected
);
if
(
b_selected
&&
!
p_stream
->
b_activated
)
if
(
b_selected
&&
!
p_stream
->
b_activated
)
...
@@ -623,7 +617,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -623,7 +617,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
p_stream
->
p_packets_backup
[
i
].
granulepos
=
p_stream
->
p_packets_backup
[
i
].
granulepos
=
p_stream
->
i_interpolated_pcr
*
p_stream
->
f_rate
/
I64C
(
1000000
);
p_stream
->
i_interpolated_pcr
*
p_stream
->
f_rate
/
I64C
(
1000000
);
Ogg_DecodePacket
(
p_
input
,
p_stream
,
Ogg_DecodePacket
(
p_
demux
,
p_stream
,
&
p_stream
->
p_packets_backup
[
i
]
);
&
p_stream
->
p_packets_backup
[
i
]
);
}
}
}
}
...
@@ -641,10 +635,10 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -641,10 +635,10 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
if
(
p_stream
->
i_previous_pcr
==
0
&&
if
(
p_stream
->
i_previous_pcr
==
0
&&
p_stream
->
i_pcr
>
3
*
DEFAULT_PTS_DELAY
)
p_stream
->
i_pcr
>
3
*
DEFAULT_PTS_DELAY
)
{
{
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_RESET_PCR
);
es_out_Control
(
p_
demux
->
out
,
ES_OUT_RESET_PCR
);
/* Call the pace control */
/* Call the pace control */
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_SET_PCR
,
p_stream
->
i_pcr
);
es_out_Control
(
p_
demux
->
out
,
ES_OUT_SET_PCR
,
p_stream
->
i_pcr
);
}
}
p_stream
->
i_previous_pcr
=
p_stream
->
i_pcr
;
p_stream
->
i_previous_pcr
=
p_stream
->
i_pcr
;
...
@@ -664,10 +658,10 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -664,10 +658,10 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
if
(
p_stream
->
i_previous_pcr
==
0
&&
if
(
p_stream
->
i_previous_pcr
==
0
&&
p_stream
->
i_pcr
>
3
*
DEFAULT_PTS_DELAY
)
p_stream
->
i_pcr
>
3
*
DEFAULT_PTS_DELAY
)
{
{
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_RESET_PCR
);
es_out_Control
(
p_
demux
->
out
,
ES_OUT_RESET_PCR
);
/* Call the pace control */
/* Call the pace control */
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_SET_PCR
,
p_stream
->
i_pcr
);
es_out_Control
(
p_
demux
->
out
,
ES_OUT_SET_PCR
,
p_stream
->
i_pcr
);
}
}
}
}
...
@@ -690,7 +684,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -690,7 +684,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
return
;
return
;
}
}
if
(
!
(
p_block
=
block_New
(
p_
input
,
p_oggpacket
->
bytes
)
)
)
return
;
if
(
!
(
p_block
=
block_New
(
p_
demux
,
p_oggpacket
->
bytes
)
)
)
return
;
if
(
p_stream
->
fmt
.
i_cat
==
AUDIO_ES
)
if
(
p_stream
->
fmt
.
i_cat
==
AUDIO_ES
)
p_block
->
i_dts
=
p_block
->
i_pts
=
i_pts
;
p_block
->
i_dts
=
p_block
->
i_pts
=
i_pts
;
...
@@ -748,7 +742,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -748,7 +742,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
if
(
p_stream
->
fmt
.
i_codec
==
VLC_FOURCC
(
't'
,
'a'
,
'r'
,
'k'
)
)
if
(
p_stream
->
fmt
.
i_codec
==
VLC_FOURCC
(
't'
,
'a'
,
'r'
,
'k'
)
)
{
{
/* FIXME: the biggest hack I've ever done */
/* FIXME: the biggest hack I've ever done */
msg_Warn
(
p_
input
,
"tarkin pts: "
I64Fd
", granule: "
I64Fd
,
msg_Warn
(
p_
demux
,
"tarkin pts: "
I64Fd
", granule: "
I64Fd
,
p_block
->
i_pts
,
p_block
->
i_dts
);
p_block
->
i_pts
,
p_block
->
i_dts
);
msleep
(
10000
);
msleep
(
10000
);
}
}
...
@@ -756,7 +750,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -756,7 +750,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
memcpy
(
p_block
->
p_buffer
,
p_oggpacket
->
packet
+
i_header_len
,
memcpy
(
p_block
->
p_buffer
,
p_oggpacket
->
packet
+
i_header_len
,
p_oggpacket
->
bytes
-
i_header_len
);
p_oggpacket
->
bytes
-
i_header_len
);
es_out_Send
(
p_
input
->
p_es_
out
,
p_stream
->
p_es
,
p_block
);
es_out_Send
(
p_
demux
->
out
,
p_stream
->
p_es
,
p_block
);
}
}
/****************************************************************************
/****************************************************************************
...
@@ -769,16 +763,16 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
...
@@ -769,16 +763,16 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
*
*
* On success this function returns VLC_SUCCESS.
* On success this function returns VLC_SUCCESS.
****************************************************************************/
****************************************************************************/
static
int
Ogg_FindLogicalStreams
(
input_thread_t
*
p_input
)
static
int
Ogg_FindLogicalStreams
(
demux_t
*
p_demux
)
{
{
demux_sys_t
*
p_ogg
=
(
demux_sys_t
*
)
p_input
->
p_demux_data
;
demux_sys_t
*
p_ogg
=
p_demux
->
p_sys
;
ogg_packet
oggpacket
;
ogg_packet
oggpacket
;
ogg_page
oggpage
;
ogg_page
oggpage
;
int
i_stream
;
int
i_stream
;
#define p_stream p_ogg->pp_stream[p_ogg->i_streams - 1]
#define p_stream p_ogg->pp_stream[p_ogg->i_streams - 1]
while
(
Ogg_ReadPage
(
p_
input
,
&
oggpage
)
==
VLC_SUCCESS
)
while
(
Ogg_ReadPage
(
p_
demux
,
&
oggpage
)
==
VLC_SUCCESS
)
{
{
if
(
ogg_page_bos
(
&
oggpage
)
)
if
(
ogg_page_bos
(
&
oggpage
)
)
{
{
...
@@ -807,7 +801,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -807,7 +801,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
if
(
ogg_stream_pagein
(
&
p_stream
->
os
,
&
oggpage
)
<
0
)
if
(
ogg_stream_pagein
(
&
p_stream
->
os
,
&
oggpage
)
<
0
)
{
{
/* error. stream version mismatch perhaps */
/* error. stream version mismatch perhaps */
msg_Err
(
p_
input
,
"error reading first page of "
msg_Err
(
p_
demux
,
"error reading first page of "
"Ogg bitstream data"
);
"Ogg bitstream data"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -820,7 +814,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -820,7 +814,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
!
strncmp
(
&
oggpacket
.
packet
[
1
],
"vorbis"
,
6
)
)
!
strncmp
(
&
oggpacket
.
packet
[
1
],
"vorbis"
,
6
)
)
{
{
Ogg_ReadVorbisHeader
(
p_stream
,
&
oggpacket
);
Ogg_ReadVorbisHeader
(
p_stream
,
&
oggpacket
);
msg_Dbg
(
p_
input
,
"found vorbis header"
);
msg_Dbg
(
p_
demux
,
"found vorbis header"
);
}
}
/* Check for Speex header */
/* Check for Speex header */
else
if
(
oggpacket
.
bytes
>=
7
&&
else
if
(
oggpacket
.
bytes
>=
7
&&
...
@@ -848,7 +842,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -848,7 +842,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
p_stream
->
fmt
.
audio
.
i_channels
=
oggpack_read
(
&
opb
,
32
);
p_stream
->
fmt
.
audio
.
i_channels
=
oggpack_read
(
&
opb
,
32
);
p_stream
->
fmt
.
i_bitrate
=
oggpack_read
(
&
opb
,
32
);
p_stream
->
fmt
.
i_bitrate
=
oggpack_read
(
&
opb
,
32
);
msg_Dbg
(
p_
input
,
"found speex header, channels: %i, "
msg_Dbg
(
p_
demux
,
"found speex header, channels: %i, "
"rate: %i, bitrate: %i"
,
"rate: %i, bitrate: %i"
,
p_stream
->
fmt
.
audio
.
i_channels
,
p_stream
->
fmt
.
audio
.
i_channels
,
(
int
)
p_stream
->
f_rate
,
p_stream
->
fmt
.
i_bitrate
);
(
int
)
p_stream
->
f_rate
,
p_stream
->
fmt
.
i_bitrate
);
...
@@ -857,7 +851,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -857,7 +851,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
else
if
(
oggpacket
.
bytes
>=
4
&&
else
if
(
oggpacket
.
bytes
>=
4
&&
!
strncmp
(
&
oggpacket
.
packet
[
0
],
"fLaC"
,
4
)
)
!
strncmp
(
&
oggpacket
.
packet
[
0
],
"fLaC"
,
4
)
)
{
{
msg_Dbg
(
p_
input
,
"found FLAC header"
);
msg_Dbg
(
p_
demux
,
"found FLAC header"
);
/* Grrrr!!!! Did they really have to put all the
/* Grrrr!!!! Did they really have to put all the
* important info in the second header packet!!!
* important info in the second header packet!!!
...
@@ -873,7 +867,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -873,7 +867,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
{
{
Ogg_ReadTheoraHeader
(
p_stream
,
&
oggpacket
);
Ogg_ReadTheoraHeader
(
p_stream
,
&
oggpacket
);
msg_Dbg
(
p_
input
,
msg_Dbg
(
p_
demux
,
"found theora header, bitrate: %i, rate: %f"
,
"found theora header, bitrate: %i, rate: %f"
,
p_stream
->
fmt
.
i_bitrate
,
p_stream
->
f_rate
);
p_stream
->
fmt
.
i_bitrate
,
p_stream
->
f_rate
);
}
}
...
@@ -883,7 +877,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -883,7 +877,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
{
{
oggpack_buffer
opb
;
oggpack_buffer
opb
;
msg_Dbg
(
p_
input
,
"found tarkin header"
);
msg_Dbg
(
p_
demux
,
"found tarkin header"
);
p_stream
->
fmt
.
i_cat
=
VIDEO_ES
;
p_stream
->
fmt
.
i_cat
=
VIDEO_ES
;
p_stream
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'a'
,
'r'
,
'k'
);
p_stream
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'a'
,
'r'
,
'k'
);
...
@@ -893,7 +887,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -893,7 +887,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
oggpack_adv
(
&
opb
,
104
);
oggpack_adv
(
&
opb
,
104
);
p_stream
->
fmt
.
i_bitrate
=
oggpack_read
(
&
opb
,
32
);
p_stream
->
fmt
.
i_bitrate
=
oggpack_read
(
&
opb
,
32
);
p_stream
->
f_rate
=
2
;
/* FIXME */
p_stream
->
f_rate
=
2
;
/* FIXME */
msg_Dbg
(
p_
input
,
msg_Dbg
(
p_
demux
,
"found tarkin header, bitrate: %i, rate: %f"
,
"found tarkin header, bitrate: %i, rate: %f"
,
p_stream
->
fmt
.
i_bitrate
,
p_stream
->
f_rate
);
p_stream
->
fmt
.
i_bitrate
,
p_stream
->
f_rate
);
}
}
...
@@ -901,7 +895,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -901,7 +895,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
else
if
(
oggpacket
.
bytes
>=
7
&&
else
if
(
oggpacket
.
bytes
>=
7
&&
!
strncmp
(
&
oggpacket
.
packet
[
0
],
"Annodex"
,
7
)
)
!
strncmp
(
&
oggpacket
.
packet
[
0
],
"Annodex"
,
7
)
)
{
{
Ogg_ReadAnnodexHeader
(
VLC_OBJECT
(
p_
input
),
p_stream
,
Ogg_ReadAnnodexHeader
(
VLC_OBJECT
(
p_
demux
),
p_stream
,
&
oggpacket
);
&
oggpacket
);
/* kill annodex track */
/* kill annodex track */
free
(
p_stream
);
free
(
p_stream
);
...
@@ -911,7 +905,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -911,7 +905,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
else
if
(
oggpacket
.
bytes
>=
7
&&
else
if
(
oggpacket
.
bytes
>=
7
&&
!
strncmp
(
&
oggpacket
.
packet
[
0
],
"AnxData"
,
7
)
)
!
strncmp
(
&
oggpacket
.
packet
[
0
],
"AnxData"
,
7
)
)
{
{
Ogg_ReadAnnodexHeader
(
VLC_OBJECT
(
p_
input
),
p_stream
,
Ogg_ReadAnnodexHeader
(
VLC_OBJECT
(
p_
demux
),
p_stream
,
&
oggpacket
);
&
oggpacket
);
}
}
else
if
(
oggpacket
.
bytes
>=
142
&&
else
if
(
oggpacket
.
bytes
>=
142
&&
...
@@ -930,7 +924,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -930,7 +924,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
oggpacket
.
packet
[
69
],
oggpacket
.
packet
[
69
],
oggpacket
.
packet
[
70
],
oggpacket
.
packet
[
70
],
oggpacket
.
packet
[
71
]
);
oggpacket
.
packet
[
71
]
);
msg_Dbg
(
p_
input
,
"found video header of type: %.4s"
,
msg_Dbg
(
p_
demux
,
"found video header of type: %.4s"
,
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
p_stream
->
f_rate
=
10000000
.
0
/
p_stream
->
f_rate
=
10000000
.
0
/
...
@@ -945,7 +939,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -945,7 +939,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
p_stream
->
fmt
.
video
.
i_height
=
p_stream
->
fmt
.
video
.
i_height
=
GetDWLE
((
oggpacket
.
packet
+
180
));
GetDWLE
((
oggpacket
.
packet
+
180
));
msg_Dbg
(
p_
input
,
msg_Dbg
(
p_
demux
,
"fps: %f, width:%i; height:%i, bitcount:%i"
,
"fps: %f, width:%i; height:%i, bitcount:%i"
,
p_stream
->
f_rate
,
p_stream
->
f_rate
,
p_stream
->
fmt
.
video
.
i_width
,
p_stream
->
fmt
.
video
.
i_width
,
...
@@ -1011,9 +1005,9 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1011,9 +1005,9 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
i_format_tag
&
0xff
);
i_format_tag
&
0xff
);
}
}
msg_Dbg
(
p_
input
,
"found audio header of type: %.4s"
,
msg_Dbg
(
p_
demux
,
"found audio header of type: %.4s"
,
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
msg_Dbg
(
p_
input
,
"audio:0x%4.4x channels:%d %dHz "
msg_Dbg
(
p_
demux
,
"audio:0x%4.4x channels:%d %dHz "
"%dbits/sample %dkb/s"
,
"%dbits/sample %dkb/s"
,
i_format_tag
,
i_format_tag
,
p_stream
->
fmt
.
audio
.
i_channels
,
p_stream
->
fmt
.
audio
.
i_channels
,
...
@@ -1024,7 +1018,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1024,7 +1018,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
}
}
else
else
{
{
msg_Dbg
(
p_
input
,
"stream %d has an old header "
msg_Dbg
(
p_
demux
,
"stream %d has an old header "
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
free
(
p_stream
);
free
(
p_stream
);
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
...
@@ -1047,7 +1041,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1047,7 +1041,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
p_stream
->
fmt
.
i_codec
=
p_stream
->
fmt
.
i_codec
=
VLC_FOURCC
(
st
->
subtype
[
0
],
st
->
subtype
[
1
],
VLC_FOURCC
(
st
->
subtype
[
0
],
st
->
subtype
[
1
],
st
->
subtype
[
2
],
st
->
subtype
[
3
]
);
st
->
subtype
[
2
],
st
->
subtype
[
3
]
);
msg_Dbg
(
p_
input
,
"found video header of type: %.4s"
,
msg_Dbg
(
p_
demux
,
"found video header of type: %.4s"
,
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
p_stream
->
f_rate
=
10000000
.
0
/
p_stream
->
f_rate
=
10000000
.
0
/
...
@@ -1059,7 +1053,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1059,7 +1053,7 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
p_stream
->
fmt
.
video
.
i_height
=
p_stream
->
fmt
.
video
.
i_height
=
GetDWLE
(
&
st
->
sh
.
video
.
height
);
GetDWLE
(
&
st
->
sh
.
video
.
height
);
msg_Dbg
(
p_
input
,
msg_Dbg
(
p_
demux
,
"fps: %f, width:%i; height:%i, bitcount:%i"
,
"fps: %f, width:%i; height:%i, bitcount:%i"
,
p_stream
->
f_rate
,
p_stream
->
f_rate
,
p_stream
->
fmt
.
video
.
i_width
,
p_stream
->
fmt
.
video
.
i_width
,
...
@@ -1120,9 +1114,9 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1120,9 +1114,9 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
i_format_tag
&
0xff
);
i_format_tag
&
0xff
);
}
}
msg_Dbg
(
p_
input
,
"found audio header of type: %.4s"
,
msg_Dbg
(
p_
demux
,
"found audio header of type: %.4s"
,
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
(
char
*
)
&
p_stream
->
fmt
.
i_codec
);
msg_Dbg
(
p_
input
,
"audio:0x%4.4x channels:%d %dHz "
msg_Dbg
(
p_
demux
,
"audio:0x%4.4x channels:%d %dHz "
"%dbits/sample %dkb/s"
,
"%dbits/sample %dkb/s"
,
i_format_tag
,
i_format_tag
,
p_stream
->
fmt
.
audio
.
i_channels
,
p_stream
->
fmt
.
audio
.
i_channels
,
...
@@ -1136,14 +1130,14 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1136,14 +1130,14 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
/* We need to get rid of the header packet */
/* We need to get rid of the header packet */
ogg_stream_packetout
(
&
p_stream
->
os
,
&
oggpacket
);
ogg_stream_packetout
(
&
p_stream
->
os
,
&
oggpacket
);
msg_Dbg
(
p_
input
,
"found text subtitles header"
);
msg_Dbg
(
p_
demux
,
"found text subtitles header"
);
p_stream
->
fmt
.
i_cat
=
SPU_ES
;
p_stream
->
fmt
.
i_cat
=
SPU_ES
;
p_stream
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
'u'
,
'b'
,
't'
);
p_stream
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
'u'
,
'b'
,
't'
);
p_stream
->
f_rate
=
1000
;
/* granulepos is in milisec */
p_stream
->
f_rate
=
1000
;
/* granulepos is in milisec */
}
}
else
else
{
{
msg_Dbg
(
p_
input
,
"stream %d has a header marker "
msg_Dbg
(
p_
demux
,
"stream %d has a header marker "
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
free
(
p_stream
);
free
(
p_stream
);
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
...
@@ -1151,13 +1145,13 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1151,13 +1145,13 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
}
}
else
else
{
{
msg_Dbg
(
p_
input
,
"stream %d is of unknown type"
,
msg_Dbg
(
p_
demux
,
"stream %d is of unknown type"
,
p_ogg
->
i_streams
-
1
);
p_ogg
->
i_streams
-
1
);
free
(
p_stream
);
free
(
p_stream
);
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
if
(
Ogg_ReadPage
(
p_
input
,
&
oggpage
)
!=
VLC_SUCCESS
)
if
(
Ogg_ReadPage
(
p_
demux
,
&
oggpage
)
!=
VLC_SUCCESS
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -1185,40 +1179,35 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
...
@@ -1185,40 +1179,35 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input )
* Ogg_BeginningOfStream: Look for Beginning of Stream ogg pages and add
* Ogg_BeginningOfStream: Look for Beginning of Stream ogg pages and add
* Elementary streams.
* Elementary streams.
****************************************************************************/
****************************************************************************/
static
int
Ogg_BeginningOfStream
(
input_thread_t
*
p_input
)
static
int
Ogg_BeginningOfStream
(
demux_t
*
p_demux
)
{
{
demux_sys_t
*
p_ogg
=
(
demux_sys_t
*
)
p_input
->
p_demux_data
;
demux_sys_t
*
p_ogg
=
p_demux
->
p_sys
;
int
i_stream
;
int
i_stream
;
/* Find the logical streams embedded in the physical stream and
/* Find the logical streams embedded in the physical stream and
* initialize our p_ogg structure. */
* initialize our p_ogg structure. */
if
(
Ogg_FindLogicalStreams
(
p_
input
)
!=
VLC_SUCCESS
)
if
(
Ogg_FindLogicalStreams
(
p_
demux
)
!=
VLC_SUCCESS
)
{
{
msg_Warn
(
p_
input
,
"couldn't find any ogg logical stream"
);
msg_Warn
(
p_
demux
,
"couldn't find any ogg logical stream"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_ogg
->
i_bitrate
=
0
;
p_input
->
stream
.
i_mux_rate
=
0
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
for
(
i_stream
=
0
;
i_stream
<
p_ogg
->
i_streams
;
i_stream
++
)
for
(
i_stream
=
0
;
i_stream
<
p_ogg
->
i_streams
;
i_stream
++
)
{
{
#define p_stream p_ogg->pp_stream[i_stream]
#define p_stream p_ogg->pp_stream[i_stream]
if
(
p_stream
->
fmt
.
i_codec
!=
VLC_FOURCC
(
'f'
,
'l'
,
'a'
,
'c'
)
)
if
(
p_stream
->
fmt
.
i_codec
!=
VLC_FOURCC
(
'f'
,
'l'
,
'a'
,
'c'
)
)
p_stream
->
p_es
=
es_out_Add
(
p_
input
->
p_es_
out
,
&
p_stream
->
fmt
);
p_stream
->
p_es
=
es_out_Add
(
p_
demux
->
out
,
&
p_stream
->
fmt
);
if
(
p_stream
->
fmt
.
i_codec
==
VLC_FOURCC
(
'c'
,
'm'
,
'm'
,
'l'
)
)
if
(
p_stream
->
fmt
.
i_codec
==
VLC_FOURCC
(
'c'
,
'm'
,
'm'
,
'l'
)
)
{
{
/* Set the CMML stream active */
/* Set the CMML stream active */
es_out_Control
(
p_
input
->
p_es_
out
,
ES_OUT_SET_ES
,
es_out_Control
(
p_
demux
->
out
,
ES_OUT_SET_ES
,
p_stream
->
p_es
);
p_stream
->
p_es
);
}
}
p_ogg
->
i_bitrate
+=
p_stream
->
fmt
.
i_bitrate
;
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
stream
.
i_mux_rate
+=
(
p_stream
->
fmt
.
i_bitrate
/
(
8
*
50
));
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
p_stream
->
i_pcr
=
p_stream
->
i_previous_pcr
=
p_stream
->
i_pcr
=
p_stream
->
i_previous_pcr
=
p_stream
->
i_interpolated_pcr
=
-
1
;
p_stream
->
i_interpolated_pcr
=
-
1
;
...
@@ -1232,20 +1221,18 @@ static int Ogg_BeginningOfStream( input_thread_t *p_input )
...
@@ -1232,20 +1221,18 @@ static int Ogg_BeginningOfStream( input_thread_t *p_input )
/****************************************************************************
/****************************************************************************
* Ogg_EndOfStream: clean up the ES when an End of Stream is detected.
* Ogg_EndOfStream: clean up the ES when an End of Stream is detected.
****************************************************************************/
****************************************************************************/
static
void
Ogg_EndOfStream
(
input_thread_t
*
p_input
)
static
void
Ogg_EndOfStream
(
demux_t
*
p_demux
)
{
{
demux_sys_t
*
p_ogg
=
(
demux_sys_t
*
)
p_input
->
p_demux_data
;
demux_sys_t
*
p_ogg
=
p_demux
->
p_sys
;
int
i_stream
,
j
;
int
i_stream
,
j
;
#define p_stream p_ogg->pp_stream[i_stream]
#define p_stream p_ogg->pp_stream[i_stream]
for
(
i_stream
=
0
;
i_stream
<
p_ogg
->
i_streams
;
i_stream
++
)
for
(
i_stream
=
0
;
i_stream
<
p_ogg
->
i_streams
;
i_stream
++
)
{
{
if
(
p_stream
->
p_es
)
if
(
p_stream
->
p_es
)
es_out_Del
(
p_
input
->
p_es_
out
,
p_stream
->
p_es
);
es_out_Del
(
p_
demux
->
out
,
p_stream
->
p_es
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
p_ogg
->
i_bitrate
-=
p_stream
->
fmt
.
i_bitrate
;
p_input
->
stream
.
i_mux_rate
-=
(
p_stream
->
fmt
.
i_bitrate
/
(
8
*
50
));
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
ogg_stream_clear
(
&
p_ogg
->
pp_stream
[
i_stream
]
->
os
);
ogg_stream_clear
(
&
p_ogg
->
pp_stream
[
i_stream
]
->
os
);
for
(
j
=
0
;
j
<
p_ogg
->
pp_stream
[
i_stream
]
->
i_packets_backup
;
j
++
)
for
(
j
=
0
;
j
<
p_ogg
->
pp_stream
[
i_stream
]
->
i_packets_backup
;
j
++
)
...
...
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