Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
d6abd400
Commit
d6abd400
authored
Aug 01, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix seeking with broken file or without index (close #1687)
parent
96b4ee1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
39 deletions
+67
-39
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+67
-39
No files found.
modules/demux/mkv.cpp
View file @
d6abd400
...
@@ -113,6 +113,46 @@ extern "C" {
...
@@ -113,6 +113,46 @@ extern "C" {
# include <zlib.h>
# include <zlib.h>
#endif
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
set_shortname
(
"Matroska"
);
set_description
(
N_
(
"Matroska stream demuxer"
)
);
set_capability
(
"demux"
,
50
);
set_callbacks
(
Open
,
Close
);
set_category
(
CAT_INPUT
);
set_subcategory
(
SUBCAT_INPUT_DEMUX
);
add_bool
(
"mkv-use-ordered-chapters"
,
1
,
NULL
,
N_
(
"Ordered chapters"
),
N_
(
"Play ordered chapters as specified in the segment."
),
true
);
add_bool
(
"mkv-use-chapter-codec"
,
1
,
NULL
,
N_
(
"Chapter codecs"
),
N_
(
"Use chapter codecs found in the segment."
),
true
);
add_bool
(
"mkv-preload-local-dir"
,
1
,
NULL
,
N_
(
"Preload Directory"
),
N_
(
"Preload matroska files from the same family in the same directory (not good for broken files)."
),
true
);
add_bool
(
"mkv-seek-percent"
,
0
,
NULL
,
N_
(
"Seek based on percent not time"
),
N_
(
"Seek based on percent not time."
),
true
);
add_bool
(
"mkv-use-dummy"
,
0
,
NULL
,
N_
(
"Dummy Elements"
),
N_
(
"Read and discard unknown EBML elements (not good for broken files)."
),
true
);
add_shortcut
(
"mka"
);
add_shortcut
(
"mkv"
);
vlc_module_end
();
#define MATROSKA_COMPRESSION_NONE -1
#define MATROSKA_COMPRESSION_NONE -1
#define MATROSKA_COMPRESSION_ZLIB 0
#define MATROSKA_COMPRESSION_ZLIB 0
#define MATROSKA_COMPRESSION_BLIB 1
#define MATROSKA_COMPRESSION_BLIB 1
...
@@ -397,44 +437,6 @@ typedef struct {
...
@@ -397,44 +437,6 @@ typedef struct {
using
namespace
LIBMATROSKA_NAMESPACE
;
using
namespace
LIBMATROSKA_NAMESPACE
;
using
namespace
std
;
using
namespace
std
;
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
set_shortname
(
"Matroska"
);
set_description
(
N_
(
"Matroska stream demuxer"
)
);
set_capability
(
"demux"
,
50
);
set_callbacks
(
Open
,
Close
);
set_category
(
CAT_INPUT
);
set_subcategory
(
SUBCAT_INPUT_DEMUX
);
add_bool
(
"mkv-use-ordered-chapters"
,
1
,
NULL
,
N_
(
"Ordered chapters"
),
N_
(
"Play ordered chapters as specified in the segment."
),
true
);
add_bool
(
"mkv-use-chapter-codec"
,
1
,
NULL
,
N_
(
"Chapter codecs"
),
N_
(
"Use chapter codecs found in the segment."
),
true
);
add_bool
(
"mkv-preload-local-dir"
,
1
,
NULL
,
N_
(
"Preload Directory"
),
N_
(
"Preload matroska files from the same family in the same directory (not good for broken files)."
),
true
);
add_bool
(
"mkv-seek-percent"
,
0
,
NULL
,
N_
(
"Seek based on percent not time"
),
N_
(
"Seek based on percent not time."
),
true
);
add_bool
(
"mkv-use-dummy"
,
0
,
NULL
,
N_
(
"Dummy Elements"
),
N_
(
"Read and discard unknown EBML elements (not good for broken files)."
),
true
);
add_shortcut
(
"mka"
);
add_shortcut
(
"mkv"
);
vlc_module_end
();
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
...
@@ -553,7 +555,10 @@ class EbmlParser
...
@@ -553,7 +555,10 @@ class EbmlParser
void
Keep
(
void
);
void
Keep
(
void
);
EbmlElement
*
UnGet
(
uint64
i_block_pos
,
uint64
i_cluster_pos
);
EbmlElement
*
UnGet
(
uint64
i_block_pos
,
uint64
i_cluster_pos
);
int
GetLevel
(
void
);
int
GetLevel
(
void
);
/* Is the provided element presents in our upper elements */
bool
IsTopPresent
(
EbmlElement
*
);
private:
private:
EbmlStream
*
m_es
;
EbmlStream
*
m_es
;
...
@@ -1785,6 +1790,20 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
...
@@ -1785,6 +1790,20 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/* Verify that we are still inside our cluster
* It can happens whith broken files and when seeking
* without index */
if
(
i_level
>
1
)
{
if
(
cluster
&&
!
ep
->
IsTopPresent
(
cluster
)
)
{
msg_Warn
(
&
sys
.
demuxer
,
"Unexpected escape from current cluster"
);
cluster
=
NULL
;
}
if
(
!
cluster
)
continue
;
}
/* do parsing */
/* do parsing */
switch
(
i_level
)
switch
(
i_level
)
{
{
...
@@ -3892,6 +3911,15 @@ EbmlElement *EbmlParser::Get( void )
...
@@ -3892,6 +3911,15 @@ EbmlElement *EbmlParser::Get( void )
return
m_el
[
mi_level
];
return
m_el
[
mi_level
];
}
}
bool
EbmlParser
::
IsTopPresent
(
EbmlElement
*
el
)
{
for
(
int
i
=
0
;
i
<
mi_level
;
i
++
)
{
if
(
m_el
[
i
]
&&
m_el
[
i
]
==
el
)
return
true
;
}
return
false
;
}
/*****************************************************************************
/*****************************************************************************
* Tools
* Tools
...
...
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