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
7f84c8c8
Commit
7f84c8c8
authored
May 22, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MKV: misc simplifications, renaming and privatizations
parent
2e56d2ef
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
67 additions
and
70 deletions
+67
-70
modules/demux/mkv/chapters.cpp
modules/demux/mkv/chapters.cpp
+1
-1
modules/demux/mkv/chapters.hpp
modules/demux/mkv/chapters.hpp
+10
-8
modules/demux/mkv/demux.cpp
modules/demux/mkv/demux.cpp
+1
-1
modules/demux/mkv/matroska_segment.hpp
modules/demux/mkv/matroska_segment.hpp
+1
-1
modules/demux/mkv/matroska_segment_parse.cpp
modules/demux/mkv/matroska_segment_parse.cpp
+11
-20
modules/demux/mkv/mkv.cpp
modules/demux/mkv/mkv.cpp
+9
-9
modules/demux/mkv/mkv.hpp
modules/demux/mkv/mkv.hpp
+25
-21
modules/demux/mkv/virtual_segment.cpp
modules/demux/mkv/virtual_segment.cpp
+8
-8
modules/demux/mkv/virtual_segment.hpp
modules/demux/mkv/virtual_segment.hpp
+1
-1
No files found.
modules/demux/mkv/chapters.cpp
View file @
7f84c8c8
...
...
@@ -316,7 +316,7 @@ bool chapter_item_c::EnterAndLeave( chapter_item_c *p_item, bool b_final_enter )
{
if
(
!
p_common_parent
->
b_is_leaving
&&
p_common_parent
->
Leave
(
false
)
)
return
true
;
p_common_parent
=
p_common_parent
->
p
sz
_parent
;
p_common_parent
=
p_common_parent
->
p_parent
;
}
// enter from the parent to <this>
...
...
modules/demux/mkv/chapters.hpp
View file @
7f84c8c8
...
...
@@ -58,17 +58,18 @@ public:
,
i_seekpoint_num
(
-
1
)
,
b_display_seekpoint
(
true
)
,
b_user_display
(
false
)
,
p
sz
_parent
(
NULL
)
,
p_parent
(
NULL
)
,
b_is_leaving
(
false
)
{}
virtual
~
chapter_item_c
();
int64_t
RefreshChapters
(
bool
b_ordered
,
int64_t
i_prev_user_time
);
int
PublishChapters
(
input_title_t
&
title
,
int
&
i_user_chapters
,
int
i_level
=
0
);
int
PublishChapters
(
input_title_t
&
title
,
int
&
i_user_chapters
,
int
i_level
);
virtual
chapter_item_c
*
FindTimecode
(
mtime_t
i_timecode
,
const
chapter_item_c
*
p_current
,
bool
&
b_found
);
void
Append
(
const
chapter_item_c
&
edition
);
chapter_item_c
*
FindChapter
(
int64_t
i_find_uid
);
virtual
chapter_item_c
*
BrowseCodecPrivate
(
unsigned
int
codec_id
,
bool
(
*
match
)(
const
chapter_codec_cmds_c
&
data
,
const
void
*
p_cookie
,
size_t
i_cookie_size
),
const
void
*
p_cookie
,
...
...
@@ -76,7 +77,7 @@ public:
std
::
string
GetCodecName
(
bool
f_for_title
=
false
)
const
;
bool
ParentOf
(
const
chapter_item_c
&
item
)
const
;
int16
GetTitleNumber
(
)
const
;
int64_t
i_start_time
,
i_end_time
;
int64_t
i_user_start_time
,
i_user_end_time
;
/* the time in the stream when an edition is ordered */
std
::
vector
<
chapter_item_c
*>
sub_chapters
;
...
...
@@ -85,14 +86,15 @@ public:
bool
b_display_seekpoint
;
bool
b_user_display
;
std
::
string
psz_name
;
chapter_item_c
*
p
sz
_parent
;
chapter_item_c
*
p_parent
;
bool
b_is_leaving
;
std
::
vector
<
chapter_codec_cmds_c
*>
codecs
;
static
bool
CompareTimecode
(
const
chapter_item_c
*
itemA
,
const
chapter_item_c
*
itemB
)
{
return
(
itemA
->
i_user_start_time
<
itemB
->
i_user_start_time
||
(
itemA
->
i_user_start_time
==
itemB
->
i_user_start_time
&&
itemA
->
i_user_end_time
<
itemB
->
i_user_end_time
)
);
return
(
itemA
->
i_user_start_time
<
itemB
->
i_user_start_time
||
(
itemA
->
i_user_start_time
==
itemB
->
i_user_start_time
&&
itemA
->
i_user_end_time
<
itemB
->
i_user_end_time
)
);
}
bool
Enter
(
bool
b_do_subchapters
);
...
...
@@ -106,12 +108,12 @@ public:
chapter_edition_c
()
:
b_ordered
(
false
)
{}
void
RefreshChapters
(
);
mtime_t
Duration
()
const
;
std
::
string
GetMainName
()
const
;
chapter_item_c
*
FindTimecode
(
mtime_t
i_timecode
,
const
chapter_item_c
*
p_current
);
bool
b_ordered
;
};
...
...
modules/demux/mkv/demux.cpp
View file @
7f84c8c8
...
...
@@ -501,7 +501,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
return
NULL
;
}
matroska_stream_c
*
p_stream1
=
new
matroska_stream_c
(
*
this
);
matroska_stream_c
*
p_stream1
=
new
matroska_stream_c
();
while
(
p_l0
!=
0
)
{
...
...
modules/demux/mkv/matroska_segment.hpp
View file @
7f84c8c8
...
...
@@ -96,7 +96,7 @@ public:
EbmlParser
*
ep
;
bool
b_preloaded
;
bool
Preload
(
);
bool
Preload
();
bool
PreloadFamily
(
const
matroska_segment_c
&
segment
);
void
InformationCreate
();
void
Seek
(
mtime_t
i_date
,
mtime_t
i_time_offset
,
int64_t
i_global_position
);
...
...
modules/demux/mkv/matroska_segment_parse.cpp
View file @
7f84c8c8
...
...
@@ -952,7 +952,7 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
{
chapter_item_c
*
new_sub_chapter
=
new
chapter_item_c
();
ParseChapterAtom
(
i_level
+
1
,
static_cast
<
KaxChapterAtom
*>
(
l
),
*
new_sub_chapter
);
new_sub_chapter
->
p
sz
_parent
=
&
chapters
;
new_sub_chapter
->
p_parent
=
&
chapters
;
chapters
.
sub_chapters
.
push_back
(
new_sub_chapter
);
}
}
...
...
@@ -972,28 +972,19 @@ void matroska_segment_c::ParseAttachments( KaxAttachments *attachments )
while
(
attachedFile
&&
(
attachedFile
->
GetSize
()
>
0
)
)
{
std
::
string
psz_mime_type
=
GetChild
<
KaxMimeType
>
(
*
attachedFile
);
KaxFileName
&
file_name
=
GetChild
<
KaxFileName
>
(
*
attachedFile
);
KaxFileData
&
img_data
=
GetChild
<
KaxFileData
>
(
*
attachedFile
);
attachment_c
*
new_attachment
=
new
attachment_c
(
ToUTF8
(
UTFstring
(
GetChild
<
KaxFileName
>
(
*
attachedFile
)
)
),
GetChild
<
KaxMimeType
>
(
*
attachedFile
),
img_data
.
GetSize
()
);
attachment_c
*
new_attachment
=
new
attachment_c
();
if
(
new_attachment
)
if
(
new_attachment
->
init
()
)
{
new_attachment
->
psz_file_name
=
ToUTF8
(
UTFstring
(
file_name
)
);
new_attachment
->
psz_mime_type
=
psz_mime_type
;
new_attachment
->
i_size
=
img_data
.
GetSize
();
new_attachment
->
p_data
=
malloc
(
img_data
.
GetSize
()
);
if
(
new_attachment
->
p_data
)
{
memcpy
(
new_attachment
->
p_data
,
img_data
.
GetBuffer
(),
img_data
.
GetSize
()
);
sys
.
stored_attachments
.
push_back
(
new_attachment
);
}
else
{
delete
new_attachment
;
}
memcpy
(
new_attachment
->
p_data
,
img_data
.
GetBuffer
(),
img_data
.
GetSize
()
);
sys
.
stored_attachments
.
push_back
(
new_attachment
);
}
else
{
delete
new_attachment
;
}
attachedFile
=
&
GetNextChild
<
KaxAttached
>
(
*
attachments
,
*
attachedFile
);
...
...
modules/demux/mkv/mkv.cpp
View file @
7f84c8c8
...
...
@@ -76,7 +76,7 @@ class demux_sys_t;
static
int
Demux
(
demux_t
*
);
static
int
Control
(
demux_t
*
,
int
,
va_list
);
static
void
Seek
(
demux_t
*
,
mtime_t
i_date
,
double
f_percent
,
chapter_item_c
*
p
sz
_chapter
);
static
void
Seek
(
demux_t
*
,
mtime_t
i_date
,
double
f_percent
,
chapter_item_c
*
p_chapter
);
/*****************************************************************************
* Open: initializes matroska demux structures
...
...
@@ -123,8 +123,8 @@ static int Open( vlc_object_t * p_this )
}
p_sys
->
streams
.
push_back
(
p_stream
);
p_stream
->
p_i
n
=
p_io_callback
;
p_stream
->
p_es
=
p_io_stream
;
p_stream
->
p_i
o_callback
=
p_io_callback
;
p_stream
->
p_es
tream
=
p_io_stream
;
for
(
size_t
i
=
0
;
i
<
p_stream
->
segments
.
size
();
i
++
)
{
...
...
@@ -214,8 +214,8 @@ static int Open( vlc_object_t * p_this )
}
else
{
p_stream
->
p_i
n
=
p_file_io
;
p_stream
->
p_es
=
p_estream
;
p_stream
->
p_i
o_callback
=
p_file_io
;
p_stream
->
p_es
tream
=
p_estream
;
p_sys
->
streams
.
push_back
(
p_stream
);
}
}
...
...
@@ -297,8 +297,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
for
(
size_t
i
=
0
;
i
<
p_sys
->
stored_attachments
.
size
();
i
++
)
{
attachment_c
*
a
=
p_sys
->
stored_attachments
[
i
];
(
*
ppp_attach
)[
i
]
=
vlc_input_attachment_New
(
a
->
psz_file_name
.
c_str
(),
a
->
psz_mime_type
.
c_str
(),
NULL
,
a
->
p_data
,
a
->
i_size
);
(
*
ppp_attach
)[
i
]
=
vlc_input_attachment_New
(
a
->
fileName
(),
a
->
mimeType
(),
NULL
,
a
->
p_data
,
a
->
size
()
);
}
return
VLC_SUCCESS
;
...
...
@@ -397,7 +397,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
/* Seek */
static
void
Seek
(
demux_t
*
p_demux
,
mtime_t
i_date
,
double
f_percent
,
chapter_item_c
*
p
sz
_chapter
)
static
void
Seek
(
demux_t
*
p_demux
,
mtime_t
i_date
,
double
f_percent
,
chapter_item_c
*
p_chapter
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
virtual_segment_c
*
p_vsegment
=
p_sys
->
p_current_segment
;
...
...
@@ -453,7 +453,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, chapter_it
}
}
p_vsegment
->
Seek
(
*
p_demux
,
i_date
,
i_time_offset
,
p
sz
_chapter
,
i_global_position
);
p_vsegment
->
Seek
(
*
p_demux
,
i_date
,
i_time_offset
,
p_chapter
,
i_global_position
);
}
/* Utility function for BlockDecode */
...
...
modules/demux/mkv/mkv.hpp
View file @
7f84c8c8
...
...
@@ -127,44 +127,48 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
class
attachment_c
{
public:
attachment_c
()
:
p_data
(
NULL
)
,
i_size
(
0
)
{}
virtual
~
attachment_c
()
attachment_c
(
std
::
string
_psz_file_name
,
std
::
string
_psz_mime_type
,
int
_i_size
)
:
i_size
(
_i_size
)
,
psz_file_name
(
_psz_file_name
)
,
psz_mime_type
(
_psz_mime_type
)
{
free
(
p_data
)
;
p_data
=
NULL
;
}
virtual
~
attachment_c
()
{
free
(
p_data
);
}
/* Allocs the data space. Returns true if allocation went ok */
bool
init
()
{
p_data
=
malloc
(
i_size
);
return
(
p_data
!=
NULL
);
}
const
char
*
fileName
()
{
return
psz_file_name
.
c_str
();
}
const
char
*
mimeType
()
{
return
psz_mime_type
.
c_str
();
}
int
size
()
{
return
i_size
;
}
std
::
string
psz_file_name
;
std
::
string
psz_mime_type
;
void
*
p_data
;
private:
int
i_size
;
std
::
string
psz_file_name
;
std
::
string
psz_mime_type
;
};
class
matroska_segment_c
;
class
matroska_stream_c
{
public:
matroska_stream_c
(
demux_sys_t
&
demuxer
)
:
p_in
(
NULL
)
,
p_es
(
NULL
)
,
sys
(
demuxer
)
{}
matroska_stream_c
()
:
p_io_callback
(
NULL
)
,
p_estream
(
NULL
)
{}
virtual
~
matroska_stream_c
()
{
delete
p_i
n
;
delete
p_es
;
delete
p_i
o_callback
;
delete
p_es
tream
;
}
IOCallback
*
p_i
n
;
EbmlStream
*
p_es
;
IOCallback
*
p_i
o_callback
;
EbmlStream
*
p_es
tream
;
std
::
vector
<
matroska_segment_c
*>
segments
;
demux_sys_t
&
sys
;
};
...
...
modules/demux/mkv/virtual_segment.cpp
View file @
7f84c8c8
...
...
@@ -203,30 +203,30 @@ void virtual_segment_c::AppendUID( const EbmlBinary * p_UID )
linked_uids
.
push_back
(
*
(
KaxSegmentUID
*
)(
p_UID
)
);
}
void
virtual_segment_c
::
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
chapter_item_c
*
p
sz
_chapter
,
int64_t
i_global_position
)
void
virtual_segment_c
::
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
chapter_item_c
*
p_chapter
,
int64_t
i_global_position
)
{
demux_sys_t
*
p_sys
=
demuxer
.
p_sys
;
size_t
i
;
// find the actual time for an ordered edition
if
(
p
sz
_chapter
==
NULL
)
if
(
p_chapter
==
NULL
)
{
if
(
CurrentEdition
()
&&
CurrentEdition
()
->
b_ordered
)
{
/* 1st, we need to know in which chapter we are */
p
sz
_chapter
=
(
*
p_editions
)[
i_current_edition
]
->
FindTimecode
(
i_date
,
p_current_chapter
);
p_chapter
=
(
*
p_editions
)[
i_current_edition
]
->
FindTimecode
(
i_date
,
p_current_chapter
);
}
}
if
(
p
sz
_chapter
!=
NULL
)
if
(
p_chapter
!=
NULL
)
{
p_current_chapter
=
p
sz
_chapter
;
p_sys
->
i_chapter_time
=
i_time_offset
=
p
sz_chapter
->
i_user_start_time
-
psz
_chapter
->
i_start_time
;
if
(
p
sz
_chapter
->
i_seekpoint_num
>
0
)
p_current_chapter
=
p_chapter
;
p_sys
->
i_chapter_time
=
i_time_offset
=
p
_chapter
->
i_user_start_time
-
p
_chapter
->
i_start_time
;
if
(
p_chapter
->
i_seekpoint_num
>
0
)
{
demuxer
.
info
.
i_update
|=
INPUT_UPDATE_TITLE
|
INPUT_UPDATE_SEEKPOINT
;
demuxer
.
info
.
i_title
=
p_sys
->
i_current_title
=
i_sys_title
;
demuxer
.
info
.
i_seekpoint
=
p
sz
_chapter
->
i_seekpoint_num
-
1
;
demuxer
.
info
.
i_seekpoint
=
p_chapter
->
i_seekpoint_num
-
1
;
}
}
...
...
modules/demux/mkv/virtual_segment.hpp
View file @
7f84c8c8
...
...
@@ -51,7 +51,7 @@ public:
void
AddSegments
(
std
::
vector
<
matroska_segment_c
*>
segments
);
void
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
chapter_item_c
*
p
sz
_chapter
,
int64_t
i_global_position
);
void
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
chapter_item_c
*
p_chapter
,
int64_t
i_global_position
);
mtime_t
Duration
()
const
;
...
...
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