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
c3155003
Commit
c3155003
authored
Apr 26, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: added the thread to support VOB buttons
+ code cleaning
parent
fb0c4124
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
293 additions
and
154 deletions
+293
-154
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+293
-154
No files found.
modules/demux/mkv.cpp
View file @
c3155003
...
@@ -698,21 +698,19 @@ public:
...
@@ -698,21 +698,19 @@ public:
{
{
for
(
size_t
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
for
(
size_t
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
{
{
#define tk tracks[i_track]
if
(
tracks
[
i_track
]
->
fmt
.
psz_description
)
if
(
tk
->
fmt
.
psz_description
)
{
{
free
(
t
k
->
fmt
.
psz_description
);
free
(
t
racks
[
i_track
]
->
fmt
.
psz_description
);
}
}
if
(
t
k
->
psz_codec
)
if
(
t
racks
[
i_track
]
->
psz_codec
)
{
{
free
(
t
k
->
psz_codec
);
free
(
t
racks
[
i_track
]
->
psz_codec
);
}
}
if
(
t
k
->
fmt
.
psz_language
)
if
(
t
racks
[
i_track
]
->
fmt
.
psz_language
)
{
{
free
(
t
k
->
fmt
.
psz_language
);
free
(
t
racks
[
i_track
]
->
fmt
.
psz_language
);
}
}
delete
tk
;
delete
tracks
[
i_track
];
#undef tk
}
}
if
(
psz_writing_application
)
if
(
psz_writing_application
)
...
@@ -927,6 +925,19 @@ public:
...
@@ -927,6 +925,19 @@ public:
demux_sys_t
&
sys
;
demux_sys_t
&
sys
;
};
};
typedef
struct
{
VLC_COMMON_MEMBERS
demux_t
*
p_demux
;
vlc_mutex_t
lock
;
vlc_bool_t
b_moved
;
vlc_bool_t
b_clicked
;
vlc_bool_t
b_key
;
}
event_thread_t
;
class
demux_sys_t
class
demux_sys_t
{
{
public:
public:
...
@@ -939,10 +950,14 @@ public:
...
@@ -939,10 +950,14 @@ public:
,
i_current_title
(
0
)
,
i_current_title
(
0
)
,
p_current_segment
(
NULL
)
,
p_current_segment
(
NULL
)
,
f_duration
(
-
1.0
)
,
f_duration
(
-
1.0
)
,
b_ui_hooked
(
false
)
,
p_input
(
NULL
)
,
p_ev
(
NULL
)
{}
{}
virtual
~
demux_sys_t
()
virtual
~
demux_sys_t
()
{
{
StopUiThread
();
size_t
i
;
size_t
i
;
for
(
i
=
0
;
i
<
streams
.
size
();
i
++
)
for
(
i
=
0
;
i
<
streams
.
size
();
i
++
)
delete
streams
[
i
];
delete
streams
[
i
];
...
@@ -985,6 +1000,22 @@ public:
...
@@ -985,6 +1000,22 @@ public:
bool
PreparePlayback
(
virtual_segment_c
*
p_new_segment
);
bool
PreparePlayback
(
virtual_segment_c
*
p_new_segment
);
matroska_stream_c
*
AnalyseAllSegmentsFound
(
EbmlStream
*
p_estream
);
matroska_stream_c
*
AnalyseAllSegmentsFound
(
EbmlStream
*
p_estream
);
void
StartUiThread
();
void
StopUiThread
();
bool
b_ui_hooked
;
/* for spu variables */
input_thread_t
*
p_input
;
/* event */
event_thread_t
*
p_ev
;
static
int
EventThread
(
vlc_object_t
*
p_this
);
static
int
EventMouse
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
);
static
int
EventKey
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
);
protected:
protected:
virtual_segment_c
*
VirtualFromSegments
(
matroska_segment_c
*
p_segment
)
const
;
virtual_segment_c
*
VirtualFromSegments
(
matroska_segment_c
*
p_segment
)
const
;
bool
IsUsedSegment
(
matroska_segment_c
&
p_segment
)
const
;
bool
IsUsedSegment
(
matroska_segment_c
&
p_segment
)
const
;
...
@@ -1598,84 +1629,84 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1598,84 +1629,84 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
/* add all es */
/* add all es */
msg_Dbg
(
&
sys
.
demuxer
,
"found %d es"
,
tracks
.
size
()
);
msg_Dbg
(
&
sys
.
demuxer
,
"found %d es"
,
tracks
.
size
()
);
sys
.
StopUiThread
();
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
{
{
#define tk tracks[i_track]
if
(
tracks
[
i_track
]
->
fmt
.
i_cat
==
UNKNOWN_ES
)
if
(
tk
->
fmt
.
i_cat
==
UNKNOWN_ES
)
{
{
msg_Warn
(
&
sys
.
demuxer
,
"invalid track[%d, n=%d]"
,
i_track
,
t
k
->
i_number
);
msg_Warn
(
&
sys
.
demuxer
,
"invalid track[%d, n=%d]"
,
i_track
,
t
racks
[
i_track
]
->
i_number
);
t
k
->
p_es
=
NULL
;
t
racks
[
i_track
]
->
p_es
=
NULL
;
continue
;
continue
;
}
}
if
(
!
strcmp
(
t
k
->
psz_codec
,
"V_MS/VFW/FOURCC"
)
)
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"V_MS/VFW/FOURCC"
)
)
{
{
if
(
t
k
->
i_extra_data
<
(
int
)
sizeof
(
BITMAPINFOHEADER
)
)
if
(
t
racks
[
i_track
]
->
i_extra_data
<
(
int
)
sizeof
(
BITMAPINFOHEADER
)
)
{
{
msg_Err
(
&
sys
.
demuxer
,
"missing/invalid BITMAPINFOHEADER"
);
msg_Err
(
&
sys
.
demuxer
,
"missing/invalid BITMAPINFOHEADER"
);
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
}
}
else
else
{
{
BITMAPINFOHEADER
*
p_bih
=
(
BITMAPINFOHEADER
*
)
t
k
->
p_extra_data
;
BITMAPINFOHEADER
*
p_bih
=
(
BITMAPINFOHEADER
*
)
t
racks
[
i_track
]
->
p_extra_data
;
t
k
->
fmt
.
video
.
i_width
=
GetDWLE
(
&
p_bih
->
biWidth
);
t
racks
[
i_track
]
->
fmt
.
video
.
i_width
=
GetDWLE
(
&
p_bih
->
biWidth
);
t
k
->
fmt
.
video
.
i_height
=
GetDWLE
(
&
p_bih
->
biHeight
);
t
racks
[
i_track
]
->
fmt
.
video
.
i_height
=
GetDWLE
(
&
p_bih
->
biHeight
);
t
k
->
fmt
.
i_codec
=
GetFOURCC
(
&
p_bih
->
biCompression
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
GetFOURCC
(
&
p_bih
->
biCompression
);
t
k
->
fmt
.
i_extra
=
GetDWLE
(
&
p_bih
->
biSize
)
-
sizeof
(
BITMAPINFOHEADER
);
t
racks
[
i_track
]
->
fmt
.
i_extra
=
GetDWLE
(
&
p_bih
->
biSize
)
-
sizeof
(
BITMAPINFOHEADER
);
if
(
t
k
->
fmt
.
i_extra
>
0
)
if
(
t
racks
[
i_track
]
->
fmt
.
i_extra
>
0
)
{
{
t
k
->
fmt
.
p_extra
=
malloc
(
tk
->
fmt
.
i_extra
);
t
racks
[
i_track
]
->
fmt
.
p_extra
=
malloc
(
tracks
[
i_track
]
->
fmt
.
i_extra
);
memcpy
(
t
k
->
fmt
.
p_extra
,
&
p_bih
[
1
],
tk
->
fmt
.
i_extra
);
memcpy
(
t
racks
[
i_track
]
->
fmt
.
p_extra
,
&
p_bih
[
1
],
tracks
[
i_track
]
->
fmt
.
i_extra
);
}
}
}
}
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"V_MPEG1"
)
||
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"V_MPEG1"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"V_MPEG2"
)
)
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"V_MPEG2"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'v'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'v'
);
}
}
else
if
(
!
strncmp
(
t
k
->
psz_codec
,
"V_MPEG4"
,
7
)
)
else
if
(
!
strncmp
(
t
racks
[
i_track
]
->
psz_codec
,
"V_MPEG4"
,
7
)
)
{
{
if
(
!
strcmp
(
t
k
->
psz_codec
,
"V_MPEG4/MS/V3"
)
)
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"V_MPEG4/MS/V3"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'3'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'D'
,
'I'
,
'V'
,
'3'
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"V_MPEG4/ISO/AVC"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"V_MPEG4/ISO/AVC"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'v'
,
'c'
,
'1'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'v'
,
'c'
,
'1'
);
t
k
->
fmt
.
b_packetized
=
VLC_FALSE
;
t
racks
[
i_track
]
->
fmt
.
b_packetized
=
VLC_FALSE
;
t
k
->
fmt
.
i_extra
=
tk
->
i_extra_data
;
t
racks
[
i_track
]
->
fmt
.
i_extra
=
tracks
[
i_track
]
->
i_extra_data
;
t
k
->
fmt
.
p_extra
=
malloc
(
tk
->
i_extra_data
);
t
racks
[
i_track
]
->
fmt
.
p_extra
=
malloc
(
tracks
[
i_track
]
->
i_extra_data
);
memcpy
(
t
k
->
fmt
.
p_extra
,
tk
->
p_extra_data
,
tk
->
i_extra_data
);
memcpy
(
t
racks
[
i_track
]
->
fmt
.
p_extra
,
tracks
[
i_track
]
->
p_extra_data
,
tracks
[
i_track
]
->
i_extra_data
);
}
}
else
else
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'v'
);
}
}
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"V_QUICKTIME"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"V_QUICKTIME"
)
)
{
{
MP4_Box_t
*
p_box
=
(
MP4_Box_t
*
)
malloc
(
sizeof
(
MP4_Box_t
)
);
MP4_Box_t
*
p_box
=
(
MP4_Box_t
*
)
malloc
(
sizeof
(
MP4_Box_t
)
);
#ifdef VSLHC
#ifdef VSLHC
stream_t
*
p_mp4_stream
=
stream_MemoryNew
(
VLC_OBJECT
(
&
sys
.
demuxer
),
stream_t
*
p_mp4_stream
=
stream_MemoryNew
(
VLC_OBJECT
(
&
sys
.
demuxer
),
t
k
->
p_extra_data
,
t
racks
[
i_track
]
->
p_extra_data
,
t
k
->
i_extra_data
);
t
racks
[
i_track
]
->
i_extra_data
);
#else
#else
stream_t
*
p_mp4_stream
=
stream_MemoryNew
(
VLC_OBJECT
(
&
sys
.
demuxer
),
stream_t
*
p_mp4_stream
=
stream_MemoryNew
(
VLC_OBJECT
(
&
sys
.
demuxer
),
t
k
->
p_extra_data
,
t
racks
[
i_track
]
->
p_extra_data
,
t
k
->
i_extra_data
,
t
racks
[
i_track
]
->
i_extra_data
,
VLC_FALSE
);
VLC_FALSE
);
#endif
#endif
MP4_ReadBoxCommon
(
p_mp4_stream
,
p_box
);
MP4_ReadBoxCommon
(
p_mp4_stream
,
p_box
);
MP4_ReadBox_sample_vide
(
p_mp4_stream
,
p_box
);
MP4_ReadBox_sample_vide
(
p_mp4_stream
,
p_box
);
t
k
->
fmt
.
i_codec
=
p_box
->
i_type
;
t
racks
[
i_track
]
->
fmt
.
i_codec
=
p_box
->
i_type
;
t
k
->
fmt
.
video
.
i_width
=
p_box
->
data
.
p_sample_vide
->
i_width
;
t
racks
[
i_track
]
->
fmt
.
video
.
i_width
=
p_box
->
data
.
p_sample_vide
->
i_width
;
t
k
->
fmt
.
video
.
i_height
=
p_box
->
data
.
p_sample_vide
->
i_height
;
t
racks
[
i_track
]
->
fmt
.
video
.
i_height
=
p_box
->
data
.
p_sample_vide
->
i_height
;
t
k
->
fmt
.
i_extra
=
p_box
->
data
.
p_sample_vide
->
i_qt_image_description
;
t
racks
[
i_track
]
->
fmt
.
i_extra
=
p_box
->
data
.
p_sample_vide
->
i_qt_image_description
;
t
k
->
fmt
.
p_extra
=
malloc
(
tk
->
fmt
.
i_extra
);
t
racks
[
i_track
]
->
fmt
.
p_extra
=
malloc
(
tracks
[
i_track
]
->
fmt
.
i_extra
);
memcpy
(
t
k
->
fmt
.
p_extra
,
p_box
->
data
.
p_sample_vide
->
p_qt_image_description
,
tk
->
fmt
.
i_extra
);
memcpy
(
t
racks
[
i_track
]
->
fmt
.
p_extra
,
p_box
->
data
.
p_sample_vide
->
p_qt_image_description
,
tracks
[
i_track
]
->
fmt
.
i_extra
);
MP4_FreeBox_sample_vide
(
p_box
);
MP4_FreeBox_sample_vide
(
p_box
);
#ifdef VSLHC
#ifdef VSLHC
stream_MemoryDelete
(
p_mp4_stream
,
VLC_TRUE
);
stream_MemoryDelete
(
p_mp4_stream
,
VLC_TRUE
);
...
@@ -1683,94 +1714,94 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1683,94 +1714,94 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
stream_Delete
(
p_mp4_stream
);
stream_Delete
(
p_mp4_stream
);
#endif
#endif
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_MS/ACM"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_MS/ACM"
)
)
{
{
if
(
t
k
->
i_extra_data
<
(
int
)
sizeof
(
WAVEFORMATEX
)
)
if
(
t
racks
[
i_track
]
->
i_extra_data
<
(
int
)
sizeof
(
WAVEFORMATEX
)
)
{
{
msg_Err
(
&
sys
.
demuxer
,
"missing/invalid WAVEFORMATEX"
);
msg_Err
(
&
sys
.
demuxer
,
"missing/invalid WAVEFORMATEX"
);
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
}
}
else
else
{
{
WAVEFORMATEX
*
p_wf
=
(
WAVEFORMATEX
*
)
t
k
->
p_extra_data
;
WAVEFORMATEX
*
p_wf
=
(
WAVEFORMATEX
*
)
t
racks
[
i_track
]
->
p_extra_data
;
wf_tag_to_fourcc
(
GetWLE
(
&
p_wf
->
wFormatTag
),
&
t
k
->
fmt
.
i_codec
,
NULL
);
wf_tag_to_fourcc
(
GetWLE
(
&
p_wf
->
wFormatTag
),
&
t
racks
[
i_track
]
->
fmt
.
i_codec
,
NULL
);
t
k
->
fmt
.
audio
.
i_channels
=
GetWLE
(
&
p_wf
->
nChannels
);
t
racks
[
i_track
]
->
fmt
.
audio
.
i_channels
=
GetWLE
(
&
p_wf
->
nChannels
);
t
k
->
fmt
.
audio
.
i_rate
=
GetDWLE
(
&
p_wf
->
nSamplesPerSec
);
t
racks
[
i_track
]
->
fmt
.
audio
.
i_rate
=
GetDWLE
(
&
p_wf
->
nSamplesPerSec
);
t
k
->
fmt
.
i_bitrate
=
GetDWLE
(
&
p_wf
->
nAvgBytesPerSec
)
*
8
;
t
racks
[
i_track
]
->
fmt
.
i_bitrate
=
GetDWLE
(
&
p_wf
->
nAvgBytesPerSec
)
*
8
;
t
k
->
fmt
.
audio
.
i_blockalign
=
GetWLE
(
&
p_wf
->
nBlockAlign
);;
t
racks
[
i_track
]
->
fmt
.
audio
.
i_blockalign
=
GetWLE
(
&
p_wf
->
nBlockAlign
);;
t
k
->
fmt
.
audio
.
i_bitspersample
=
GetWLE
(
&
p_wf
->
wBitsPerSample
);
t
racks
[
i_track
]
->
fmt
.
audio
.
i_bitspersample
=
GetWLE
(
&
p_wf
->
wBitsPerSample
);
t
k
->
fmt
.
i_extra
=
GetWLE
(
&
p_wf
->
cbSize
);
t
racks
[
i_track
]
->
fmt
.
i_extra
=
GetWLE
(
&
p_wf
->
cbSize
);
if
(
t
k
->
fmt
.
i_extra
>
0
)
if
(
t
racks
[
i_track
]
->
fmt
.
i_extra
>
0
)
{
{
t
k
->
fmt
.
p_extra
=
malloc
(
tk
->
fmt
.
i_extra
);
t
racks
[
i_track
]
->
fmt
.
p_extra
=
malloc
(
tracks
[
i_track
]
->
fmt
.
i_extra
);
memcpy
(
t
k
->
fmt
.
p_extra
,
&
p_wf
[
1
],
tk
->
fmt
.
i_extra
);
memcpy
(
t
racks
[
i_track
]
->
fmt
.
p_extra
,
&
p_wf
[
1
],
tracks
[
i_track
]
->
fmt
.
i_extra
);
}
}
}
}
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_MPEG/L3"
)
||
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_MPEG/L3"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"A_MPEG/L2"
)
||
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_MPEG/L2"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"A_MPEG/L1"
)
)
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_MPEG/L1"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'a'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'a'
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_AC3"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_AC3"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_DTS"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_DTS"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'd'
,
't'
,
's'
,
' '
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'd'
,
't'
,
's'
,
' '
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_FLAC"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_FLAC"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'f'
,
'l'
,
'a'
,
'c'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'f'
,
'l'
,
'a'
,
'c'
);
t
k
->
fmt
.
i_extra
=
tk
->
i_extra_data
;
t
racks
[
i_track
]
->
fmt
.
i_extra
=
tracks
[
i_track
]
->
i_extra_data
;
t
k
->
fmt
.
p_extra
=
malloc
(
tk
->
i_extra_data
);
t
racks
[
i_track
]
->
fmt
.
p_extra
=
malloc
(
tracks
[
i_track
]
->
i_extra_data
);
memcpy
(
t
k
->
fmt
.
p_extra
,
tk
->
p_extra_data
,
tk
->
i_extra_data
);
memcpy
(
t
racks
[
i_track
]
->
fmt
.
p_extra
,
tracks
[
i_track
]
->
p_extra_data
,
tracks
[
i_track
]
->
i_extra_data
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_VORBIS"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_VORBIS"
)
)
{
{
int
i
,
i_offset
=
1
,
i_size
[
3
],
i_extra
;
int
i
,
i_offset
=
1
,
i_size
[
3
],
i_extra
;
uint8_t
*
p_extra
;
uint8_t
*
p_extra
;
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'v'
,
'o'
,
'r'
,
'b'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'v'
,
'o'
,
'r'
,
'b'
);
/* Split the 3 headers */
/* Split the 3 headers */
if
(
t
k
->
p_extra_data
[
0
]
!=
0x02
)
if
(
t
racks
[
i_track
]
->
p_extra_data
[
0
]
!=
0x02
)
msg_Err
(
&
sys
.
demuxer
,
"invalid vorbis header"
);
msg_Err
(
&
sys
.
demuxer
,
"invalid vorbis header"
);
for
(
i
=
0
;
i
<
2
;
i
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
{
{
i_size
[
i
]
=
0
;
i_size
[
i
]
=
0
;
while
(
i_offset
<
t
k
->
i_extra_data
)
while
(
i_offset
<
t
racks
[
i_track
]
->
i_extra_data
)
{
{
i_size
[
i
]
+=
t
k
->
p_extra_data
[
i_offset
];
i_size
[
i
]
+=
t
racks
[
i_track
]
->
p_extra_data
[
i_offset
];
if
(
t
k
->
p_extra_data
[
i_offset
++
]
!=
0xff
)
break
;
if
(
t
racks
[
i_track
]
->
p_extra_data
[
i_offset
++
]
!=
0xff
)
break
;
}
}
}
}
i_size
[
0
]
=
__MIN
(
i_size
[
0
],
t
k
->
i_extra_data
-
i_offset
);
i_size
[
0
]
=
__MIN
(
i_size
[
0
],
t
racks
[
i_track
]
->
i_extra_data
-
i_offset
);
i_size
[
1
]
=
__MIN
(
i_size
[
1
],
t
k
->
i_extra_data
-
i_offset
-
i_size
[
0
]);
i_size
[
1
]
=
__MIN
(
i_size
[
1
],
t
racks
[
i_track
]
->
i_extra_data
-
i_offset
-
i_size
[
0
]);
i_size
[
2
]
=
t
k
->
i_extra_data
-
i_offset
-
i_size
[
0
]
-
i_size
[
1
];
i_size
[
2
]
=
t
racks
[
i_track
]
->
i_extra_data
-
i_offset
-
i_size
[
0
]
-
i_size
[
1
];
t
k
->
fmt
.
i_extra
=
3
*
2
+
i_size
[
0
]
+
i_size
[
1
]
+
i_size
[
2
];
t
racks
[
i_track
]
->
fmt
.
i_extra
=
3
*
2
+
i_size
[
0
]
+
i_size
[
1
]
+
i_size
[
2
];
t
k
->
fmt
.
p_extra
=
malloc
(
tk
->
fmt
.
i_extra
);
t
racks
[
i_track
]
->
fmt
.
p_extra
=
malloc
(
tracks
[
i_track
]
->
fmt
.
i_extra
);
p_extra
=
(
uint8_t
*
)
t
k
->
fmt
.
p_extra
;
i_extra
=
0
;
p_extra
=
(
uint8_t
*
)
t
racks
[
i_track
]
->
fmt
.
p_extra
;
i_extra
=
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
3
;
i
++
)
{
{
*
(
p_extra
++
)
=
i_size
[
i
]
>>
8
;
*
(
p_extra
++
)
=
i_size
[
i
]
>>
8
;
*
(
p_extra
++
)
=
i_size
[
i
]
&
0xFF
;
*
(
p_extra
++
)
=
i_size
[
i
]
&
0xFF
;
memcpy
(
p_extra
,
t
k
->
p_extra_data
+
i_offset
+
i_extra
,
memcpy
(
p_extra
,
t
racks
[
i_track
]
->
p_extra_data
+
i_offset
+
i_extra
,
i_size
[
i
]
);
i_size
[
i
]
);
p_extra
+=
i_size
[
i
];
p_extra
+=
i_size
[
i
];
i_extra
+=
i_size
[
i
];
i_extra
+=
i_size
[
i
];
}
}
}
}
else
if
(
!
strncmp
(
t
k
->
psz_codec
,
"A_AAC/MPEG2/"
,
strlen
(
"A_AAC/MPEG2/"
)
)
||
else
if
(
!
strncmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_AAC/MPEG2/"
,
strlen
(
"A_AAC/MPEG2/"
)
)
||
!
strncmp
(
t
k
->
psz_codec
,
"A_AAC/MPEG4/"
,
strlen
(
"A_AAC/MPEG4/"
)
)
)
!
strncmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_AAC/MPEG4/"
,
strlen
(
"A_AAC/MPEG4/"
)
)
)
{
{
int
i_profile
,
i_srate
;
int
i_profile
,
i_srate
;
static
unsigned
int
i_sample_rates
[]
=
static
unsigned
int
i_sample_rates
[]
=
...
@@ -1779,18 +1810,18 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1779,18 +1810,18 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
16000
,
12000
,
11025
,
8000
,
7350
,
0
,
0
,
0
16000
,
12000
,
11025
,
8000
,
7350
,
0
,
0
,
0
};
};
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
);
/* create data for faad (MP4DecSpecificDescrTag)*/
/* create data for faad (MP4DecSpecificDescrTag)*/
if
(
!
strcmp
(
&
t
k
->
psz_codec
[
12
],
"MAIN"
)
)
if
(
!
strcmp
(
&
t
racks
[
i_track
]
->
psz_codec
[
12
],
"MAIN"
)
)
{
{
i_profile
=
0
;
i_profile
=
0
;
}
}
else
if
(
!
strcmp
(
&
t
k
->
psz_codec
[
12
],
"LC"
)
)
else
if
(
!
strcmp
(
&
t
racks
[
i_track
]
->
psz_codec
[
12
],
"LC"
)
)
{
{
i_profile
=
1
;
i_profile
=
1
;
}
}
else
if
(
!
strcmp
(
&
t
k
->
psz_codec
[
12
],
"SSR"
)
)
else
if
(
!
strcmp
(
&
t
racks
[
i_track
]
->
psz_codec
[
12
],
"SSR"
)
)
{
{
i_profile
=
2
;
i_profile
=
2
;
}
}
...
@@ -1801,72 +1832,72 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1801,72 +1832,72 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
for
(
i_srate
=
0
;
i_srate
<
13
;
i_srate
++
)
for
(
i_srate
=
0
;
i_srate
<
13
;
i_srate
++
)
{
{
if
(
i_sample_rates
[
i_srate
]
==
t
k
->
fmt
.
audio
.
i_rate
)
if
(
i_sample_rates
[
i_srate
]
==
t
racks
[
i_track
]
->
fmt
.
audio
.
i_rate
)
{
{
break
;
break
;
}
}
}
}
msg_Dbg
(
&
sys
.
demuxer
,
"profile=%d srate=%d"
,
i_profile
,
i_srate
);
msg_Dbg
(
&
sys
.
demuxer
,
"profile=%d srate=%d"
,
i_profile
,
i_srate
);
t
k
->
fmt
.
i_extra
=
2
;
t
racks
[
i_track
]
->
fmt
.
i_extra
=
2
;
t
k
->
fmt
.
p_extra
=
malloc
(
tk
->
fmt
.
i_extra
);
t
racks
[
i_track
]
->
fmt
.
p_extra
=
malloc
(
tracks
[
i_track
]
->
fmt
.
i_extra
);
((
uint8_t
*
)
t
k
->
fmt
.
p_extra
)[
0
]
=
((
i_profile
+
1
)
<<
3
)
|
((
i_srate
&
0xe
)
>>
1
);
((
uint8_t
*
)
t
racks
[
i_track
]
->
fmt
.
p_extra
)[
0
]
=
((
i_profile
+
1
)
<<
3
)
|
((
i_srate
&
0xe
)
>>
1
);
((
uint8_t
*
)
t
k
->
fmt
.
p_extra
)[
1
]
=
((
i_srate
&
0x1
)
<<
7
)
|
(
tk
->
fmt
.
audio
.
i_channels
<<
3
);
((
uint8_t
*
)
t
racks
[
i_track
]
->
fmt
.
p_extra
)[
1
]
=
((
i_srate
&
0x1
)
<<
7
)
|
(
tracks
[
i_track
]
->
fmt
.
audio
.
i_channels
<<
3
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_PCM/INT/BIG"
)
||
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_PCM/INT/BIG"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"A_PCM/INT/LIT"
)
||
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_PCM/INT/LIT"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"A_PCM/FLOAT/IEEE"
)
)
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_PCM/FLOAT/IEEE"
)
)
{
{
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_PCM/INT/BIG"
)
)
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_PCM/INT/BIG"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
't'
,
'w'
,
'o'
,
's'
);
}
}
else
else
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'r'
,
'a'
,
'w'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'a'
,
'r'
,
'a'
,
'w'
);
}
}
t
k
->
fmt
.
audio
.
i_blockalign
=
(
tk
->
fmt
.
audio
.
i_bitspersample
+
7
)
/
8
*
tk
->
fmt
.
audio
.
i_channels
;
t
racks
[
i_track
]
->
fmt
.
audio
.
i_blockalign
=
(
tracks
[
i_track
]
->
fmt
.
audio
.
i_bitspersample
+
7
)
/
8
*
tracks
[
i_track
]
->
fmt
.
audio
.
i_channels
;
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_TTA1"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_TTA1"
)
)
{
{
/* FIXME: support this codec */
/* FIXME: support this codec */
msg_Err
(
&
sys
.
demuxer
,
"TTA not supported yet[%d, n=%d]"
,
i_track
,
t
k
->
i_number
);
msg_Err
(
&
sys
.
demuxer
,
"TTA not supported yet[%d, n=%d]"
,
i_track
,
t
racks
[
i_track
]
->
i_number
);
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"A_WAVPACK4"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"A_WAVPACK4"
)
)
{
{
/* FIXME: support this codec */
/* FIXME: support this codec */
msg_Err
(
&
sys
.
demuxer
,
"Wavpack not supported yet[%d, n=%d]"
,
i_track
,
t
k
->
i_number
);
msg_Err
(
&
sys
.
demuxer
,
"Wavpack not supported yet[%d, n=%d]"
,
i_track
,
t
racks
[
i_track
]
->
i_number
);
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"S_TEXT/UTF8"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"S_TEXT/UTF8"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
'u'
,
'b'
,
't'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
'u'
,
'b'
,
't'
);
t
k
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
t
racks
[
i_track
]
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"S_TEXT/SSA"
)
||
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"S_TEXT/SSA"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"S_TEXT/ASS"
)
||
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"S_TEXT/ASS"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"S_SSA"
)
||
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"S_SSA"
)
||
!
strcmp
(
t
k
->
psz_codec
,
"S_ASS"
))
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"S_ASS"
))
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
's'
,
'a'
,
' '
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
's'
,
'a'
,
' '
);
t
k
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
t
racks
[
i_track
]
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"UTF-8"
);
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"S_VOBSUB"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"S_VOBSUB"
)
)
{
{
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
'p'
,
'u'
,
' '
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
'p'
,
'u'
,
' '
);
if
(
t
k
->
i_extra_data
)
if
(
t
racks
[
i_track
]
->
i_extra_data
)
{
{
char
*
p_start
;
char
*
p_start
;
char
*
p_buf
=
(
char
*
)
malloc
(
t
k
->
i_extra_data
+
1
);
char
*
p_buf
=
(
char
*
)
malloc
(
t
racks
[
i_track
]
->
i_extra_data
+
1
);
memcpy
(
p_buf
,
t
k
->
p_extra_data
,
tk
->
i_extra_data
);
memcpy
(
p_buf
,
t
racks
[
i_track
]
->
p_extra_data
,
tracks
[
i_track
]
->
i_extra_data
);
p_buf
[
t
k
->
i_extra_data
]
=
'\0'
;
p_buf
[
t
racks
[
i_track
]
->
i_extra_data
]
=
'\0'
;
p_start
=
strstr
(
p_buf
,
"size:"
);
p_start
=
strstr
(
p_buf
,
"size:"
);
if
(
sscanf
(
p_start
,
"size: %dx%d"
,
if
(
sscanf
(
p_start
,
"size: %dx%d"
,
&
t
k
->
fmt
.
subs
.
spu
.
i_original_frame_width
,
&
tk
->
fmt
.
subs
.
spu
.
i_original_frame_height
)
==
2
)
&
t
racks
[
i_track
]
->
fmt
.
subs
.
spu
.
i_original_frame_width
,
&
tracks
[
i_track
]
->
fmt
.
subs
.
spu
.
i_original_frame_height
)
==
2
)
{
{
msg_Dbg
(
&
sys
.
demuxer
,
"original frame size vobsubs: %dx%d"
,
t
k
->
fmt
.
subs
.
spu
.
i_original_frame_width
,
tk
->
fmt
.
subs
.
spu
.
i_original_frame_height
);
msg_Dbg
(
&
sys
.
demuxer
,
"original frame size vobsubs: %dx%d"
,
t
racks
[
i_track
]
->
fmt
.
subs
.
spu
.
i_original_frame_width
,
tracks
[
i_track
]
->
fmt
.
subs
.
spu
.
i_original_frame_height
);
}
}
else
else
{
{
...
@@ -1875,26 +1906,26 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1875,26 +1906,26 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
free
(
p_buf
);
free
(
p_buf
);
}
}
}
}
else
if
(
!
strcmp
(
t
k
->
psz_codec
,
"B_VOBBTN"
)
)
else
if
(
!
strcmp
(
t
racks
[
i_track
]
->
psz_codec
,
"B_VOBBTN"
)
)
{
{
/* FIXME: support this codec */
/* FIXME: support this codec */
msg_Err
(
&
sys
.
demuxer
,
"Vob Buttons not supported yet[%d, n=%d]"
,
i_track
,
tk
->
i_number
);
msg_Err
(
&
sys
.
demuxer
,
"Vob Buttons not supported yet[%d, n=%d]"
,
i_track
,
tracks
[
i_track
]
->
i_number
);
tk
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
tracks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
's'
,
'p'
,
'u'
,
' '
);
sys
.
StartUiThread
();
}
}
else
else
{
{
msg_Err
(
&
sys
.
demuxer
,
"unknow codec id=`%s'"
,
t
k
->
psz_codec
);
msg_Err
(
&
sys
.
demuxer
,
"unknow codec id=`%s'"
,
t
racks
[
i_track
]
->
psz_codec
);
t
k
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
t
racks
[
i_track
]
->
fmt
.
i_codec
=
VLC_FOURCC
(
'u'
,
'n'
,
'd'
,
'f'
);
}
}
if
(
t
k
->
b_default
)
if
(
t
racks
[
i_track
]
->
b_default
)
{
{
t
k
->
fmt
.
i_priority
=
1000
;
t
racks
[
i_track
]
->
fmt
.
i_priority
=
1000
;
}
}
t
k
->
p_es
=
es_out_Add
(
sys
.
demuxer
.
out
,
&
tk
->
fmt
);
t
racks
[
i_track
]
->
p_es
=
es_out_Add
(
sys
.
demuxer
.
out
,
&
tracks
[
i_track
]
->
fmt
);
es_out_Control
(
sys
.
demuxer
.
out
,
ES_OUT_SET_NEXT_DISPLAY_TIME
,
tk
->
p_es
,
i_start_time
);
es_out_Control
(
sys
.
demuxer
.
out
,
ES_OUT_SET_NEXT_DISPLAY_TIME
,
tracks
[
i_track
]
->
p_es
,
i_start_time
);
#undef tk
}
}
sys
.
i_start_pts
=
i_start_time
;
sys
.
i_start_pts
=
i_start_time
;
...
@@ -1907,19 +1938,125 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
...
@@ -1907,19 +1938,125 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
return
true
;
return
true
;
}
}
void
demux_sys_t
::
StartUiThread
()
{
if
(
!
b_ui_hooked
)
{
b_ui_hooked
=
true
;
/* FIXME hack hack hack hack FIXME */
/* Get p_input and create variable */
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
&
demuxer
,
VLC_OBJECT_INPUT
,
FIND_PARENT
);
var_Create
(
p_input
,
"x-start"
,
VLC_VAR_INTEGER
);
var_Create
(
p_input
,
"y-start"
,
VLC_VAR_INTEGER
);
var_Create
(
p_input
,
"x-end"
,
VLC_VAR_INTEGER
);
var_Create
(
p_input
,
"y-end"
,
VLC_VAR_INTEGER
);
var_Create
(
p_input
,
"color"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_input
,
"menu-contrast"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_input
,
"highlight"
,
VLC_VAR_BOOL
);
var_Create
(
p_input
,
"highlight-mutex"
,
VLC_VAR_MUTEX
);
/* Now create our event thread catcher */
p_ev
=
(
event_thread_t
*
)
vlc_object_create
(
&
demuxer
,
sizeof
(
event_thread_t
)
);
p_ev
->
p_demux
=
&
demuxer
;
vlc_thread_create
(
p_ev
,
"mkv event thread handler"
,
EventThread
,
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
);
}
}
void
demux_sys_t
::
StopUiThread
()
{
if
(
b_ui_hooked
)
{
p_ev
->
b_die
=
VLC_TRUE
;
vlc_thread_join
(
p_ev
);
vlc_object_destroy
(
p_ev
);
var_Destroy
(
p_input
,
"highlight-mutex"
);
var_Destroy
(
p_input
,
"highlight"
);
var_Destroy
(
p_input
,
"x-start"
);
var_Destroy
(
p_input
,
"x-end"
);
var_Destroy
(
p_input
,
"y-start"
);
var_Destroy
(
p_input
,
"y-end"
);
var_Destroy
(
p_input
,
"color"
);
var_Destroy
(
p_input
,
"menu-contrast"
);
}
b_ui_hooked
=
false
;
}
int
demux_sys_t
::
EventMouse
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
event_thread_t
*
p_ev
=
(
event_thread_t
*
)
p_data
;
vlc_mutex_lock
(
&
p_ev
->
lock
);
if
(
psz_var
[
6
]
==
'c'
)
p_ev
->
b_clicked
=
VLC_TRUE
;
else
if
(
psz_var
[
6
]
==
'm'
)
p_ev
->
b_moved
=
VLC_TRUE
;
vlc_mutex_unlock
(
&
p_ev
->
lock
);
return
VLC_SUCCESS
;
}
int
demux_sys_t
::
EventKey
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
event_thread_t
*
p_ev
=
(
event_thread_t
*
)
p_data
;
vlc_mutex_lock
(
&
p_ev
->
lock
);
p_ev
->
b_key
=
VLC_TRUE
;
vlc_mutex_unlock
(
&
p_ev
->
lock
);
return
VLC_SUCCESS
;
}
int
demux_sys_t
::
EventThread
(
vlc_object_t
*
p_this
)
{
event_thread_t
*
p_ev
=
(
event_thread_t
*
)
p_this
;
demux_sys_t
*
p_sys
=
p_ev
->
p_demux
->
p_sys
;
vlc_object_t
*
p_vout
=
NULL
;
vlc_mutex_init
(
p_ev
,
&
p_ev
->
lock
);
p_ev
->
b_moved
=
VLC_FALSE
;
p_ev
->
b_clicked
=
VLC_FALSE
;
p_ev
->
b_key
=
VLC_FALSE
;
/* catch all key event */
var_AddCallback
(
p_ev
->
p_vlc
,
"key-pressed"
,
EventKey
,
p_ev
);
/* main loop */
while
(
!
p_ev
->
b_die
)
{
/* Wait a bit */
msleep
(
10000
);
}
/* Release callback */
if
(
p_vout
)
{
var_DelCallback
(
p_vout
,
"mouse-moved"
,
EventMouse
,
p_ev
);
var_DelCallback
(
p_vout
,
"mouse-clicked"
,
EventMouse
,
p_ev
);
vlc_object_release
(
p_vout
);
}
var_DelCallback
(
p_ev
->
p_vlc
,
"key-pressed"
,
EventKey
,
p_ev
);
vlc_mutex_destroy
(
&
p_ev
->
lock
);
return
VLC_SUCCESS
;
}
void
matroska_segment_c
::
UnSelect
(
)
void
matroska_segment_c
::
UnSelect
(
)
{
{
size_t
i_track
;
size_t
i_track
;
sys
.
StopUiThread
();
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
{
{
#define tk tracks[i_track]
if
(
tracks
[
i_track
]
->
p_es
!=
NULL
)
if
(
tk
->
p_es
!=
NULL
)
{
{
es_out_Del
(
sys
.
demuxer
.
out
,
t
k
->
p_es
);
es_out_Del
(
sys
.
demuxer
.
out
,
t
racks
[
i_track
]
->
p_es
);
t
k
->
p_es
=
NULL
;
t
racks
[
i_track
]
->
p_es
=
NULL
;
}
}
#undef tk
}
}
delete
ep
;
delete
ep
;
ep
=
NULL
;
ep
=
NULL
;
...
@@ -2980,6 +3117,10 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
...
@@ -2980,6 +3117,10 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
psz_type
=
"subtitle"
;
psz_type
=
"subtitle"
;
tk
->
fmt
.
i_cat
=
SPU_ES
;
tk
->
fmt
.
i_cat
=
SPU_ES
;
break
;
break
;
case
track_buttons
:
psz_type
=
"buttons"
;
tk
->
fmt
.
i_cat
=
SPU_ES
;
break
;
default:
default:
psz_type
=
"unknown"
;
psz_type
=
"unknown"
;
tk
->
fmt
.
i_cat
=
UNKNOWN_ES
;
tk
->
fmt
.
i_cat
=
UNKNOWN_ES
;
...
@@ -4350,16 +4491,15 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -4350,16 +4491,15 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
es_out_Control
(
sys
.
demuxer
.
out
,
ES_OUT_RESET_PCR
);
es_out_Control
(
sys
.
demuxer
.
out
,
ES_OUT_RESET_PCR
);
/* now parse until key frame */
/* now parse until key frame */
#define tk tracks[i_track]
i_track_skipping
=
0
;
i_track_skipping
=
0
;
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
{
{
if
(
t
k
->
fmt
.
i_cat
==
VIDEO_ES
)
if
(
t
racks
[
i_track
]
->
fmt
.
i_cat
==
VIDEO_ES
)
{
{
t
k
->
b_search_keyframe
=
VLC_TRUE
;
t
racks
[
i_track
]
->
b_search_keyframe
=
VLC_TRUE
;
i_track_skipping
++
;
i_track_skipping
++
;
}
}
es_out_Control
(
sys
.
demuxer
.
out
,
ES_OUT_SET_NEXT_DISPLAY_TIME
,
t
k
->
p_es
,
i_date
);
es_out_Control
(
sys
.
demuxer
.
out
,
ES_OUT_SET_NEXT_DISPLAY_TIME
,
t
racks
[
i_track
]
->
p_es
,
i_date
);
}
}
...
@@ -4374,7 +4514,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -4374,7 +4514,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
for
(
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
{
{
if
(
t
k
->
i_number
==
block
->
TrackNum
()
)
if
(
t
racks
[
i_track
]
->
i_number
==
block
->
TrackNum
()
)
{
{
break
;
break
;
}
}
...
@@ -4389,14 +4529,14 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -4389,14 +4529,14 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
BlockDecode
(
&
sys
.
demuxer
,
block
,
sys
.
i_pts
,
0
);
BlockDecode
(
&
sys
.
demuxer
,
block
,
sys
.
i_pts
,
0
);
i_track_skipping
=
0
;
i_track_skipping
=
0
;
}
}
else
if
(
t
k
->
fmt
.
i_cat
==
VIDEO_ES
)
else
if
(
t
racks
[
i_track
]
->
fmt
.
i_cat
==
VIDEO_ES
)
{
{
if
(
i_block_ref1
==
-
1
&&
t
k
->
b_search_keyframe
)
if
(
i_block_ref1
==
-
1
&&
t
racks
[
i_track
]
->
b_search_keyframe
)
{
{
t
k
->
b_search_keyframe
=
VLC_FALSE
;
t
racks
[
i_track
]
->
b_search_keyframe
=
VLC_FALSE
;
i_track_skipping
--
;
i_track_skipping
--
;
}
}
if
(
!
t
k
->
b_search_keyframe
)
if
(
!
t
racks
[
i_track
]
->
b_search_keyframe
)
{
{
BlockDecode
(
&
sys
.
demuxer
,
block
,
sys
.
i_pts
,
0
);
BlockDecode
(
&
sys
.
demuxer
,
block
,
sys
.
i_pts
,
0
);
}
}
...
@@ -4405,7 +4545,6 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -4405,7 +4545,6 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
delete
block
;
delete
block
;
}
}
#undef tk
}
}
void
virtual_segment_c
::
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
chapter_item_c
*
psz_chapter
)
void
virtual_segment_c
::
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
chapter_item_c
*
psz_chapter
)
...
...
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