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
3ed9cb74
Commit
3ed9cb74
authored
May 24, 2010
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MKV: code factorisation around extra_data filling
parent
2b5aff22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
34 deletions
+19
-34
modules/demux/mkv/matroska_segment.cpp
modules/demux/mkv/matroska_segment.cpp
+19
-34
No files found.
modules/demux/mkv/matroska_segment.cpp
View file @
3ed9cb74
...
@@ -744,6 +744,13 @@ int matroska_segment_c::BlockFindTrackIndex( size_t *pi_track,
...
@@ -744,6 +744,13 @@ int matroska_segment_c::BlockFindTrackIndex( size_t *pi_track,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
inline
void
fill_extra_data
(
mkv_track_t
*
p_tk
)
{
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
bool
matroska_segment_c
::
Select
(
mtime_t
i_start_time
)
bool
matroska_segment_c
::
Select
(
mtime_t
i_start_time
)
{
{
/* add all es */
/* add all es */
...
@@ -794,9 +801,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -794,9 +801,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
else
if
(
!
strncmp
(
p_tk
->
psz_codec
,
"V_THEORA"
,
8
)
)
else
if
(
!
strncmp
(
p_tk
->
psz_codec
,
"V_THEORA"
,
8
)
)
{
{
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_THEORA
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_THEORA
;
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
p_tk
->
b_pts_only
=
true
;
p_tk
->
b_pts_only
=
true
;
}
}
else
if
(
!
strncmp
(
p_tk
->
psz_codec
,
"V_REAL/RV"
,
9
)
)
else
if
(
!
strncmp
(
p_tk
->
psz_codec
,
"V_REAL/RV"
,
9
)
)
...
@@ -843,9 +848,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -843,9 +848,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
p_tk
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'v'
,
'c'
,
'1'
);
p_tk
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'v'
,
'c'
,
'1'
);
else
else
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_MP4V
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_MP4V
;
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"V_QUICKTIME"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"V_QUICKTIME"
)
)
...
@@ -930,16 +933,12 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -930,16 +933,12 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_FLAC"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_FLAC"
)
)
{
{
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_FLAC
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_FLAC
;
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_VORBIS"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_VORBIS"
)
)
{
{
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_VORBIS
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_VORBIS
;
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
else
if
(
!
strncmp
(
p_tk
->
psz_codec
,
"A_AAC/MPEG2/"
,
strlen
(
"A_AAC/MPEG2/"
)
)
||
else
if
(
!
strncmp
(
p_tk
->
psz_codec
,
"A_AAC/MPEG2/"
,
strlen
(
"A_AAC/MPEG2/"
)
)
||
!
strncmp
(
p_tk
->
psz_codec
,
"A_AAC/MPEG4/"
,
strlen
(
"A_AAC/MPEG4/"
)
)
)
!
strncmp
(
p_tk
->
psz_codec
,
"A_AAC/MPEG4/"
,
strlen
(
"A_AAC/MPEG4/"
)
)
)
...
@@ -1004,25 +1003,19 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1004,25 +1003,19 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_AAC"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_AAC"
)
)
{
{
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_MP4A
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_MP4A
;
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_WAVPACK4"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_WAVPACK4"
)
)
{
{
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_WAVPACK
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_WAVPACK
;
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_TTA1"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_TTA1"
)
)
{
{
p_fmt
->
i_codec
=
VLC_CODEC_TTA
;
p_fmt
->
i_codec
=
VLC_CODEC_TTA
;
p_fmt
->
i_extra
=
p_tk
->
i_extra_data
;
if
(
p_tk
->
i_extra_data
>
0
)
if
(
p_fmt
->
i_extra
>
0
)
{
{
p_fmt
->
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
fill_extra_data
(
p_tk
);
memcpy
(
p_fmt
->
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
else
else
{
{
...
@@ -1061,9 +1054,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1061,9 +1054,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_REAL/28_8"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_REAL/28_8"
)
)
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_RA_288
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_RA_288
;
/* FIXME 14_4, RALF and SIPR */
/* FIXME 14_4, RALF and SIPR */
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_REAL/14_4"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"A_REAL/14_4"
)
)
{
{
...
@@ -1081,9 +1072,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1081,9 +1072,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_KATE
;
p_tk
->
fmt
.
i_codec
=
VLC_CODEC_KATE
;
p_tk
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
p_tk
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"S_TEXT/ASCII"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"S_TEXT/ASCII"
)
)
{
{
...
@@ -1101,9 +1090,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1101,9 +1090,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
p_tk
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
p_tk
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
if
(
p_tk
->
i_extra_data
)
if
(
p_tk
->
i_extra_data
)
{
{
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"S_TEXT/SSA"
)
||
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"S_TEXT/SSA"
)
||
...
@@ -1115,9 +1102,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1115,9 +1102,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
p_tk
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
p_tk
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
if
(
p_tk
->
i_extra_data
)
if
(
p_tk
->
i_extra_data
)
{
{
p_tk
->
fmt
.
i_extra
=
p_tk
->
i_extra_data
;
fill_extra_data
(
p_tk
);
p_tk
->
fmt
.
p_extra
=
xmalloc
(
p_tk
->
i_extra_data
);
memcpy
(
p_tk
->
fmt
.
p_extra
,
p_tk
->
p_extra_data
,
p_tk
->
i_extra_data
);
}
}
}
}
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"S_VOBSUB"
)
)
else
if
(
!
strcmp
(
p_tk
->
psz_codec
,
"S_VOBSUB"
)
)
...
...
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