Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
aba1225f
Commit
aba1225f
authored
Dec 28, 2002
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for 32 kHz LPCM streams (thanks _Demo_ !).
parent
de7a1d45
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
147 additions
and
60 deletions
+147
-60
Makefile.am
Makefile.am
+3
-3
modules/codec/a52.c
modules/codec/a52.c
+11
-8
modules/codec/lpcm.c
modules/codec/lpcm.c
+131
-47
src/audio_output/dec.c
src/audio_output/dec.c
+2
-2
No files found.
Makefile.am
View file @
aba1225f
...
@@ -466,9 +466,9 @@ vlc.app: vlc $(PLUGIN_FILES)
...
@@ -466,9 +466,9 @@ vlc.app: vlc $(PLUGIN_FILES)
$(INSTALL)
-d
vlc.app/Contents/MacOS/share
$(INSTALL)
-d
vlc.app/Contents/MacOS/share
$(INSTALL)
-m
644 share/
*
.psf vlc.app/Contents/MacOS/share
$(INSTALL)
-m
644 share/
*
.psf vlc.app/Contents/MacOS/share
$(INSTALL)
-d
vlc.app/Contents/MacOS/locale
$(INSTALL)
-d
vlc.app/Contents/MacOS/locale
for
i
in
$(CATALOGS)
;
do
for
i
in
$(CATALOGS)
;
do
\
mkdir
-p
vlc.app/Contents/MacOS/locale/
$
${i%.gmo}
/LC_MESSAGES
mkdir
-p
vlc.app/Contents/MacOS/locale/
$
${i%.gmo}
/LC_MESSAGES
\
cp
po/
$$
i vlc.app/Contents/MacOS/locale/
$
${i%.gmo}
/LC_MESSAGES/vlc.mo
cp
po/
$$
i vlc.app/Contents/MacOS/locale/
$
${i%.gmo}
/LC_MESSAGES/vlc.mo
\
done
done
endif
endif
...
...
modules/codec/a52.c
View file @
aba1225f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* a52.c: A/52 basic parser
* a52.c: A/52 basic parser
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001-2002 VideoLAN
* Copyright (C) 2001-2002 VideoLAN
* $Id: a52.c,v 1.
19 2002/12/06 16:34:05 sam
Exp $
* $Id: a52.c,v 1.
20 2002/12/28 02:02:18 massiot
Exp $
*
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Authors: Stphane Borel <stef@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
...
@@ -137,7 +137,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
...
@@ -137,7 +137,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
return
-
1
;
return
-
1
;
}
}
/*
d
ecoder thread's main loop */
/*
D
ecoder thread's main loop */
while
(
!
p_dec
->
p_fifo
->
b_die
&&
!
p_dec
->
p_fifo
->
b_error
)
while
(
!
p_dec
->
p_fifo
->
b_die
&&
!
p_dec
->
p_fifo
->
b_error
)
{
{
int
i_bit_rate
;
int
i_bit_rate
;
...
@@ -149,10 +149,11 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
...
@@ -149,10 +149,11 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
/* Look for sync word - should be 0x0b77 */
/* Look for sync word - should be 0x0b77 */
RealignBits
(
&
p_dec
->
bit_stream
);
RealignBits
(
&
p_dec
->
bit_stream
);
while
(
(
ShowBits
(
&
p_dec
->
bit_stream
,
16
)
)
!=
0x0b77
&&
while
(
(
ShowBits
(
&
p_dec
->
bit_stream
,
16
)
)
!=
0x0b77
&&
(
!
p_dec
->
p_fifo
->
b_die
)
&&
(
!
p_dec
->
p_fifo
->
b_error
))
(
!
p_dec
->
p_fifo
->
b_die
)
&&
(
!
p_dec
->
p_fifo
->
b_error
)
)
{
{
RemoveBits
(
&
p_dec
->
bit_stream
,
8
);
RemoveBits
(
&
p_dec
->
bit_stream
,
8
);
}
}
if
(
p_dec
->
p_fifo
->
b_die
||
p_dec
->
p_fifo
->
b_error
)
break
;
/* Set the Presentation Time Stamp */
/* Set the Presentation Time Stamp */
NextPTS
(
&
p_dec
->
bit_stream
,
&
pts
,
NULL
);
NextPTS
(
&
p_dec
->
bit_stream
,
&
pts
,
NULL
);
...
@@ -163,7 +164,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
...
@@ -163,7 +164,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
/* Get A/52 frame header */
/* Get A/52 frame header */
GetChunk
(
&
p_dec
->
bit_stream
,
p_header
,
7
);
GetChunk
(
&
p_dec
->
bit_stream
,
p_header
,
7
);
if
(
p_dec
->
p_fifo
->
b_die
)
break
;
if
(
p_dec
->
p_fifo
->
b_die
||
p_dec
->
p_fifo
->
b_error
)
break
;
/* Check if frame is valid and get frame info */
/* Check if frame is valid and get frame info */
i_frame_size
=
SyncInfo
(
p_header
,
&
i_original_channels
,
&
i_rate
,
i_frame_size
=
SyncInfo
(
p_header
,
&
i_original_channels
,
&
i_rate
,
...
@@ -218,7 +219,11 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
...
@@ -218,7 +219,11 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
p_buffer
=
aout_DecNewBuffer
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
p_buffer
=
aout_DecNewBuffer
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
A52_FRAME_NB
);
A52_FRAME_NB
);
if
(
p_buffer
==
NULL
)
return
-
1
;
if
(
p_buffer
==
NULL
)
{
p_dec
->
p_fifo
->
b_error
=
1
;
break
;
}
p_buffer
->
start_date
=
aout_DateGet
(
&
end_date
);
p_buffer
->
start_date
=
aout_DateGet
(
&
end_date
);
p_buffer
->
end_date
=
aout_DateIncrement
(
&
end_date
,
p_buffer
->
end_date
=
aout_DateIncrement
(
&
end_date
,
A52_FRAME_NB
);
A52_FRAME_NB
);
...
@@ -234,17 +239,15 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
...
@@ -234,17 +239,15 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
break
;
break
;
}
}
/* Send the buffer to the
mixer
. */
/* Send the buffer to the
aout core
. */
aout_DecPlay
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
p_buffer
);
aout_DecPlay
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
p_buffer
);
}
}
/* If b_error is set, the spdif thread enters the error loop */
if
(
p_dec
->
p_fifo
->
b_error
)
if
(
p_dec
->
p_fifo
->
b_error
)
{
{
DecoderError
(
p_dec
->
p_fifo
);
DecoderError
(
p_dec
->
p_fifo
);
}
}
/* End of the spdif decoder thread */
EndThread
(
p_dec
);
EndThread
(
p_dec
);
return
0
;
return
0
;
...
...
modules/codec/lpcm.c
View file @
aba1225f
...
@@ -2,10 +2,11 @@
...
@@ -2,10 +2,11 @@
* lpcm.c: lpcm decoder module
* lpcm.c: lpcm decoder module
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm.c,v 1.
7 2002/11/14 22:38:47
massiot Exp $
* $Id: lpcm.c,v 1.
8 2002/12/28 02:02:18
massiot Exp $
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
* Henri Fallon <henri@videolan.org>
* Christophe Massiot <massiot@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
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -37,7 +38,8 @@
...
@@ -37,7 +38,8 @@
# include <unistd.h>
/* getpid() */
# include <unistd.h>
/* getpid() */
#endif
#endif
#define LPCM_FRAME_NB 502
/* DVD PES size (2048) - 40 bytes (headers) */
#define LPCM_FRAME_LENGTH 2008
/*****************************************************************************
/*****************************************************************************
* dec_thread_t : lpcm decoder thread descriptor
* dec_thread_t : lpcm decoder thread descriptor
...
@@ -65,14 +67,28 @@ typedef struct dec_thread_t
...
@@ -65,14 +67,28 @@ typedef struct dec_thread_t
audio_date_t
end_date
;
audio_date_t
end_date
;
}
dec_thread_t
;
}
dec_thread_t
;
/*
* LPCM header :
* - PES header
* - private stream ID (16 bits) == 0xA0 -> not in the bitstream
* - frame number (8 bits)
* - unknown (16 bits) == 0x0003 ?
* - unknown (4 bits)
* - current frame (4 bits)
* - unknown (2 bits)
* - frequency (2 bits) 0 == 48 kHz, 1 == 32 kHz, 2 == ?, 3 == ?
* - unknown (1 bit)
* - number of channels - 1 (3 bits) 1 == 2 channels
* - start code (8 bits) == 0x80
*/
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
int
OpenDecoder
(
vlc_object_t
*
);
static
int
OpenDecoder
(
vlc_object_t
*
);
static
int
RunDecoder
(
decoder_fifo_t
*
);
static
int
RunDecoder
(
decoder_fifo_t
*
);
void
DecodeFrame
(
dec_thread_t
*
);
static
void
DecodeFrame
(
dec_thread_t
*
);
// static int InitThread ( dec_thread_t * );
static
void
EndThread
(
dec_thread_t
*
);
static
void
EndThread
(
dec_thread_t
*
);
/*****************************************************************************
/*****************************************************************************
...
@@ -130,29 +146,11 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
...
@@ -130,29 +146,11 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
return
-
1
;
return
-
1
;
}
}
/* FIXME : I suppose the number of channel and sampling rate
* are somewhere in the headers */
p_dec
->
output_format
.
i_format
=
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'b'
);
p_dec
->
output_format
.
i_format
=
VLC_FOURCC
(
's'
,
'1'
,
'6'
,
'b'
);
p_dec
->
output_format
.
i_physical_channels
=
p_dec
->
output_format
.
i_original_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
;
p_dec
->
output_format
.
i_rate
=
48000
;
aout_DateInit
(
&
p_dec
->
end_date
,
48000
);
p_dec
->
p_aout
=
NULL
;
p_dec
->
p_aout
=
NULL
;
p_dec
->
p_aout_input
=
aout_DecNew
(
p_dec
->
p_fifo
,
p_dec
->
p_aout_input
=
NULL
;
&
p_dec
->
p_aout
,
&
p_dec
->
output_format
);
if
(
p_dec
->
p_aout_input
==
NULL
)
{
msg_Err
(
p_dec
->
p_fifo
,
"failed to create aout fifo"
);
p_dec
->
p_fifo
->
b_error
=
1
;
EndThread
(
p_dec
);
return
(
-
1
);
}
/*
lpcm
decoder thread's main loop */
/*
LPCM
decoder thread's main loop */
while
(
(
!
p_dec
->
p_fifo
->
b_die
)
&&
(
!
p_dec
->
p_fifo
->
b_error
)
)
while
(
(
!
p_dec
->
p_fifo
->
b_die
)
&&
(
!
p_dec
->
p_fifo
->
b_error
)
)
{
{
DecodeFrame
(
p_dec
);
DecodeFrame
(
p_dec
);
...
@@ -173,50 +171,136 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
...
@@ -173,50 +171,136 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
/*****************************************************************************
/*****************************************************************************
* DecodeFrame: decodes a frame.
* DecodeFrame: decodes a frame.
*****************************************************************************/
*****************************************************************************/
void
DecodeFrame
(
dec_thread_t
*
p_dec
)
static
void
DecodeFrame
(
dec_thread_t
*
p_dec
)
{
{
aout_buffer_t
*
p_aout_buffer
;
aout_buffer_t
*
p_buffer
;
mtime_t
i_pts
;
mtime_t
i_pts
;
uint8_t
i_header
;
unsigned
int
i_rate
,
i_original_channels
;
/* Look for sync word - should be 0xXX80 */
RealignBits
(
&
p_dec
->
bit_stream
);
while
(
(
ShowBits
(
&
p_dec
->
bit_stream
,
16
)
&
0xc8ff
)
!=
0x0080
&&
(
!
p_dec
->
p_fifo
->
b_die
)
&&
(
!
p_dec
->
p_fifo
->
b_error
)
)
{
RemoveBits
(
&
p_dec
->
bit_stream
,
8
);
}
if
(
p_dec
->
p_fifo
->
b_die
||
p_dec
->
p_fifo
->
b_error
)
return
;
NextPTS
(
&
p_dec
->
bit_stream
,
&
i_pts
,
NULL
);
NextPTS
(
&
p_dec
->
bit_stream
,
&
i_pts
,
NULL
);
if
(
i_pts
!=
0
&&
i_pts
!=
aout_DateGet
(
&
p_dec
->
end_date
)
)
if
(
i_pts
!=
0
&&
i_pts
!=
aout_DateGet
(
&
p_dec
->
end_date
)
)
{
{
aout_DateSet
(
&
p_dec
->
end_date
,
i_pts
);
aout_DateSet
(
&
p_dec
->
end_date
,
i_pts
);
}
}
p_aout_buffer
=
aout_DecNewBuffer
(
p_dec
->
p_aout
,
/* Get LPCM header. */
p_dec
->
p_aout_input
,
i_header
=
GetBits
(
&
p_dec
->
bit_stream
,
16
)
>>
8
;
LPCM_FRAME_NB
);
switch
(
i_header
>>
4
)
if
(
!
p_aout_buffer
)
{
{
msg_Err
(
p_dec
->
p_fifo
,
"cannot get aout buffer"
);
case
0
:
i_rate
=
48000
;
break
;
case
1
:
i_rate
=
32000
;
break
;
default:
msg_Err
(
p_dec
->
p_fifo
,
"unsupported LPCM rate (0x%x)"
,
i_header
);
p_dec
->
p_fifo
->
b_error
=
1
;
p_dec
->
p_fifo
->
b_error
=
1
;
return
;
return
;
}
}
p_aout_buffer
->
start_date
=
aout_DateGet
(
&
p_dec
->
end_date
);
p_aout_buffer
->
end_date
=
aout_DateIncrement
(
&
p_dec
->
end_date
,
LPCM_FRAME_NB
);
/* Look for sync word - should be 0x0180 */
switch
(
i_header
&
0x7
)
RealignBits
(
&
p_dec
->
bit_stream
);
{
while
(
(
GetBits
(
&
p_dec
->
bit_stream
,
16
)
)
!=
0x0180
&&
case
0
:
(
!
p_dec
->
p_fifo
->
b_die
)
&&
(
!
p_dec
->
p_fifo
->
b_error
));
i_original_channels
=
AOUT_CHAN_CENTER
;
break
;
case
1
:
i_original_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
;
break
;
case
3
:
i_original_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_REARLEFT
|
AOUT_CHAN_REARRIGHT
;
break
;
case
5
:
i_original_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
|
AOUT_CHAN_REARLEFT
|
AOUT_CHAN_REARRIGHT
|
AOUT_CHAN_CENTER
|
AOUT_CHAN_LFE
;
break
;
case
2
:
case
4
:
case
6
:
case
7
:
default:
msg_Err
(
p_dec
->
p_fifo
,
"unsupported LPCM channels (0x%x)"
,
i_header
);
p_dec
->
p_fifo
->
b_error
=
1
;
return
;
}
if
(
(
p_dec
->
p_aout_input
!=
NULL
)
&&
(
(
p_dec
->
output_format
.
i_rate
!=
i_rate
)
||
(
p_dec
->
output_format
.
i_original_channels
!=
i_original_channels
)
)
)
{
/* Parameters changed - this should not happen. */
aout_DecDelete
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
);
p_dec
->
p_aout_input
=
NULL
;
}
/* Creating the audio input if not created yet. */
if
(
p_dec
->
p_aout_input
==
NULL
)
{
p_dec
->
output_format
.
i_rate
=
i_rate
;
p_dec
->
output_format
.
i_original_channels
=
i_original_channels
;
p_dec
->
output_format
.
i_physical_channels
=
i_original_channels
&
AOUT_CHAN_PHYSMASK
;
aout_DateInit
(
&
p_dec
->
end_date
,
i_rate
);
p_dec
->
p_aout_input
=
aout_DecNew
(
p_dec
->
p_fifo
,
&
p_dec
->
p_aout
,
&
p_dec
->
output_format
);
if
(
p_dec
->
p_aout_input
==
NULL
)
{
p_dec
->
p_fifo
->
b_error
=
1
;
return
;
}
}
if
(
!
aout_DateGet
(
&
p_dec
->
end_date
)
)
{
byte_t
p_junk
[
LPCM_FRAME_LENGTH
];
GetChunk
(
&
p_dec
->
bit_stream
,
p_aout_buffer
->
p_buffer
,
/* We've just started the stream, wait for the first PTS. */
LPCM_FRAME_NB
*
4
);
GetChunk
(
&
p_dec
->
bit_stream
,
p_junk
,
LPCM_FRAME_LENGTH
);
return
;
}
p_buffer
=
aout_DecNewBuffer
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
LPCM_FRAME_LENGTH
/
p_dec
->
output_format
.
i_bytes_per_frame
);
if
(
p_buffer
==
NULL
)
{
msg_Err
(
p_dec
->
p_fifo
,
"cannot get aout buffer"
);
p_dec
->
p_fifo
->
b_error
=
1
;
return
;
}
p_buffer
->
start_date
=
aout_DateGet
(
&
p_dec
->
end_date
);
p_buffer
->
end_date
=
aout_DateIncrement
(
&
p_dec
->
end_date
,
LPCM_FRAME_LENGTH
/
p_dec
->
output_format
.
i_bytes_per_frame
);
/* Get the whole frame. */
GetChunk
(
&
p_dec
->
bit_stream
,
p_buffer
->
p_buffer
,
LPCM_FRAME_LENGTH
);
if
(
p_dec
->
p_fifo
->
b_die
)
if
(
p_dec
->
p_fifo
->
b_die
)
{
{
aout_DecDeleteBuffer
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
aout_DecDeleteBuffer
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
p_
aout_
buffer
);
p_buffer
);
return
;
return
;
}
}
aout_DecPlay
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
/* Send the buffer to the aout core. */
p_aout
_buffer
);
aout_DecPlay
(
p_dec
->
p_aout
,
p_dec
->
p_aout_input
,
p
_buffer
);
}
}
/*****************************************************************************
/*****************************************************************************
...
...
src/audio_output/dec.c
View file @
aba1225f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* dec.c : audio output API towards decoders
* dec.c : audio output API towards decoders
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* Copyright (C) 2002 VideoLAN
* $Id: dec.c,v 1.
4 2002/12/10 18:22:01 gbazin
Exp $
* $Id: dec.c,v 1.
5 2002/12/28 02:02:18 massiot
Exp $
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
*
...
@@ -69,9 +69,9 @@ static aout_input_t * DecNew( aout_instance_t * p_aout,
...
@@ -69,9 +69,9 @@ static aout_input_t * DecNew( aout_instance_t * p_aout,
p_input
->
b_changed
=
0
;
p_input
->
b_changed
=
0
;
p_input
->
b_error
=
1
;
p_input
->
b_error
=
1
;
aout_FormatPrepare
(
&
p_format
);
memcpy
(
&
p_input
->
input
,
p_format
,
memcpy
(
&
p_input
->
input
,
p_format
,
sizeof
(
audio_sample_format_t
)
);
sizeof
(
audio_sample_format_t
)
);
aout_FormatPrepare
(
&
p_input
->
input
);
p_aout
->
pp_inputs
[
p_aout
->
i_nb_inputs
]
=
p_input
;
p_aout
->
pp_inputs
[
p_aout
->
i_nb_inputs
]
=
p_input
;
p_aout
->
i_nb_inputs
++
;
p_aout
->
i_nb_inputs
++
;
...
...
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