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
38de02fe
Commit
38de02fe
authored
Mar 19, 2015
by
Steve Lhomme
Committed by
Jean-Baptiste Kempf
Mar 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MKV: factorize the es_out_Send() and es_out_Control() calls
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
a27dd41e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
50 deletions
+60
-50
modules/demux/mkv/mkv.cpp
modules/demux/mkv/mkv.cpp
+2
-49
modules/demux/mkv/util.cpp
modules/demux/mkv/util.cpp
+57
-1
modules/demux/mkv/util.hpp
modules/demux/mkv/util.hpp
+1
-0
No files found.
modules/demux/mkv/mkv.cpp
View file @
38de02fe
...
@@ -532,7 +532,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
...
@@ -532,7 +532,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
msg_Dbg
(
p_demux
,
"sending header (%d bytes)"
,
tk
->
i_data_init
);
msg_Dbg
(
p_demux
,
"sending header (%d bytes)"
,
tk
->
i_data_init
);
p_init
=
MemToBlock
(
tk
->
p_data_init
,
tk
->
i_data_init
,
0
);
p_init
=
MemToBlock
(
tk
->
p_data_init
,
tk
->
i_data_init
,
0
);
if
(
p_init
)
es_out_Send
(
p_demux
->
out
,
tk
->
p_es
,
p_init
);
if
(
p_init
)
send_Block
(
p_demux
,
tk
,
p_init
,
1
,
0
);
}
}
tk
->
b_inited
=
true
;
tk
->
b_inited
=
true
;
...
@@ -643,14 +643,6 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
...
@@ -643,14 +643,6 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
block_Release
(
p_block
);
block_Release
(
p_block
);
return
;
return
;
}
}
else
if
(
tk
->
fmt
.
i_cat
==
AUDIO_ES
)
{
if
(
tk
->
i_chans_to_reorder
)
aout_ChannelReorder
(
p_block
->
p_buffer
,
p_block
->
i_buffer
,
tk
->
fmt
.
audio
.
i_channels
,
tk
->
pi_chan_table
,
tk
->
fmt
.
i_codec
);
}
p_block
->
i_dts
=
p_block
->
i_pts
=
i_pts
;
p_block
->
i_dts
=
p_block
->
i_pts
=
i_pts
;
}
}
else
else
...
@@ -678,47 +670,8 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
...
@@ -678,47 +670,8 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
p_block
->
i_dts
=
min
(
i_pts
,
tk
->
i_last_dts
+
(
mtime_t
)
tk
->
i_default_duration
);
p_block
->
i_dts
=
min
(
i_pts
,
tk
->
i_last_dts
+
(
mtime_t
)
tk
->
i_default_duration
);
}
}
}
}
if
(
p_block
->
i_dts
>
VLC_TS_INVALID
&&
(
tk
->
fmt
.
i_cat
==
VIDEO_ES
||
tk
->
fmt
.
i_cat
==
AUDIO_ES
)
)
{
tk
->
i_last_dts
=
p_block
->
i_dts
;
}
#if 0
msg_Dbg( p_demux, "block (track=%d) i_dts: %"PRId64" / i_pts: %"PRId64, tk->i_number, p_block->i_dts, p_block->i_pts);
#endif
if
(
!
tk
->
b_no_duration
)
{
p_block
->
i_length
=
i_duration
*
tk
->
f_timecodescale
*
(
double
)
p_segment
->
i_timescale
/
(
1000.0
*
i_number_frames
);
}
// find the latest DTS for an active track
mtime_t
i_ts_max
=
INT64_MIN
;
for
(
size_t
i
=
0
;
i
<
p_segment
->
tracks
.
size
();
i
++
)
{
mkv_track_t
*
tk
=
p_segment
->
tracks
[
i
];
if
(
tk
->
i_last_dts
>
VLC_TS_INVALID
)
i_ts_max
=
__MAX
(
i_ts_max
,
tk
->
i_last_dts
);
}
// find the earliest DTS less than 10 clock ticks away from the latest DTS
mtime_t
i_ts_min
=
INT64_MAX
;
for
(
size_t
i
=
0
;
i
<
p_segment
->
tracks
.
size
();
i
++
)
{
mkv_track_t
*
tk
=
p_segment
->
tracks
[
i
];
if
(
tk
->
i_last_dts
>
VLC_TS_INVALID
&&
tk
->
i_last_dts
+
10
*
CLOCK_FREQ
>=
i_ts_max
)
i_ts_min
=
__MIN
(
i_ts_min
,
tk
->
i_last_dts
);
}
// the PCR is the earliest active DTS if we found one
if
(
i_ts_min
!=
INT64_MAX
&&
(
i_ts_min
>
p_sys
->
i_pcr
||
p_sys
->
i_pcr
==
VLC_TS_INVALID
)
)
{
p_sys
->
i_pcr
=
i_ts_min
;
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
i_ts_min
);
}
es_out_Send
(
p_demux
->
out
,
tk
->
p_es
,
p_block
);
send_Block
(
p_demux
,
tk
,
p_block
,
i_number_frames
,
i_duration
);
/* use time stamp only for first block */
/* use time stamp only for first block */
i_pts
=
(
tk
->
i_default_duration
)
?
i_pts
=
(
tk
->
i_default_duration
)
?
...
...
modules/demux/mkv/util.cpp
View file @
38de02fe
...
@@ -236,13 +236,69 @@ void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, m
...
@@ -236,13 +236,69 @@ void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, m
{
{
for
(
size_t
i
=
0
;
i
<
p_sys
->
i_subpackets
;
i
++
)
for
(
size_t
i
=
0
;
i
<
p_sys
->
i_subpackets
;
i
++
)
{
{
es_out_Send
(
p_demux
->
out
,
p_tk
->
p_es
,
p_sys
->
p_subpackets
[
i
]
);
send_Block
(
p_demux
,
p_tk
,
p_sys
->
p_subpackets
[
i
],
1
,
0
);
p_sys
->
p_subpackets
[
i
]
=
NULL
;
p_sys
->
p_subpackets
[
i
]
=
NULL
;
}
}
p_sys
->
i_subpacket
=
0
;
p_sys
->
i_subpacket
=
0
;
}
}
}
}
void
send_Block
(
demux_t
*
p_demux
,
mkv_track_t
*
p_tk
,
block_t
*
p_block
,
unsigned
int
i_number_frames
,
mtime_t
i_duration
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
matroska_segment_c
*
p_segment
=
p_sys
->
p_current_segment
->
CurrentSegment
();
if
(
p_tk
->
fmt
.
i_cat
==
AUDIO_ES
&&
p_tk
->
i_chans_to_reorder
)
{
aout_ChannelReorder
(
p_block
->
p_buffer
,
p_block
->
i_buffer
,
p_tk
->
fmt
.
audio
.
i_channels
,
p_tk
->
pi_chan_table
,
p_tk
->
fmt
.
i_codec
);
}
if
(
p_block
->
i_dts
>
VLC_TS_INVALID
&&
(
p_tk
->
fmt
.
i_cat
==
VIDEO_ES
||
p_tk
->
fmt
.
i_cat
==
AUDIO_ES
)
)
{
p_tk
->
i_last_dts
=
p_block
->
i_dts
;
}
if
(
!
p_tk
->
b_no_duration
)
{
p_block
->
i_length
=
i_duration
*
p_tk
->
f_timecodescale
*
(
double
)
p_segment
->
i_timescale
/
(
1000.0
*
i_number_frames
);
}
// find the latest DTS for an active track
mtime_t
i_ts_max
=
INT64_MIN
;
for
(
size_t
j
=
0
;
j
<
p_segment
->
tracks
.
size
();
j
++
)
{
mkv_track_t
*
tk
=
p_segment
->
tracks
[
j
];
if
(
tk
->
i_last_dts
>
VLC_TS_INVALID
)
i_ts_max
=
__MAX
(
i_ts_max
,
tk
->
i_last_dts
);
}
// find the earliest DTS less than 10 clock ticks away from the latest DTS
mtime_t
i_ts_min
=
INT64_MAX
;
for
(
size_t
j
=
0
;
j
<
p_segment
->
tracks
.
size
();
j
++
)
{
mkv_track_t
*
tk
=
p_segment
->
tracks
[
j
];
if
(
tk
->
i_last_dts
>
VLC_TS_INVALID
&&
tk
->
i_last_dts
+
10
*
CLOCK_FREQ
>=
i_ts_max
)
i_ts_min
=
__MIN
(
i_ts_min
,
tk
->
i_last_dts
);
}
// the PCR is the earliest active DTS if we found one
if
(
i_ts_min
!=
INT64_MAX
&&
(
i_ts_min
>
p_sys
->
i_pcr
||
p_sys
->
i_pcr
==
VLC_TS_INVALID
)
)
{
p_sys
->
i_pcr
=
i_ts_min
;
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
i_ts_min
);
}
#if 0
msg_Dbg( p_demux, "block (track=%d) i_dts: %"PRId64" / i_pts: %"PRId64, p_tk->i_number, p_block->i_dts, p_block->i_pts);
#endif
es_out_Send
(
p_demux
->
out
,
p_tk
->
p_es
,
p_block
);
}
int32_t
Cook_PrivateTrackData
::
Init
()
int32_t
Cook_PrivateTrackData
::
Init
()
{
{
i_subpackets
=
(
size_t
)
i_sub_packet_h
*
(
size_t
)
i_frame_size
/
(
size_t
)
i_subpacket_size
;
i_subpackets
=
(
size_t
)
i_sub_packet_h
*
(
size_t
)
i_frame_size
/
(
size_t
)
i_subpacket_size
;
...
...
modules/demux/mkv/util.hpp
View file @
38de02fe
...
@@ -32,6 +32,7 @@ block_t *block_zlib_decompress( vlc_object_t *p_this, block_t *p_in_block );
...
@@ -32,6 +32,7 @@ block_t *block_zlib_decompress( vlc_object_t *p_this, block_t *p_in_block );
block_t
*
MemToBlock
(
uint8_t
*
p_mem
,
size_t
i_mem
,
size_t
offset
);
block_t
*
MemToBlock
(
uint8_t
*
p_mem
,
size_t
i_mem
,
size_t
offset
);
void
handle_real_audio
(
demux_t
*
p_demux
,
mkv_track_t
*
p_tk
,
block_t
*
p_blk
,
mtime_t
i_pts
);
void
handle_real_audio
(
demux_t
*
p_demux
,
mkv_track_t
*
p_tk
,
block_t
*
p_blk
,
mtime_t
i_pts
);
void
send_Block
(
demux_t
*
p_demux
,
mkv_track_t
*
p_tk
,
block_t
*
p_block
,
unsigned
int
i_number_frames
,
mtime_t
i_duration
);
struct
real_audio_private
struct
real_audio_private
...
...
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