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
4b004f61
Commit
4b004f61
authored
Oct 14, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: libmp4: add meta keys atom
parent
5495b91f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
modules/demux/mp4/libmp4.c
modules/demux/mp4/libmp4.c
+55
-0
modules/demux/mp4/libmp4.h
modules/demux/mp4/libmp4.h
+12
-0
No files found.
modules/demux/mp4/libmp4.c
View file @
4b004f61
...
...
@@ -3090,6 +3090,60 @@ static void MP4_FreeBox_tref_generic( MP4_Box_t *p_box )
FREENULL
(
p_box
->
data
.
p_tref_generic
->
i_track_ID
);
}
static
int
MP4_ReadBox_keys
(
stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
MP4_READBOX_ENTER
(
MP4_Box_data_keys_t
);
if
(
i_read
<
8
)
MP4_READBOX_EXIT
(
0
);
uint32_t
i_count
;
MP4_GET4BYTES
(
i_count
);
/* reserved + flags */
if
(
i_count
!=
0
)
MP4_READBOX_EXIT
(
0
);
MP4_GET4BYTES
(
i_count
);
p_box
->
data
.
p_keys
->
p_entries
=
calloc
(
i_count
,
sizeof
(
*
p_box
->
data
.
p_keys
->
p_entries
)
);
if
(
!
p_box
->
data
.
p_keys
->
p_entries
)
MP4_READBOX_EXIT
(
0
);
p_box
->
data
.
p_keys
->
i_entry_count
=
i_count
;
uint32_t
i
=
0
;
for
(
;
i
<
i_count
;
i
++
)
{
if
(
i_read
<
8
)
break
;
uint32_t
i_keysize
;
MP4_GET4BYTES
(
i_keysize
);
if
(
(
i_keysize
<
8
)
||
(
i_keysize
-
4
>
i_read
)
)
break
;
MP4_GETFOURCC
(
p_box
->
data
.
p_keys
->
p_entries
[
i
].
i_namespace
);
i_keysize
-=
8
;
p_box
->
data
.
p_keys
->
p_entries
[
i
].
psz_value
=
malloc
(
i_keysize
+
1
);
if
(
!
p_box
->
data
.
p_keys
->
p_entries
[
i
].
psz_value
)
break
;
memcpy
(
p_box
->
data
.
p_keys
->
p_entries
[
i
].
psz_value
,
p_peek
,
i_keysize
);
p_box
->
data
.
p_keys
->
p_entries
[
i
].
psz_value
[
i_keysize
]
=
0
;
p_peek
+=
i_keysize
;
i_read
-=
i_keysize
;
#ifdef MP4_ULTRA_VERBOSE
msg_Dbg
(
p_stream
,
"read box:
\"
keys
\"
: %u '%s'"
,
i
+
1
,
p_box
->
data
.
p_keys
->
p_entries
[
i
].
p_value
);
#endif
}
if
(
i
<
i_count
)
p_box
->
data
.
p_keys
->
i_entry_count
=
i
;
MP4_READBOX_EXIT
(
1
);
}
static
void
MP4_FreeBox_keys
(
MP4_Box_t
*
p_box
)
{
for
(
uint32_t
i
=
0
;
i
<
p_box
->
data
.
p_keys
->
i_entry_count
;
i
++
)
free
(
p_box
->
data
.
p_keys
->
p_entries
[
i
].
psz_value
);
free
(
p_box
->
data
.
p_keys
->
p_entries
);
}
static
int
MP4_ReadBox_meta
(
stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
uint8_t
meta_data
[
8
];
...
...
@@ -3544,6 +3598,7 @@ static const struct
{
ATOM_enda
,
MP4_ReadBox_enda
,
MP4_FreeBox_Common
,
0
},
{
ATOM_iods
,
MP4_ReadBox_iods
,
MP4_FreeBox_Common
,
0
},
{
ATOM_pasp
,
MP4_ReadBox_pasp
,
MP4_FreeBox_Common
,
0
},
{
ATOM_keys
,
MP4_ReadBox_keys
,
MP4_FreeBox_keys
,
ATOM_meta
},
/* Nothing to do with this box */
{
ATOM_mdat
,
MP4_ReadBoxSkip
,
MP4_FreeBox_Common
,
0
},
...
...
modules/demux/mp4/libmp4.h
View file @
4b004f61
...
...
@@ -93,6 +93,7 @@
#define ATOM_mfra VLC_FOURCC( 'm', 'f', 'r', 'a' )
#define ATOM_mfro VLC_FOURCC( 'm', 'f', 'r', 'o' )
#define ATOM_tfra VLC_FOURCC( 't', 'f', 'r', 'a' )
#define ATOM_keys VLC_FOURCC( 'k', 'e', 'y', 's' )
#define ATOM_nmhd VLC_FOURCC( 'n', 'm', 'h', 'd' )
#define ATOM_mp2v VLC_FOURCC( 'm', 'p', '2', 'v' )
...
...
@@ -1191,6 +1192,16 @@ typedef struct
}
MP4_Box_data_gnre_t
;
typedef
struct
{
uint32_t
i_entry_count
;
struct
{
uint32_t
i_namespace
;
char
*
psz_value
;
}
*
p_entries
;
}
MP4_Box_data_keys_t
;
typedef
struct
{
uint32_t
i_track_number
;
...
...
@@ -1347,6 +1358,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_dvc1_t
*
p_dvc1
;
MP4_Box_data_chan_t
*
p_chan
;
MP4_Box_data_enda_t
*
p_enda
;
MP4_Box_data_keys_t
*
p_keys
;
MP4_Box_data_gnre_t
*
p_gnre
;
MP4_Box_data_trkn_t
*
p_trkn
;
MP4_Box_data_iods_t
*
p_iods
;
...
...
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