Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
2171d2e9
Commit
2171d2e9
authored
Sep 08, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: clean up.
parent
e40e6065
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
151 additions
and
451 deletions
+151
-451
modules/demux/mp4/libmp4.c
modules/demux/mp4/libmp4.c
+57
-211
modules/demux/mp4/libmp4.h
modules/demux/mp4/libmp4.h
+58
-194
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.c
+32
-44
modules/demux/mp4/mp4.h
modules/demux/mp4/mp4.h
+4
-2
No files found.
modules/demux/mp4/libmp4.c
View file @
2171d2e9
This diff is collapsed.
Click to expand it.
modules/demux/mp4/libmp4.h
View file @
2171d2e9
This diff is collapsed.
Click to expand it.
modules/demux/mp4/mp4.c
View file @
2171d2e9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
* mp4.c : MP4 file input module for vlc
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.3
5 2003/09/07 22:48:29
fenrir Exp $
* $Id: mp4.c,v 1.3
6 2003/09/08 00:35:16
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
...
@@ -138,21 +138,28 @@ static int Open( vlc_object_t * p_this )
...
@@ -138,21 +138,28 @@ static int Open( vlc_object_t * p_this )
p_input
->
pf_demux
=
Demux
;
p_input
->
pf_demux
=
Demux
;
p_input
->
pf_demux_control
=
Control
;
p_input
->
pf_demux_control
=
Control
;
/* create our structure that will contains all data */
/* create our structure that will contains all data */
p_input
->
p_demux_data
=
p_demux
=
malloc
(
sizeof
(
demux_sys_t
)
);
p_input
->
p_demux_data
=
p_demux
=
malloc
(
sizeof
(
demux_sys_t
)
);
memset
(
p_demux
,
0
,
sizeof
(
demux_sys_t
)
);
memset
(
p_demux
,
0
,
sizeof
(
demux_sys_t
)
);
/* Create stream facilities */
if
(
(
p_demux
->
s
=
stream_OpenInput
(
p_input
)
)
==
NULL
)
{
msg_Err
(
p_input
,
"cannot create stream_t"
);
free
(
p_demux
);
return
VLC_EGENERIC
;
}
/* Now load all boxes ( except raw data ) */
/* Now load all boxes ( except raw data ) */
if
(
!
MP4_BoxGetRoot
(
p_input
,
&
p_demux
->
box_root
)
)
if
(
(
p_demux
->
p_root
=
MP4_BoxGetRoot
(
p_input
)
)
==
NULL
)
{
{
msg_Warn
(
p_input
,
"MP4 plugin discarded (not a valid file)"
);
msg_Warn
(
p_input
,
"MP4 plugin discarded (not a valid file)"
);
return
VLC_EGENERIC
;
goto
error
;
}
}
MP4_BoxDumpStructure
(
p_input
,
&
p_demux
->
box
_root
);
MP4_BoxDumpStructure
(
p_input
,
p_demux
->
p
_root
);
if
(
(
p_ftyp
=
MP4_BoxGet
(
&
p_demux
->
box
_root
,
"/ftyp"
)
)
)
if
(
(
p_ftyp
=
MP4_BoxGet
(
p_demux
->
p
_root
,
"/ftyp"
)
)
)
{
{
switch
(
p_ftyp
->
data
.
p_ftyp
->
i_major_brand
)
switch
(
p_ftyp
->
data
.
p_ftyp
->
i_major_brand
)
{
{
...
@@ -174,9 +181,9 @@ static int Open( vlc_object_t * p_this )
...
@@ -174,9 +181,9 @@ static int Open( vlc_object_t * p_this )
}
}
/* the file need to have one moov box */
/* the file need to have one moov box */
if
(
MP4_BoxCount
(
&
p_demux
->
box
_root
,
"/moov"
)
<=
0
)
if
(
MP4_BoxCount
(
p_demux
->
p
_root
,
"/moov"
)
<=
0
)
{
{
MP4_Box_t
*
p_foov
=
MP4_BoxGet
(
&
p_demux
->
box
_root
,
"/foov"
);
MP4_Box_t
*
p_foov
=
MP4_BoxGet
(
p_demux
->
p
_root
,
"/foov"
);
if
(
!
p_foov
)
if
(
!
p_foov
)
{
{
...
@@ -187,7 +194,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -187,7 +194,7 @@ static int Open( vlc_object_t * p_this )
p_foov
->
i_type
=
FOURCC_moov
;
p_foov
->
i_type
=
FOURCC_moov
;
}
}
if
(
(
p_rmra
=
MP4_BoxGet
(
&
p_demux
->
box
_root
,
"/moov/rmra"
)
)
)
if
(
(
p_rmra
=
MP4_BoxGet
(
p_demux
->
p
_root
,
"/moov/rmra"
)
)
)
{
{
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
int
i_count
=
MP4_BoxCount
(
p_rmra
,
"rmda"
);
int
i_count
=
MP4_BoxCount
(
p_rmra
,
"rmda"
);
...
@@ -267,7 +274,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -267,7 +274,7 @@ static int Open( vlc_object_t * p_this )
}
}
}
}
if
(
!
(
p_mvhd
=
MP4_BoxGet
(
&
p_demux
->
box
_root
,
"/moov/mvhd"
)
)
)
if
(
!
(
p_mvhd
=
MP4_BoxGet
(
p_demux
->
p
_root
,
"/moov/mvhd"
)
)
)
{
{
if
(
!
p_rmra
)
if
(
!
p_rmra
)
{
{
...
@@ -288,7 +295,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -288,7 +295,7 @@ static int Open( vlc_object_t * p_this )
}
}
if
(
!
(
p_demux
->
i_tracks
=
if
(
!
(
p_demux
->
i_tracks
=
MP4_BoxCount
(
&
p_demux
->
box
_root
,
"/moov/trak"
)
)
)
MP4_BoxCount
(
p_demux
->
p
_root
,
"/moov/trak"
)
)
)
{
{
msg_Err
(
p_input
,
"cannot find any /moov/trak"
);
msg_Err
(
p_input
,
"cannot find any /moov/trak"
);
goto
error
;
goto
error
;
...
@@ -332,7 +339,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -332,7 +339,7 @@ static int Open( vlc_object_t * p_this )
/* now process each track and extract all usefull informations */
/* now process each track and extract all usefull informations */
for
(
i
=
0
;
i
<
p_demux
->
i_tracks
;
i
++
)
for
(
i
=
0
;
i
<
p_demux
->
i_tracks
;
i
++
)
{
{
p_trak
=
MP4_BoxGet
(
&
p_demux
->
box
_root
,
"/moov/trak[%d]"
,
i
);
p_trak
=
MP4_BoxGet
(
p_demux
->
p
_root
,
"/moov/trak[%d]"
,
i
);
MP4_TrackCreate
(
p_input
,
&
p_demux
->
track
[
i
],
p_trak
);
MP4_TrackCreate
(
p_input
,
&
p_demux
->
track
[
i
],
p_trak
);
if
(
p_demux
->
track
[
i
].
b_ok
)
if
(
p_demux
->
track
[
i
].
b_ok
)
...
@@ -391,7 +398,12 @@ static int Open( vlc_object_t * p_this )
...
@@ -391,7 +398,12 @@ static int Open( vlc_object_t * p_this )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
Close
(
VLC_OBJECT
(
p_input
)
);
stream_Release
(
p_demux
->
s
);
if
(
p_demux
->
p_root
)
{
MP4_BoxFree
(
p_input
,
p_demux
->
p_root
);
}
free
(
p_demux
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -491,7 +503,6 @@ static int Demux( input_thread_t *p_input )
...
@@ -491,7 +503,6 @@ static int Demux( input_thread_t *p_input )
size_t
i_size
;
size_t
i_size
;
off_t
i_pos
;
off_t
i_pos
;
data_packet_t
*
p_data
;
pes_packet_t
*
p_pes
;
pes_packet_t
*
p_pes
;
/* caculate size and position for this sample */
/* caculate size and position for this sample */
...
@@ -502,44 +513,20 @@ static int Demux( input_thread_t *p_input )
...
@@ -502,44 +513,20 @@ static int Demux( input_thread_t *p_input )
//msg_Dbg( p_input, "stream %d size=%6d pos=%8lld", i_track, i_size, i_pos );
//msg_Dbg( p_input, "stream %d size=%6d pos=%8lld", i_track, i_size, i_pos );
/* go,go go ! */
/* go,go go ! */
if
(
MP4_SeekAbsolute
(
p_input
,
i_pos
)
)
if
(
stream_Seek
(
p_demux
->
s
,
i_pos
)
)
{
{
msg_Warn
(
p_input
,
"track[0x%x] will be disabled (eof?)"
,
track
.
i_track_ID
);
msg_Warn
(
p_input
,
"track[0x%x] will be disabled (eof?)"
,
track
.
i_track_ID
);
MP4_TrackUnselect
(
p_input
,
&
track
);
MP4_TrackUnselect
(
p_input
,
&
track
);
break
;
break
;
}
}
/* now read pes */
/* now create a pes */
if
(
(
p_pes
=
stream_PesPacket
(
p_demux
->
s
,
i_size
)
)
==
NULL
)
if
(
!
(
p_pes
=
input_NewPES
(
p_input
->
p_method_data
)
)
)
{
break
;
}
/* and a data packet for the data */
if
(
!
(
p_data
=
input_NewPacket
(
p_input
->
p_method_data
,
i_size
)
)
)
{
{
input_DeletePES
(
p_input
->
p_method_data
,
p_pes
);
msg_Warn
(
p_input
,
"track[0x%x] will be disabled (eof?)"
,
track
.
i_track_ID
);
MP4_TrackUnselect
(
p_input
,
&
track
);
break
;
break
;
}
}
p_data
->
p_payload_end
=
p_data
->
p_payload_start
+
i_size
;
/* initialisation of all the field */
p_pes
->
i_dts
=
p_pes
->
i_pts
=
0
;
p_pes
->
p_first
=
p_pes
->
p_last
=
p_data
;
p_pes
->
i_nb_data
=
1
;
p_pes
->
i_pes_size
=
i_size
;
if
(
i_size
>
0
)
{
if
(
MP4_ReadData
(
p_input
,
p_data
->
p_payload_start
,
i_size
)
)
{
input_DeletePES
(
p_input
->
p_method_data
,
p_pes
);
msg_Warn
(
p_input
,
"track[0x%x] will be disabled (eof?)"
,
track
.
i_track_ID
);
MP4_TrackUnselect
(
p_input
,
&
track
);
break
;
}
}
p_pes
->
i_dts
=
p_pes
->
i_dts
=
p_pes
->
i_pts
=
input_ClockGetTS
(
p_input
,
p_pes
->
i_pts
=
input_ClockGetTS
(
p_input
,
p_input
->
stream
.
p_selected_program
,
p_input
->
stream
.
p_selected_program
,
...
@@ -657,7 +644,8 @@ static void Close ( vlc_object_t * p_this )
...
@@ -657,7 +644,8 @@ static void Close ( vlc_object_t * p_this )
demux_sys_t
*
p_demux
=
p_input
->
p_demux_data
;
demux_sys_t
*
p_demux
=
p_input
->
p_demux_data
;
msg_Dbg
(
p_input
,
"freeing all memory"
);
msg_Dbg
(
p_input
,
"freeing all memory"
);
MP4_BoxFree
(
p_input
,
&
p_demux
->
box_root
);
MP4_BoxFree
(
p_input
,
p_demux
->
p_root
);
for
(
i_track
=
0
;
i_track
<
p_demux
->
i_tracks
;
i_track
++
)
for
(
i_track
=
0
;
i_track
<
p_demux
->
i_tracks
;
i_track
++
)
{
{
MP4_TrackDestroy
(
p_input
,
&
p_demux
->
track
[
i_track
]
);
MP4_TrackDestroy
(
p_input
,
&
p_demux
->
track
[
i_track
]
);
...
...
modules/demux/mp4/mp4.h
View file @
2171d2e9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* mp4.h : MP4 file input module for vlc
* mp4.h : MP4 file input module for vlc
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: mp4.h,v 1.
6 2003/03/11 18:57:51
fenrir Exp $
* $Id: mp4.h,v 1.
7 2003/09/08 00:35:16
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
...
@@ -127,7 +127,9 @@ typedef struct track_data_mp4_s
...
@@ -127,7 +127,9 @@ typedef struct track_data_mp4_s
*****************************************************************************/
*****************************************************************************/
struct
demux_sys_t
struct
demux_sys_t
{
{
MP4_Box_t
box_root
;
/* container for the whole file */
stream_t
*
s
;
MP4_Box_t
*
p_root
;
/* container for the whole file */
mtime_t
i_pcr
;
mtime_t
i_pcr
;
...
...
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