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
8e0a5a24
Commit
8e0a5a24
authored
Apr 14, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: preliminary support for segments with no content, only chapter commands
parent
1bdcfd72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
20 deletions
+46
-20
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+46
-20
No files found.
modules/demux/mkv.cpp
View file @
8e0a5a24
...
@@ -399,9 +399,8 @@ public:
...
@@ -399,9 +399,8 @@ public:
return
(
i_user_start_time
<
item
.
i_user_start_time
||
(
i_user_start_time
==
item
.
i_user_start_time
&&
i_user_end_time
<
item
.
i_user_end_time
)
);
return
(
i_user_start_time
<
item
.
i_user_start_time
||
(
i_user_start_time
==
item
.
i_user_start_time
&&
i_user_end_time
<
item
.
i_user_end_time
)
);
}
}
protected:
bool
Enter
()
const
;
bool
Enter
();
bool
Leave
()
const
;
bool
Leave
();
};
};
class
chapter_edition_t
:
public
chapter_item_t
class
chapter_edition_t
:
public
chapter_item_t
...
@@ -767,13 +766,13 @@ static int Open( vlc_object_t * p_this )
...
@@ -767,13 +766,13 @@ static int Open( vlc_object_t * p_this )
}
}
p_segment
=
p_stream
->
segments
[
0
];
p_segment
=
p_stream
->
segments
[
0
];
if
(
p_segment
->
cluster
=
=
NULL
)
if
(
p_segment
->
cluster
!
=
NULL
)
{
{
msg_Err
(
p_demux
,
"cannot find any cluster, damaged file ?"
);
msg_Warn
(
p_demux
,
"cannot find any cluster, damaged file ?"
);
goto
error
;
// reset the stream reading to the first cluster of the segment used
p_stream
->
p_in
->
setFilePointer
(
p_segment
->
cluster
->
GetElementPosition
()
);
}
}
// reset the stream reading to the first cluster of the segment used
p_stream
->
p_in
->
setFilePointer
(
p_segment
->
cluster
->
GetElementPosition
()
);
/* get the files from the same dir from the same family (based on p_demux->psz_path) */
/* get the files from the same dir from the same family (based on p_demux->psz_path) */
if
(
p_demux
->
psz_path
[
0
]
!=
'\0'
&&
!
strcmp
(
p_demux
->
psz_access
,
""
))
if
(
p_demux
->
psz_path
[
0
]
!=
'\0'
&&
!
strcmp
(
p_demux
->
psz_access
,
""
))
...
@@ -1702,9 +1701,12 @@ void virtual_segment_t::UpdateCurrentToChapter( demux_t & demux )
...
@@ -1702,9 +1701,12 @@ void virtual_segment_t::UpdateCurrentToChapter( demux_t & demux )
psz_curr_chapter
=
editions
[
i_current_edition
].
FindTimecode
(
sys
.
i_pts
);
psz_curr_chapter
=
editions
[
i_current_edition
].
FindTimecode
(
sys
.
i_pts
);
/* we have moved to a new chapter */
/* we have moved to a new chapter */
if
(
psz_curr_chapter
!=
NULL
&&
psz_current_chapter
!=
NULL
&&
psz_current_chapter
!=
psz_curr_chapter
)
if
(
psz_curr_chapter
!=
NULL
&&
psz_current_chapter
!=
psz_curr_chapter
)
{
{
if
(
psz_current_chapter
->
i_seekpoint_num
!=
psz_curr_chapter
->
i_seekpoint_num
&&
psz_curr_chapter
->
i_seekpoint_num
>
0
)
if
(
psz_current_chapter
!=
NULL
)
psz_current_chapter
->
Leave
();
if
(
psz_curr_chapter
->
i_seekpoint_num
>
0
)
{
{
demux
.
info
.
i_update
|=
INPUT_UPDATE_SEEKPOINT
;
demux
.
info
.
i_update
|=
INPUT_UPDATE_SEEKPOINT
;
demux
.
info
.
i_seekpoint
=
psz_curr_chapter
->
i_seekpoint_num
-
1
;
demux
.
info
.
i_seekpoint
=
psz_curr_chapter
->
i_seekpoint_num
-
1
;
...
@@ -1712,15 +1714,12 @@ void virtual_segment_t::UpdateCurrentToChapter( demux_t & demux )
...
@@ -1712,15 +1714,12 @@ void virtual_segment_t::UpdateCurrentToChapter( demux_t & demux )
if
(
editions
[
i_current_edition
].
b_ordered
)
if
(
editions
[
i_current_edition
].
b_ordered
)
{
{
/* TODO check if we need to silently seek to a new location in the stream (switch to another chapter) */
psz_curr_chapter
->
Enter
();
if
(
psz_current_chapter
->
i_end_time
!=
psz_curr_chapter
->
i_start_time
)
// only seek if necessary
if
(
psz_current_chapter
==
NULL
||
(
psz_current_chapter
->
i_end_time
!=
psz_curr_chapter
->
i_start_time
)
)
Seek
(
demux
,
sys
.
i_pts
,
0
,
psz_curr_chapter
);
Seek
(
demux
,
sys
.
i_pts
,
0
,
psz_curr_chapter
);
/* count the last duration time found for each track in a table (-1 not found, -2 silent) */
/* only seek after each duration >= end timecode of the current chapter */
}
}
// i_user_time = psz_curr_chapter->i_user_start_time - psz_curr_chapter->i_start_time;
// i_start_pts = psz_curr_chapter->i_user_start_time;
}
}
psz_current_chapter
=
psz_curr_chapter
;
psz_current_chapter
=
psz_curr_chapter
;
}
}
...
@@ -1890,10 +1889,17 @@ static int Demux( demux_t *p_demux)
...
@@ -1890,10 +1889,17 @@ static int Demux( demux_t *p_demux)
{
{
if
(
p_vsegment
->
EditionIsOrdered
()
)
if
(
p_vsegment
->
EditionIsOrdered
()
)
{
{
const
chapter_item_t
*
p_chap
=
p_vsegment
->
CurrentChapter
();
// check if there are more chapters to read
// check if there are more chapters to read
if
(
p_
vsegment
->
CurrentChapter
()
!=
NULL
)
if
(
p_
chap
!=
NULL
)
{
{
p_sys
->
i_pts
=
p_vsegment
->
CurrentChapter
()
->
i_user_end_time
;
/* TODO handle successive chapters with the same user_start_time/user_end_time
if ( p_chap->i_user_start_time == p_chap->i_user_start_time )
p_vsegment->SelectNext();
*/
p_sys
->
i_pts
=
p_chap
->
i_user_end_time
;
p_sys
->
i_pts
++
;
// trick to avoid staying on segments with no duration and no content
return
1
;
return
1
;
}
}
...
@@ -3429,6 +3435,14 @@ int64_t chapter_item_t::RefreshChapters( bool b_ordered, int64_t i_prev_user_tim
...
@@ -3429,6 +3435,14 @@ int64_t chapter_item_t::RefreshChapters( bool b_ordered, int64_t i_prev_user_tim
if
(
b_ordered
)
if
(
b_ordered
)
{
{
// the ordered chapters always start at zero
if
(
i_prev_user_time
==
-
1
)
{
if
(
i_user_time
==
-
1
)
i_user_time
=
0
;
i_prev_user_time
=
0
;
}
i_user_start_time
=
i_prev_user_time
;
i_user_start_time
=
i_prev_user_time
;
if
(
i_end_time
!=
-
1
&&
i_user_time
==
i_prev_user_time
)
if
(
i_end_time
!=
-
1
&&
i_user_time
==
i_prev_user_time
)
{
{
...
@@ -3472,7 +3486,9 @@ const chapter_item_t *chapter_item_t::FindTimecode( mtime_t i_user_timecode ) co
...
@@ -3472,7 +3486,9 @@ const chapter_item_t *chapter_item_t::FindTimecode( mtime_t i_user_timecode ) co
{
{
const
chapter_item_t
*
psz_result
=
NULL
;
const
chapter_item_t
*
psz_result
=
NULL
;
if
(
i_user_timecode
>=
i_user_start_time
&&
i_user_timecode
<
i_user_end_time
)
if
(
i_user_timecode
>=
i_user_start_time
&&
(
i_user_timecode
<
i_user_end_time
||
(
i_user_start_time
==
i_user_end_time
&&
i_user_timecode
==
i_user_end_time
)))
{
{
std
::
vector
<
chapter_item_t
>::
const_iterator
index
=
sub_chapters
.
begin
();
std
::
vector
<
chapter_item_t
>::
const_iterator
index
=
sub_chapters
.
begin
();
while
(
index
!=
sub_chapters
.
end
()
&&
psz_result
==
NULL
)
while
(
index
!=
sub_chapters
.
end
()
&&
psz_result
==
NULL
)
...
@@ -3908,3 +3924,13 @@ void chapter_codec_cmds_t::AddCommand( const KaxChapterProcessCommand & command
...
@@ -3908,3 +3924,13 @@ void chapter_codec_cmds_t::AddCommand( const KaxChapterProcessCommand & command
}
}
}
}
}
}
bool
chapter_item_t
::
Enter
()
const
{
return
true
;
}
bool
chapter_item_t
::
Leave
()
const
{
return
true
;
}
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