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
764fd89e
Commit
764fd89e
authored
Aug 17, 2002
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all : mpeg_audio decoder works now with aout3.
parent
fd976a60
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
169 additions
and
161 deletions
+169
-161
configure
configure
+2
-2
configure.in
configure.in
+2
-2
modules/codec/mpeg_audio/decoder.c
modules/codec/mpeg_audio/decoder.c
+56
-52
modules/codec/mpeg_audio/decoder.h
modules/codec/mpeg_audio/decoder.h
+7
-4
modules/codec/mpeg_audio/generic.c
modules/codec/mpeg_audio/generic.c
+3
-2
modules/codec/mpeg_audio/layer1.c
modules/codec/mpeg_audio/layer1.c
+4
-4
modules/codec/mpeg_audio/layer1.h
modules/codec/mpeg_audio/layer1.h
+3
-3
modules/codec/mpeg_audio/layer2.c
modules/codec/mpeg_audio/layer2.c
+4
-4
modules/codec/mpeg_audio/layer2.h
modules/codec/mpeg_audio/layer2.h
+3
-3
modules/codec/mpeg_audio/math.c
modules/codec/mpeg_audio/math.c
+83
-83
modules/codec/mpeg_audio/math.h
modules/codec/mpeg_audio/math.h
+2
-2
No files found.
configure
View file @
764fd89e
...
...
@@ -5667,8 +5667,8 @@ BUILTINS="${BUILTINS}"
PLUGINS
=
"
${
PLUGINS
}
misc/dummy/dummy misc/null/null"
PLUGINS
=
"
${
PLUGINS
}
control/rc/rc misc/logger/logger access/file access/udp access/http access/rtp misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS
=
"
${
PLUGINS
}
demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS
=
"
${
PLUGINS
}
codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/
mpeg_audio/mpeg_audio codec/
a52old/a52old codec/lpcm/lpcm"
PLUGINS
=
"
${
PLUGINS
}
codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif
codec/mpeg_audio/mpeg_audio
"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS
=
"
${
PLUGINS
}
video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS
=
"
${
PLUGINS
}
audio_filter/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif"
PLUGINS
=
"
${
PLUGINS
}
audio_filter/resampler/trivial"
...
...
configure.in
View file @
764fd89e
...
...
@@ -441,8 +441,8 @@ BUILTINS="${BUILTINS}"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http access/rtp misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/
mpeg_audio/mpeg_audio codec/
a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif
codec/mpeg_audio/mpeg_audio
"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS="${PLUGINS} audio_filter/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif"
PLUGINS="${PLUGINS} audio_filter/resampler/trivial"
...
...
modules/codec/mpeg_audio/decoder.c
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: decoder.c,v 1.
1 2002/08/04 17:23:42 sam
Exp $
* $Id: decoder.c,v 1.
2 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
...
...
@@ -37,7 +37,7 @@
#include "generic.h"
#include "decoder.h"
#define ADEC_FRAME_SIZE
(2*1152)
#define ADEC_FRAME_SIZE
1152
/* XXX Frame size for only one channel */
/*****************************************************************************
* Local Prototypes
...
...
@@ -113,7 +113,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
/* We do not create the audio output fifo now, but
it will be created when the first frame is received */
p_adec
->
p_aout_fifo
=
NULL
;
p_adec
->
p_aout
=
NULL
;
p_adec
->
p_aout_input
=
NULL
;
p_adec
->
i_pts
=
0
;
p_adec
->
i_sync
=
0
;
...
...
@@ -144,69 +146,74 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
*****************************************************************************/
static
void
DecodeThread
(
adec_thread_t
*
p_adec
)
{
s16
*
p_buffer
;
a
dec_sync_info_t
sync_info
;
mtime_t
i_pts
;
a
out_buffer_t
*
p_aout_buffer
;
adec_sync_info_t
sync_info
;
if
(
!
adec_SyncFrame
(
p_adec
,
&
sync_info
)
)
{
/* TODO: check if audio type has changed */
/* Create the output fifo if it doesn't exist yet */
if
(
p_adec
->
p_aout_fifo
==
NULL
)
if
(
(
p_adec
->
p_aout_input
==
NULL
)
||
(
p_adec
->
output_format
.
i_channels
!=
(
sync_info
.
b_stereo
?
2
:
1
)
)
||
(
p_adec
->
output_format
.
i_rate
!=
sync_info
.
sample_rate
)
)
{
int
i_channels
;
if
(
!
config_GetInt
(
p_adec
->
p_fifo
,
"mono"
)
)
{
msg_Dbg
(
p_adec
->
p_fifo
,
"setting stereo output"
);
i_channels
=
2
;
}
else
if
(
sync_info
.
b_stereo
)
if
(
p_adec
->
p_aout_input
)
{
i_channels
=
2
;
}
else
{
i_channels
=
1
;
}
p_adec
->
p_aout_fifo
=
aout_CreateFifo
(
p_adec
->
p_fifo
,
AOUT_FIFO_PCM
,
i_channels
,
sync_info
.
sample_rate
,
ADEC_FRAME_SIZE
,
NULL
);
if
(
p_adec
->
p_aout_fifo
==
NULL
)
{
msg_Err
(
p_adec
->
p_fifo
,
"failed to create aout fifo"
);
p_adec
->
p_fifo
->
b_error
=
1
;
return
;
/* Delete old output */
msg_Warn
(
p_adec
->
p_fifo
,
"opening a new aout"
);
aout_InputDelete
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
);
}
/* Set output configuration */
p_adec
->
output_format
.
i_format
=
AOUT_FMT_FLOAT32
;
p_adec
->
output_format
.
i_channels
=
(
sync_info
.
b_stereo
?
2
:
1
);
p_adec
->
output_format
.
i_rate
=
sync_info
.
sample_rate
;
p_adec
->
p_aout_input
=
aout_InputNew
(
p_adec
->
p_fifo
,
&
p_adec
->
p_aout
,
&
p_adec
->
output_format
);
}
p_adec
->
i_sync
=
1
;
if
(
p_adec
->
p_aout_input
==
NULL
)
{
msg_Err
(
p_adec
->
p_fifo
,
"failed to create aout fifo"
);
p_adec
->
p_fifo
->
b_error
=
1
;
return
;
}
p_buffer
=
((
s16
*
)
p_adec
->
p_aout_fifo
->
buffer
)
+
(
p_adec
->
p_aout_fifo
->
i_end_frame
*
ADEC_FRAME_SIZE
);
p_aout_buffer
=
aout_BufferNew
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
,
ADEC_FRAME_SIZE
);
if
(
!
p_aout_buffer
)
{
msg_Err
(
p_adec
->
p_fifo
,
"cannot get aout buffer"
);
p_adec
->
p_fifo
->
b_error
=
1
;
return
;
}
CurrentPTS
(
&
p_adec
->
bit_stream
,
&
p_adec
->
p_aout_fifo
->
date
[
p_adec
->
p_aout_fifo
->
i_end_frame
],
NULL
);
if
(
!
p_adec
->
p_aout_fifo
->
date
[
p_adec
->
p_aout_fifo
->
i_end_frame
]
)
p_adec
->
i_sync
=
1
;
CurrentPTS
(
&
p_adec
->
bit_stream
,
&
i_pts
,
NULL
);
if
(
i_pts
>
0
)
{
p_adec
->
p_aout_fifo
->
date
[
p_adec
->
p_aout_fifo
->
i_end_frame
]
=
LAST_MDATE
;
p_adec
->
i_pts
=
i_pts
;
}
p_aout_buffer
->
start_date
=
p_adec
->
i_pts
;
p_adec
->
i_pts
+=
(
mtime_t
)
1000000
*
(
mtime_t
)
ADEC_FRAME_SIZE
/
(
mtime_t
)
p_adec
->
output_format
.
i_rate
;
p_aout_buffer
->
end_date
=
p_adec
->
i_pts
;
if
(
adec_DecodeFrame
(
p_adec
,
p_buffer
)
)
if
(
adec_DecodeFrame
(
p_adec
,
(
float
*
)
p_aout_buffer
->
p_buffer
)
)
{
/* Ouch, failed decoding... We'll have to resync */
p_adec
->
i_sync
=
0
;
aout_BufferDelete
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
,
p_aout_buffer
);
}
else
{
vlc_mutex_lock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
p_adec
->
p_aout_fifo
->
i_end_frame
=
(
p_adec
->
p_aout_fifo
->
i_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_adec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
aout_BufferPlay
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
,
p_aout_buffer
);
}
}
}
...
...
@@ -220,15 +227,12 @@ static void DecodeThread( adec_thread_t * p_adec )
static
void
EndThread
(
adec_thread_t
*
p_adec
)
{
/* If the audio output fifo was created, we destroy it */
if
(
p_adec
->
p_aout_fifo
!=
NULL
)
if
(
p_adec
->
p_aout_input
)
{
aout_DestroyFifo
(
p_adec
->
p_aout_fifo
);
/* Make sure the output thread leaves the NextFrame() function */
vlc_mutex_lock
(
&
(
p_adec
->
p_aout_fifo
->
data_lock
));
vlc_cond_signal
(
&
(
p_adec
->
p_aout_fifo
->
data_wait
));
vlc_mutex_unlock
(
&
(
p_adec
->
p_aout_fifo
->
data_lock
));
aout_InputDelete
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
);
}
/* Destroy descriptor */
free
(
p_adec
);
}
...
...
modules/codec/mpeg_audio/decoder.h
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* mpeg_adec.h : audio decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: decoder.h,v 1.
1 2002/08/04 17:23:42 sam
Exp $
* $Id: decoder.h,v 1.
2 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
...
...
@@ -49,8 +49,11 @@ typedef struct adec_thread_s
/*
* Output properties
*/
aout_fifo_t
*
p_aout_fifo
;
/* stores the decompressed frames */
aout_instance_t
*
p_aout
;
/* opaque */
aout_input_t
*
p_aout_input
;
/* opaque */
audio_sample_format_t
output_format
;
mtime_t
i_pts
;
}
adec_thread_t
;
/*****************************************************************************
...
...
@@ -61,5 +64,5 @@ typedef struct adec_thread_s
* From adec_generic.c
*/
int
adec_SyncFrame
(
adec_thread_t
*
,
adec_sync_info_t
*
);
int
adec_DecodeFrame
(
adec_thread_t
*
,
s16
*
);
int
adec_DecodeFrame
(
adec_thread_t
*
,
float
*
);
modules/codec/mpeg_audio/generic.c
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* generic.c: MPEG audio decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: generic.c,v 1.
1 2002/08/04 17:23:42 sam
Exp $
* $Id: generic.c,v 1.
2 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
...
...
@@ -26,6 +26,7 @@
#include <string.h>
/* memcpy(), memset() */
#include <vlc/vlc.h>
#include <vlc/aout.h>
#include <vlc/decoder.h>
#include "generic.h"
...
...
@@ -182,7 +183,7 @@ int adec_SyncFrame( adec_thread_t * p_adec, adec_sync_info_t * p_sync_info )
return
0
;
}
int
adec_DecodeFrame
(
adec_thread_t
*
p_adec
,
s16
*
buffer
)
int
adec_DecodeFrame
(
adec_thread_t
*
p_adec
,
float
*
buffer
)
{
int
i_total_bytes_read
;
...
...
modules/codec/mpeg_audio/layer1.c
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* layer1.c: MPEG Layer I audio decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: layer1.c,v 1.
2 2002/08/08 00:35:11 sam
Exp $
* $Id: layer1.c,v 1.
3 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
...
...
@@ -27,7 +27,7 @@
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include <vlc/aout.h>
#include "generic.h"
#include "decoder.h"
#include "math.h"
/* DCT32(), PCM() */
...
...
@@ -85,7 +85,7 @@ static u8 adec_layer1_allocation_table[15] =
static
int
adec_bound_table
[
4
]
=
{
4
,
8
,
12
,
16
};
int
adec_layer1_mono
(
adec_thread_t
*
p_adec
,
s16
*
buffer
)
int
adec_layer1_mono
(
adec_thread_t
*
p_adec
,
float
*
buffer
)
{
u8
allocation
[
32
];
float
slope
[
32
];
...
...
@@ -178,7 +178,7 @@ int adec_layer1_mono( adec_thread_t * p_adec, s16 * buffer )
return
0
;
}
int
adec_layer1_stereo
(
adec_thread_t
*
p_adec
,
s16
*
buffer
)
int
adec_layer1_stereo
(
adec_thread_t
*
p_adec
,
float
*
buffer
)
{
u8
allocation_0
[
32
],
allocation_1
[
32
];
float
slope_0
[
32
],
slope_1
[
32
];
...
...
modules/codec/mpeg_audio/layer1.h
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* adec_layer1.h: MPEG Layer I audio decoder
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: layer1.h,v 1.
1 2002/08/04 17:23:42 sam
Exp $
* $Id: layer1.h,v 1.
2 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
...
...
@@ -21,6 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
int
adec_layer1_mono
(
adec_thread_t
*
p_adec
,
s16
*
buffer
);
int
adec_layer1_stereo
(
adec_thread_t
*
p_adec
,
s16
*
buffer
);
int
adec_layer1_mono
(
adec_thread_t
*
p_adec
,
float
*
buffer
);
int
adec_layer1_stereo
(
adec_thread_t
*
p_adec
,
float
*
buffer
);
modules/codec/mpeg_audio/layer2.c
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* layer2.c: MPEG Layer II audio decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: layer2.c,v 1.
2 2002/08/08 00:35:11 sam
Exp $
* $Id: layer2.c,v 1.
3 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
...
...
@@ -27,7 +27,7 @@
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include <vlc/aout.h>
#include "generic.h"
#include "decoder.h"
#include "math.h"
/* DCT32(), PCM() */
...
...
@@ -184,7 +184,7 @@ static void adec_layer2_get_table( u32 header, u8 freq_table[15],
*
sblimit
=
sblimit_table
[
index
];
}
int
adec_layer2_mono
(
adec_thread_t
*
p_adec
,
s16
*
buffer
)
int
adec_layer2_mono
(
adec_thread_t
*
p_adec
,
float
*
buffer
)
{
static
u8
freq_table
[
15
]
=
{
2
,
1
,
1
,
2
,
2
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
2
,
2
,
2
};
static
float
L3_table
[
3
]
=
{
-
2
/
3
.
0
,
0
,
2
/
3
.
0
};
...
...
@@ -450,7 +450,7 @@ int adec_layer2_mono( adec_thread_t * p_adec, s16 * buffer )
return
0
;
}
int
adec_layer2_stereo
(
adec_thread_t
*
p_adec
,
s16
*
buffer
)
int
adec_layer2_stereo
(
adec_thread_t
*
p_adec
,
float
*
buffer
)
{
static
u8
freq_table
[
15
]
=
{
3
,
0
,
0
,
0
,
1
,
0
,
1
,
2
,
2
,
2
,
3
,
3
,
3
,
3
,
3
};
static
float
L3_table
[
3
]
=
{
-
2
/
3
.
0
,
0
,
2
/
3
.
0
};
...
...
modules/codec/mpeg_audio/layer2.h
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* adec_layer2.h: MPEG Layer II audio decoder
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: layer2.h,v 1.
1 2002/08/04 17:23:42 sam
Exp $
* $Id: layer2.h,v 1.
2 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
...
...
@@ -21,6 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
int
adec_layer2_mono
(
adec_thread_t
*
p_adec
,
s16
*
buffer
);
int
adec_layer2_stereo
(
adec_thread_t
*
p_adec
,
s16
*
buffer
);
int
adec_layer2_mono
(
adec_thread_t
*
p_adec
,
float
*
buffer
);
int
adec_layer2_stereo
(
adec_thread_t
*
p_adec
,
float
*
buffer
);
modules/codec/mpeg_audio/math.c
View file @
764fd89e
This diff is collapsed.
Click to expand it.
modules/codec/mpeg_audio/math.h
View file @
764fd89e
...
...
@@ -2,7 +2,7 @@
* adec_math.h : PCM and DCT
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: math.h,v 1.
1 2002/08/04 17:23:42 sam
Exp $
* $Id: math.h,v 1.
2 2002/08/17 15:35:10 fenrir
Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
...
...
@@ -25,5 +25,5 @@
* Prototypes
*****************************************************************************/
void
DCT32
(
adec_bank_t
*
,
float
*
);
void
PCM
(
adec_bank_t
*
,
s16
*
,
int
);
void
PCM
(
adec_bank_t
*
,
float
*
,
int
);
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