Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
d4e1fc3b
Commit
d4e1fc3b
authored
Sep 03, 2014
by
Rafaël Carré
Browse files
mp4 demux: read dec3 box
parent
64dbbc38
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/demux/mp4/libmp4.c
View file @
d4e1fc3b
...
...
@@ -1498,6 +1498,47 @@ static void MP4_FreeBox_stsdext_chan( MP4_Box_t *p_box )
free
(
p_chan
->
layout
.
p_descriptions
);
}
static
int
MP4_ReadBox_dec3
(
stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
MP4_READBOX_ENTER
(
MP4_Box_data_dec3_t
);
MP4_Box_data_dec3_t
*
p_dec3
=
p_box
->
data
.
p_dec3
;
unsigned
i_header
;
MP4_GET2BYTES
(
i_header
);
p_dec3
->
i_data_rate
=
i_header
>>
3
;
p_dec3
->
i_num_ind_sub
=
(
i_header
&
0x7
)
+
1
;
for
(
uint8_t
i
=
0
;
i
<
p_dec3
->
i_num_ind_sub
;
i
++
)
{
MP4_GET3BYTES
(
i_header
);
p_dec3
->
stream
[
i
].
i_fscod
=
(
i_header
>>
22
)
&
0x03
;
p_dec3
->
stream
[
i
].
i_bsid
=
(
i_header
>>
17
)
&
0x01f
;
p_dec3
->
stream
[
i
].
i_bsmod
=
(
i_header
>>
12
)
&
0x01f
;
p_dec3
->
stream
[
i
].
i_acmod
=
(
i_header
>>
9
)
&
0x07
;
p_dec3
->
stream
[
i
].
i_lfeon
=
(
i_header
>>
8
)
&
0x01
;
p_dec3
->
stream
[
i
].
i_num_dep_sub
=
(
i_header
>>
1
)
&
0x0f
;
if
(
p_dec3
->
stream
[
i
].
i_num_dep_sub
)
{
MP4_GET1BYTE
(
p_dec3
->
stream
[
i
].
i_chan_loc
);
p_dec3
->
stream
[
i
].
i_chan_loc
|=
(
i_header
&
1
)
<<
8
;
}
else
p_dec3
->
stream
[
i
].
i_chan_loc
=
0
;
}
#ifdef MP4_VERBOSE
msg_Dbg
(
p_stream
,
"read box:
\"
dec3
\"
bitrate %dkbps %d independant substreams"
,
p_dec3
->
i_data_rate
,
p_dec3
->
i_num_ind_sub
);
for
(
uint8_t
i
=
0
;
i
<
p_dec3
->
i_num_ind_sub
;
i
++
)
msg_Dbg
(
p_stream
,
"
\t
stream %d: bsid=0x%x bsmod=0x%x acmod=0x%x lfeon=0x%x "
"num dependant subs=%d chan_loc=0x%x"
,
i
,
p_dec3
->
stream
[
i
].
i_bsid
,
p_dec3
->
stream
[
i
].
i_bsmod
,
p_dec3
->
stream
[
i
].
i_acmod
,
p_dec3
->
stream
[
i
].
i_lfeon
,
p_dec3
->
stream
[
i
].
i_num_dep_sub
,
p_dec3
->
stream
[
i
].
i_chan_loc
);
#endif
MP4_READBOX_EXIT
(
1
);
}
static
int
MP4_ReadBox_dac3
(
stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
MP4_Box_data_dac3_t
*
p_dac3
;
...
...
@@ -3376,6 +3417,7 @@ static const struct
{
ATOM_avcC
,
MP4_ReadBox_avcC
,
MP4_FreeBox_avcC
,
0
},
{
ATOM_hvcC
,
MP4_ReadBox_hvcC
,
MP4_FreeBox_hvcC
,
0
},
{
ATOM_dac3
,
MP4_ReadBox_dac3
,
MP4_FreeBox_Common
,
0
},
{
ATOM_dec3
,
MP4_ReadBox_dec3
,
MP4_FreeBox_Common
,
0
},
{
ATOM_dvc1
,
MP4_ReadBox_dvc1
,
MP4_FreeBox_Common
,
0
},
{
ATOM_enda
,
MP4_ReadBox_enda
,
MP4_FreeBox_Common
,
0
},
{
ATOM_iods
,
MP4_ReadBox_iods
,
MP4_FreeBox_Common
,
0
},
...
...
modules/demux/mp4/libmp4.h
View file @
d4e1fc3b
...
...
@@ -1107,6 +1107,23 @@ typedef struct
}
layout
;
}
MP4_Box_data_chan_t
;
typedef
struct
{
uint16_t
i_data_rate
;
uint8_t
i_num_ind_sub
;
struct
{
uint8_t
i_fscod
;
uint8_t
i_bsid
;
uint8_t
i_bsmod
;
uint8_t
i_acmod
;
uint8_t
i_lfeon
;
uint8_t
i_num_dep_sub
;
uint16_t
i_chan_loc
;
}
stream
[
8
];
}
MP4_Box_data_dec3_t
;
typedef
struct
{
uint8_t
i_fscod
;
...
...
@@ -1291,6 +1308,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_esds_t
*
p_esds
;
MP4_Box_data_avcC_t
*
p_avcC
;
MP4_Box_data_dac3_t
*
p_dac3
;
MP4_Box_data_dec3_t
*
p_dec3
;
MP4_Box_data_dvc1_t
*
p_dvc1
;
MP4_Box_data_chan_t
*
p_chan
;
MP4_Box_data_enda_t
*
p_enda
;
...
...
modules/demux/mp4/mp4.c
View file @
d4e1fc3b
...
...
@@ -2424,6 +2424,20 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_track
->
fmt
.
i_codec
=
VLC_CODEC_MPGA
;
break
;
}
case
(
VLC_FOURCC
(
'e'
,
'c'
,
'-'
,
'3'
)
):
{
MP4_Box_t
*
p_dec3_box
=
MP4_BoxGet
(
p_sample
,
"dec3"
,
0
);
p_track
->
fmt
.
i_codec
=
VLC_CODEC_EAC3
;
if
(
p_dec3_box
)
{
MP4_Box_data_dec3_t
*
p_dec3
=
p_dec3_box
->
data
.
p_dec3
;
p_track
->
fmt
.
audio
.
i_channels
=
0
;
p_track
->
fmt
.
i_bitrate
=
p_dec3
->
i_data_rate
*
1000
;
p_track
->
fmt
.
audio
.
i_bitspersample
=
0
;
}
break
;
}
case
(
VLC_FOURCC
(
'a'
,
'c'
,
'-'
,
'3'
)
):
{
MP4_Box_t
*
p_dac3_box
=
MP4_BoxGet
(
p_sample
,
"dac3"
,
0
);
...
...
@@ -2447,11 +2461,6 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
}
break
;
}
case
(
VLC_FOURCC
(
'e'
,
'c'
,
'-'
,
'3'
)
):
{
p_track
->
fmt
.
i_codec
=
VLC_CODEC_EAC3
;
break
;
}
case
(
VLC_FOURCC
(
'r'
,
'a'
,
'w'
,
' '
)
):
case
(
VLC_FOURCC
(
'N'
,
'O'
,
'N'
,
'E'
)
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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