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
99b90a8a
Commit
99b90a8a
authored
Sep 24, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: mp4: factorize block reading/filtering
parent
2d07e788
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
15 deletions
+29
-15
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.c
+29
-15
No files found.
modules/demux/mp4/mp4.c
View file @
99b90a8a
...
@@ -115,6 +115,7 @@ static void MP4_TrackCreate ( demux_t *, mp4_track_t *, MP4_Box_t *, bool b_for
...
@@ -115,6 +115,7 @@ static void MP4_TrackCreate ( demux_t *, mp4_track_t *, MP4_Box_t *, bool b_for
static
int
MP4_frg_TrackCreate
(
demux_t
*
,
mp4_track_t
*
,
MP4_Box_t
*
);
static
int
MP4_frg_TrackCreate
(
demux_t
*
,
mp4_track_t
*
,
MP4_Box_t
*
);
static
void
MP4_TrackDestroy
(
mp4_track_t
*
);
static
void
MP4_TrackDestroy
(
mp4_track_t
*
);
static
block_t
*
MP4_Block_Read
(
demux_t
*
,
const
mp4_track_t
*
,
int
);
static
void
MP4_Block_Send
(
demux_t
*
,
mp4_track_t
*
,
block_t
*
);
static
void
MP4_Block_Send
(
demux_t
*
,
mp4_track_t
*
,
block_t
*
);
static
int
MP4_TrackSelect
(
demux_t
*
,
mp4_track_t
*
,
mtime_t
);
static
int
MP4_TrackSelect
(
demux_t
*
,
mp4_track_t
*
,
mtime_t
);
...
@@ -391,6 +392,31 @@ static void CreateTracksFromSmooBox( demux_t *p_demux )
...
@@ -391,6 +392,31 @@ static void CreateTracksFromSmooBox( demux_t *p_demux )
}
}
}
}
static
block_t
*
MP4_Block_Read
(
demux_t
*
p_demux
,
const
mp4_track_t
*
p_track
,
int
i_size
)
{
block_t
*
p_block
=
stream_Block
(
p_demux
->
s
,
i_size
);
if
(
!
p_block
)
return
NULL
;
/* might have some encap */
if
(
p_track
->
fmt
.
i_cat
==
SPU_ES
)
{
switch
(
p_track
->
fmt
.
i_codec
)
{
case
VLC_CODEC_TX3G
:
case
VLC_CODEC_SPU
:
/* accept as-is */
break
;
default:
p_block
->
i_buffer
=
0
;
break
;
}
}
return
p_block
;
}
static
void
MP4_Block_Send
(
demux_t
*
p_demux
,
mp4_track_t
*
p_track
,
block_t
*
p_block
)
static
void
MP4_Block_Send
(
demux_t
*
p_demux
,
mp4_track_t
*
p_track
,
block_t
*
p_block
)
{
{
if
(
p_track
->
b_chans_reorder
&&
aout_BitsPerSample
(
p_track
->
fmt
.
i_codec
)
)
if
(
p_track
->
b_chans_reorder
&&
aout_BitsPerSample
(
p_track
->
fmt
.
i_codec
)
)
...
@@ -933,19 +959,13 @@ static int Demux( demux_t *p_demux )
...
@@ -933,19 +959,13 @@ static int Demux( demux_t *p_demux )
}
}
/* now read pes */
/* now read pes */
if
(
!
(
p_block
=
stream_Block
(
p_demux
->
s
,
i_samplessize
))
)
if
(
!
(
p_block
=
MP4_Block_Read
(
p_demux
,
tk
,
i_samplessize
))
)
{
{
msg_Warn
(
p_demux
,
"track[0x%x] will be disabled (eof?)"
,
msg_Warn
(
p_demux
,
"track[0x%x] will be disabled (eof?)"
,
tk
->
i_track_ID
);
tk
->
i_track_ID
);
MP4_TrackUnselect
(
p_demux
,
tk
);
MP4_TrackUnselect
(
p_demux
,
tk
);
goto
end
;
goto
end
;
}
}
else
if
(
tk
->
fmt
.
i_cat
==
SPU_ES
)
{
if
(
tk
->
fmt
.
i_codec
!=
VLC_CODEC_TX3G
&&
tk
->
fmt
.
i_codec
!=
VLC_CODEC_SPU
)
p_block
->
i_buffer
=
0
;
}
/* dts */
/* dts */
p_block
->
i_dts
=
VLC_TS_0
+
MP4_TrackGetDTS
(
p_demux
,
tk
);
p_block
->
i_dts
=
VLC_TS_0
+
MP4_TrackGetDTS
(
p_demux
,
tk
);
...
@@ -4912,7 +4932,7 @@ static int LeafParseTRUN( demux_t *p_demux, mp4_track_t *p_track,
...
@@ -4912,7 +4932,7 @@ static int LeafParseTRUN( demux_t *p_demux, mp4_track_t *p_track,
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
block_t
*
p_block
=
stream_Block
(
p_demux
->
s
,
__MIN
(
len
,
INT32_MAX
)
);
block_t
*
p_block
=
MP4_Block_Read
(
p_demux
,
p_track
,
__MIN
(
len
,
INT32_MAX
)
);
uint32_t
i_read
=
(
p_block
)
?
p_block
->
i_buffer
:
0
;
uint32_t
i_read
=
(
p_block
)
?
p_block
->
i_buffer
:
0
;
if
(
i_read
<
len
)
if
(
i_read
<
len
)
{
{
...
@@ -5139,7 +5159,7 @@ static int LeafParseMDATwithMOOV( demux_t *p_demux )
...
@@ -5139,7 +5159,7 @@ static int LeafParseMDATwithMOOV( demux_t *p_demux )
/* now read pes */
/* now read pes */
if
(
!
(
p_block
=
stream_Block
(
p_demux
->
s
,
i_samplessize
))
)
if
(
!
(
p_block
=
MP4_Block_Read
(
p_demux
,
p_track
,
i_samplessize
))
)
{
{
uint64_t
i_pos
;
uint64_t
i_pos
;
if
(
MP4_stream_Tell
(
p_demux
->
s
,
&
i_pos
)
)
if
(
MP4_stream_Tell
(
p_demux
->
s
,
&
i_pos
)
)
...
@@ -5149,12 +5169,6 @@ static int LeafParseMDATwithMOOV( demux_t *p_demux )
...
@@ -5149,12 +5169,6 @@ static int LeafParseMDATwithMOOV( demux_t *p_demux )
}
}
goto
error
;
goto
error
;
}
}
else
if
(
p_track
->
fmt
.
i_cat
==
SPU_ES
)
{
if
(
p_track
->
fmt
.
i_codec
!=
VLC_CODEC_TX3G
&&
p_track
->
fmt
.
i_codec
!=
VLC_CODEC_SPU
)
p_block
->
i_buffer
=
0
;
}
i_nb_samples
+=
i_samplescounttoread
;
i_nb_samples
+=
i_samplescounttoread
;
i_current_pos
+=
i_samplessize
;
i_current_pos
+=
i_samplessize
;
...
...
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