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
437bb4a8
Commit
437bb4a8
authored
Sep 12, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for DTS to es demuxer.
parent
eb516599
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
31 deletions
+105
-31
modules/demux/mpeg/es.c
modules/demux/mpeg/es.c
+105
-31
No files found.
modules/demux/mpeg/es.c
View file @
437bb4a8
...
@@ -45,7 +45,7 @@ static void Close( vlc_object_t * );
...
@@ -45,7 +45,7 @@ static void Close( vlc_object_t * );
vlc_module_begin
();
vlc_module_begin
();
set_category
(
CAT_INPUT
);
set_category
(
CAT_INPUT
);
set_subcategory
(
SUBCAT_INPUT_DEMUX
);
set_subcategory
(
SUBCAT_INPUT_DEMUX
);
set_description
(
N_
(
"MPEG-I/II/4 / A52 audio"
)
);
set_description
(
N_
(
"MPEG-I/II/4 / A52
/ DTS
audio"
)
);
set_capability
(
"demux"
,
155
);
set_capability
(
"demux"
,
155
);
set_callbacks
(
Open
,
Close
);
set_callbacks
(
Open
,
Close
);
...
@@ -58,6 +58,8 @@ vlc_module_begin();
...
@@ -58,6 +58,8 @@ vlc_module_begin();
add_shortcut
(
"ac3"
);
add_shortcut
(
"ac3"
);
add_shortcut
(
"a52"
);
add_shortcut
(
"a52"
);
add_shortcut
(
"dts"
);
vlc_module_end
();
vlc_module_end
();
/*****************************************************************************
/*****************************************************************************
...
@@ -117,10 +119,14 @@ static int AacInit( demux_t *p_demux );
...
@@ -117,10 +119,14 @@ static int AacInit( demux_t *p_demux );
static
int
A52Probe
(
demux_t
*
p_demux
,
int64_t
*
pi_offset
);
static
int
A52Probe
(
demux_t
*
p_demux
,
int64_t
*
pi_offset
);
static
int
A52Init
(
demux_t
*
p_demux
);
static
int
A52Init
(
demux_t
*
p_demux
);
static
int
DtsProbe
(
demux_t
*
p_demux
,
int64_t
*
pi_offset
);
static
int
DtsInit
(
demux_t
*
p_demux
);
static
const
codec_t
p_codec
[]
=
{
static
const
codec_t
p_codec
[]
=
{
{
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
),
false
,
"mp4 audio"
,
AacProbe
,
AacInit
},
{
VLC_FOURCC
(
'm'
,
'p'
,
'4'
,
'a'
),
false
,
"mp4 audio"
,
AacProbe
,
AacInit
},
{
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'a'
),
false
,
"mpeg audio"
,
MpgaProbe
,
MpgaInit
},
{
VLC_FOURCC
(
'm'
,
'p'
,
'g'
,
'a'
),
false
,
"mpeg audio"
,
MpgaProbe
,
MpgaInit
},
{
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
),
true
,
"a52 audio"
,
A52Probe
,
A52Init
},
{
VLC_FOURCC
(
'a'
,
'5'
,
'2'
,
' '
),
true
,
"a52 audio"
,
A52Probe
,
A52Init
},
{
VLC_FOURCC
(
'd'
,
't'
,
's'
,
' '
),
false
,
"dts audio"
,
DtsProbe
,
DtsInit
},
{
0
,
false
,
NULL
,
NULL
,
NULL
}
{
0
,
false
,
NULL
,
NULL
,
NULL
}
};
};
...
@@ -200,6 +206,8 @@ static int Open( vlc_object_t * p_this )
...
@@ -200,6 +206,8 @@ static int Open( vlc_object_t * p_this )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
msg_Dbg
(
p_demux
,
"detected format %4.4s"
,
(
const
char
*
)
&
p_sys
->
codec
.
i_codec
);
/* Load the audio packetizer */
/* Load the audio packetizer */
p_sys
->
p_packetizer
=
demux_PacketizerNew
(
p_demux
,
AUDIO_ES
,
p_sys
->
codec
.
i_codec
,
p_sys
->
p_packetizer
=
demux_PacketizerNew
(
p_demux
,
AUDIO_ES
,
p_sys
->
codec
.
i_codec
,
p_sys
->
codec
.
psz_name
);
p_sys
->
codec
.
psz_name
);
...
@@ -662,40 +670,21 @@ static int WavSkipHeader( demux_t *p_demux, int *pi_skip )
...
@@ -662,40 +670,21 @@ static int WavSkipHeader( demux_t *p_demux, int *pi_skip )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
static
int
GenericProbe
(
demux_t
*
p_demux
,
int64_t
*
pi_offset
,
* A52
const
char
*
ppsz_name
[],
*****************************************************************************/
bool
(
*
pf_check
)(
const
uint8_t
*
),
int
i_check_size
)
static
bool
A52CheckSync
(
const
uint8_t
*
p_peek
,
bool
*
p_big_endian
)
{
/* Little endian version of the bitstream */
if
(
p_peek
[
0
]
==
0x77
&&
p_peek
[
1
]
==
0x0b
&&
p_peek
[
4
]
<
0x60
/* bsid < 12 */
)
{
*
p_big_endian
=
false
;
return
true
;
}
/* Big endian version of the bitstream */
else
if
(
p_peek
[
0
]
==
0x0b
&&
p_peek
[
1
]
==
0x77
&&
p_peek
[
5
]
<
0x60
/* bsid < 12 */
)
{
*
p_big_endian
=
true
;
return
true
;
}
return
false
;
}
static
int
A52Probe
(
demux_t
*
p_demux
,
int64_t
*
pi_offset
)
{
{
bool
b_forced_demux
;
bool
b_forced_demux
;
bool
b_big_endian
;
int64_t
i_offset
;
int64_t
i_offset
;
const
uint8_t
*
p_peek
;
const
uint8_t
*
p_peek
;
int
i_skip
;
int
i_skip
;
b_forced_demux
=
demux_IsForced
(
p_demux
,
"a52"
)
||
b_forced_demux
=
false
;
demux_IsForced
(
p_demux
,
"ac3"
);
for
(
int
i
=
0
;
ppsz_name
[
i
]
!=
NULL
;
i
++
)
{
b_forced_demux
|=
demux_IsForced
(
p_demux
,
ppsz_name
[
i
]
);
}
i_offset
=
stream_Tell
(
p_demux
->
s
);
i_offset
=
stream_Tell
(
p_demux
->
s
);
...
@@ -705,13 +694,13 @@ static int A52Probe( demux_t *p_demux, int64_t *pi_offset )
...
@@ -705,13 +694,13 @@ static int A52Probe( demux_t *p_demux, int64_t *pi_offset )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/* peek the begining
(10 is for a52 header)
*/
/* peek the begining */
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_skip
+
10
)
<
i_skip
+
10
)
if
(
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
i_skip
+
i_check_size
)
<
i_skip
+
i_check_size
)
{
{
msg_Err
(
p_demux
,
"cannot peek"
);
msg_Err
(
p_demux
,
"cannot peek"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
if
(
!
A52CheckSync
(
&
p_peek
[
i_skip
],
&
b_big_endian
)
)
if
(
!
pf_check
(
&
p_peek
[
i_skip
]
)
)
{
{
if
(
!
b_forced_demux
)
if
(
!
b_forced_demux
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -721,6 +710,41 @@ static int A52Probe( demux_t *p_demux, int64_t *pi_offset )
...
@@ -721,6 +710,41 @@ static int A52Probe( demux_t *p_demux, int64_t *pi_offset )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
* A52
*****************************************************************************/
static
bool
A52CheckSync
(
const
uint8_t
*
p_peek
,
bool
*
p_big_endian
)
{
/* Little endian version of the bitstream */
if
(
p_peek
[
0
]
==
0x77
&&
p_peek
[
1
]
==
0x0b
&&
p_peek
[
4
]
<
0x60
/* bsid < 12 */
)
{
*
p_big_endian
=
false
;
return
true
;
}
/* Big endian version of the bitstream */
else
if
(
p_peek
[
0
]
==
0x0b
&&
p_peek
[
1
]
==
0x77
&&
p_peek
[
5
]
<
0x60
/* bsid < 12 */
)
{
*
p_big_endian
=
true
;
return
true
;
}
return
false
;
}
static
bool
A52CheckSyncProbe
(
const
uint8_t
*
p_peek
)
{
bool
b_dummy
;
return
A52CheckSync
(
p_peek
,
&
b_dummy
);
}
static
int
A52Probe
(
demux_t
*
p_demux
,
int64_t
*
pi_offset
)
{
const
char
*
ppsz_name
[]
=
{
"a52"
,
"ac3"
,
NULL
};
return
GenericProbe
(
p_demux
,
pi_offset
,
ppsz_name
,
A52CheckSyncProbe
,
10
);
}
static
int
A52Init
(
demux_t
*
p_demux
)
static
int
A52Init
(
demux_t
*
p_demux
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
...
@@ -738,3 +762,53 @@ static int A52Init( demux_t *p_demux )
...
@@ -738,3 +762,53 @@ static int A52Init( demux_t *p_demux )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
* DTS
*****************************************************************************/
static
bool
DtsCheckSync
(
const
uint8_t
*
p_peek
)
{
/* 14 bits, little endian version of the bitstream */
if
(
p_peek
[
0
]
==
0xff
&&
p_peek
[
1
]
==
0x1f
&&
p_peek
[
2
]
==
0x00
&&
p_peek
[
3
]
==
0xe8
&&
(
p_peek
[
4
]
&
0xf0
)
==
0xf0
&&
p_peek
[
5
]
==
0x07
)
{
return
true
;
}
/* 14 bits, big endian version of the bitstream */
else
if
(
p_peek
[
0
]
==
0x1f
&&
p_peek
[
1
]
==
0xff
&&
p_peek
[
2
]
==
0xe8
&&
p_peek
[
3
]
==
0x00
&&
p_peek
[
4
]
==
0x07
&&
(
p_peek
[
5
]
&
0xf0
)
==
0xf0
)
{
return
true
;
}
/* 16 bits, big endian version of the bitstream */
else
if
(
p_peek
[
0
]
==
0x7f
&&
p_peek
[
1
]
==
0xfe
&&
p_peek
[
2
]
==
0x80
&&
p_peek
[
3
]
==
0x01
)
{
return
true
;
}
/* 16 bits, little endian version of the bitstream */
else
if
(
p_peek
[
0
]
==
0xfe
&&
p_peek
[
1
]
==
0x7f
&&
p_peek
[
2
]
==
0x01
&&
p_peek
[
3
]
==
0x80
)
{
return
true
;
}
return
false
;
}
static
int
DtsProbe
(
demux_t
*
p_demux
,
int64_t
*
pi_offset
)
{
const
char
*
ppsz_name
[]
=
{
"dts"
,
NULL
};
return
GenericProbe
(
p_demux
,
pi_offset
,
ppsz_name
,
DtsCheckSync
,
11
);
}
static
int
DtsInit
(
demux_t
*
p_demux
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
p_sys
->
i_packet_size
=
16384
;
return
VLC_SUCCESS
;
}
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