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
a3c92b8f
Commit
a3c92b8f
authored
Jun 12, 2001
by
Henri Fallon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added LPCM support. It should work with stereo LPCM. Untested with 5-ways LPCM streams.
parent
b947d063
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
237 deletions
+96
-237
Makefile
Makefile
+0
-1
TODO
TODO
+2
-2
src/lpcm_decoder/lpcm_decoder.c
src/lpcm_decoder/lpcm_decoder.c
+0
-73
src/lpcm_decoder/lpcm_decoder.h
src/lpcm_decoder/lpcm_decoder.h
+0
-68
src/lpcm_decoder/lpcm_decoder_thread.c
src/lpcm_decoder/lpcm_decoder_thread.c
+88
-86
src/lpcm_decoder/lpcm_decoder_thread.h
src/lpcm_decoder/lpcm_decoder_thread.h
+6
-7
No files found.
Makefile
View file @
a3c92b8f
...
@@ -77,7 +77,6 @@ AC3_SPDIF := src/ac3_spdif/ac3_spdif.o \
...
@@ -77,7 +77,6 @@ AC3_SPDIF := src/ac3_spdif/ac3_spdif.o \
src/ac3_spdif/ac3_iec958.o
src/ac3_spdif/ac3_iec958.o
LPCM_DECODER
:=
src/lpcm_decoder/lpcm_decoder_thread.o
\
LPCM_DECODER
:=
src/lpcm_decoder/lpcm_decoder_thread.o
\
src/lpcm_decoder/lpcm_decoder.o
AUDIO_DECODER
:=
src/audio_decoder/audio_decoder.o
\
AUDIO_DECODER
:=
src/audio_decoder/audio_decoder.o
\
src/audio_decoder/adec_generic.o
\
src/audio_decoder/adec_generic.o
\
...
...
TODO
View file @
a3c92b8f
...
@@ -56,7 +56,7 @@ Description: Cope with vls/vlc clock jitter
...
@@ -56,7 +56,7 @@ Description: Cope with vls/vlc clock jitter
The internal clocks of the server and the client are not assured to be
The internal clocks of the server and the client are not assured to be
in perfect synchronization, which may be annoying when playing a movie.
in perfect synchronization, which may be annoying when playing a movie.
Reduce this jitter by using a well-chosen filter.
Reduce this jitter by using a well-chosen filter.
Status:
Todo
Status:
Done 1 May 2001 (henri)
Task: 0x58
Task: 0x58
Difficulty: Medium
Difficulty: Medium
...
@@ -541,7 +541,7 @@ Urgency: Normal
...
@@ -541,7 +541,7 @@ Urgency: Normal
Description: LPCM decoder
Description: LPCM decoder
The LPCM decoder is full of stubs, it only parses the stream
The LPCM decoder is full of stubs, it only parses the stream
but does not decode it. Fix this.
but does not decode it. Fix this.
Status:
Todo
Status:
Done 12 Jun 2001 (henri)
Task: 0x1c
Task: 0x1c
Difficulty: Guru
Difficulty: Guru
...
...
src/lpcm_decoder/lpcm_decoder.c
deleted
100644 → 0
View file @
b947d063
/*****************************************************************************
* lpcm_decoder.c: core lpcm decoder
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder.c,v 1.7 2001/04/06 09:15:48 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "defs.h"
#include <stdio.h>
#include <string.h>
/* memcpy(), memset() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "intf_msg.h"
//#include "int_types.h"
#include "lpcm_decoder.h"
int
lpcm_init
(
lpcmdec_t
*
p_lpcmdec
)
{
intf_DbgMsg
(
"LPCM Debug: lpmcm init called"
);
return
0
;
}
int
lpcm_decode_frame
(
lpcmdec_t
*
p_lpcmdec
,
s16
*
buffer
)
{
/*
* XXX was part of ac3dec, is to change
int i;
if (parse_bsi (p_ac3dec))
return 1;
for (i = 0; i < 6; i++) {
if (parse_audblk (p_ac3dec, i))
return 1;
if (exponent_unpack (p_ac3dec))
return 1;
bit_allocate (p_ac3dec);
mantissa_unpack (p_ac3dec);
if (p_ac3dec->bsi.acmod == 0x2)
rematrix (p_ac3dec);
imdct (p_ac3dec);
downmix (p_ac3dec, buffer);
buffer += 2*256;
}
parse_auxdata (p_ac3dec);
*/
return
0
;
}
src/lpcm_decoder/lpcm_decoder.h
deleted
100644 → 0
View file @
b947d063
/*****************************************************************************
* lpcm_decoder.h : lpcm decoder interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder.h,v 1.3 2001/03/21 13:42:34 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*****************************************************************************/
typedef
struct
lpcmdec_s
lpcmdec_t
;
typedef
struct
lpcm_sync_info_s
{
int
sample_rate
;
/* sample rate in Hz */
int
frame_size
;
/* frame size in bytes */
int
bit_rate
;
/* nominal bit rate in kbps */
}
lpcm_sync_info_t
;
typedef
struct
lpcm_byte_stream_s
{
u8
*
p_byte
;
u8
*
p_end
;
void
*
info
;
}
lpcm_byte_stream_t
;
int
lpcm_init
(
lpcmdec_t
*
p_lpcmdec
);
int
lpcm_sync_frame
(
lpcmdec_t
*
p_lpcmdec
,
lpcm_sync_info_t
*
p_sync_info
);
int
lpcm_decode_frame
(
lpcmdec_t
*
p_lcpmdec
,
s16
*
buffer
);
//static lpcm_byte_stream_t * lpcm_byte_stream (lcpmdec_t * p_lpcmdec);
void
lpcm_byte_stream_next
(
lpcm_byte_stream_t
*
p_byte_stream
);
typedef
struct
lpcm_bit_stream_s
{
u32
buffer
;
int
i_available
;
lpcm_byte_stream_t
byte_stream
;
}
lpcm_bit_stream_t
;
struct
lpcmdec_s
{
/*
* Input properties
*/
/* The bit stream structure handles the PES stream at the bit level */
lpcm_bit_stream_t
bit_stream
;
};
static
lpcm_byte_stream_t
*
lpcm_byte_stream
(
lpcmdec_t
*
p_lpcmdec
)
{
return
&
(
p_lpcmdec
->
bit_stream
.
byte_stream
);
}
src/lpcm_decoder/lpcm_decoder_thread.c
View file @
a3c92b8f
...
@@ -2,9 +2,10 @@
...
@@ -2,9 +2,10 @@
* lpcm_decoder_thread.c: lpcm decoder thread
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder_thread.c,v 1.1
5 2001/05/31 01:37:08 sam
Exp $
* $Id: lpcm_decoder_thread.c,v 1.1
6 2001/06/12 13:50:09 henri
Exp $
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
*
*
* 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
...
@@ -46,11 +47,8 @@
...
@@ -46,11 +47,8 @@
#include "audio_output.h"
#include "audio_output.h"
#include "lpcm_decoder.h"
#include "lpcm_decoder_thread.h"
#include "lpcm_decoder_thread.h"
#define LPCMDEC_FRAME_SIZE (2*1536)
/* May be useless */
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
...
@@ -62,14 +60,16 @@ static void EndThread (lpcmdec_thread_t * p_adec);
...
@@ -62,14 +60,16 @@ static void EndThread (lpcmdec_thread_t * p_adec);
/*****************************************************************************
/*****************************************************************************
* lpcmdec_CreateThread: creates an lpcm decoder thread
* lpcmdec_CreateThread: creates an lpcm decoder thread
*****************************************************************************/
*****************************************************************************/
vlc_thread_t
lpcmdec_CreateThread
(
adec_config_t
*
p_config
)
vlc_thread_t
lpcmdec_CreateThread
(
adec_config_t
*
p_config
)
{
{
lpcmdec_thread_t
*
p_lpcmdec
;
lpcmdec_thread_t
*
p_lpcmdec
;
intf_DbgMsg
(
"lpcm
: creating lpcm decoder thread"
);
intf_DbgMsg
(
"LPCM
: creating lpcm decoder thread"
);
/* Allocate the memory needed to store the thread's structure */
/* Allocate the memory needed to store the thread's structure */
if
((
p_lpcmdec
=
(
lpcmdec_thread_t
*
)
malloc
(
sizeof
(
lpcmdec_thread_t
)))
==
NULL
)
{
if
(
(
p_lpcmdec
=
(
lpcmdec_thread_t
*
)
malloc
(
sizeof
(
lpcmdec_thread_t
))
)
intf_ErrMsg
(
"lpcm error: cannot create lpcmdec_thread_t"
);
==
NULL
)
{
intf_ErrMsg
(
"LPCM : error : cannot create lpcmdec_thread_t"
);
return
0
;
return
0
;
}
}
...
@@ -79,23 +79,21 @@ vlc_thread_t lpcmdec_CreateThread (adec_config_t * p_config)
...
@@ -79,23 +79,21 @@ vlc_thread_t lpcmdec_CreateThread (adec_config_t * p_config)
p_lpcmdec
->
p_config
=
p_config
;
p_lpcmdec
->
p_config
=
p_config
;
p_lpcmdec
->
p_fifo
=
p_config
->
decoder_config
.
p_decoder_fifo
;
p_lpcmdec
->
p_fifo
=
p_config
->
decoder_config
.
p_decoder_fifo
;
/* Initialize the lpcm decoder structures */
lpcm_init
(
&
p_lpcmdec
->
lpcm_decoder
);
/*
/*
* Initialize the output properties
* Initialize the output properties
*/
*/
p_lpcmdec
->
p_aout_fifo
=
NULL
;
p_lpcmdec
->
p_aout_fifo
=
NULL
;
/* Spawn the lpcm decoder thread */
/* Spawn the lpcm decoder thread */
if
(
vlc_thread_create
(
&
p_lpcmdec
->
thread_id
,
"lpcm decoder"
,
(
vlc_thread_func_t
)
RunThread
,
(
void
*
)
p_lpcmdec
))
{
if
(
vlc_thread_create
(
&
p_lpcmdec
->
thread_id
,
"lpcm decoder"
,
intf_ErrMsg
(
"lpcm error: cannot spawn thread"
);
(
vlc_thread_func_t
)
RunThread
,
(
void
*
)
p_lpcmdec
)
)
{
intf_ErrMsg
(
"LPCM : error : cannot spawn thread"
);
free
(
p_lpcmdec
);
free
(
p_lpcmdec
);
return
0
;
return
0
;
}
}
intf_DbgMsg
(
"LPCM Debug: lpcm decoder thread (%p) created
"
,
p_lpcmdec
);
intf_DbgMsg
(
"LPCM Debug: lpcm decoder thread (%p) created
\n
"
,
p_lpcmdec
);
return
p_lpcmdec
->
thread_id
;
return
p_lpcmdec
->
thread_id
;
}
}
...
@@ -106,37 +104,44 @@ vlc_thread_t lpcmdec_CreateThread (adec_config_t * p_config)
...
@@ -106,37 +104,44 @@ vlc_thread_t lpcmdec_CreateThread (adec_config_t * p_config)
*****************************************************************************/
*****************************************************************************/
static
int
InitThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
static
int
InitThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
{
{
lpcm_byte_stream_t
*
byte_stream
;
intf_DbgMsg
(
"LPCM Debug: initializing lpcm decoder thread %p"
,
p_lpcmdec
);
intf_DbgMsg
(
"lpcm Debug: initializing lpcm decoder thread %p"
,
p_lpcmdec
);
/* Our first job is to initialize the bit stream structure with the
/* Our first job is to initialize the bit stream structure with the
* beginning of the input stream */
* beginning of the input stream */
vlc_mutex_lock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
while
(
DECODER_FIFO_ISEMPTY
(
*
p_lpcmdec
->
p_fifo
))
{
if
(
p_lpcmdec
->
p_fifo
->
b_die
)
{
while
(
DECODER_FIFO_ISEMPTY
(
*
p_lpcmdec
->
p_fifo
))
{
if
(
p_lpcmdec
->
p_fifo
->
b_die
)
{
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
return
-
1
;
return
-
1
;
}
}
vlc_cond_wait
(
&
p_lpcmdec
->
p_fifo
->
data_wait
,
&
p_lpcmdec
->
p_fifo
->
data_lock
);
vlc_cond_wait
(
&
p_lpcmdec
->
p_fifo
->
data_wait
,
&
p_lpcmdec
->
p_fifo
->
data_lock
);
}
}
p_lpcmdec
->
p_data
=
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
p_first
;
p_lpcmdec
->
p_data
=
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
p_first
;
byte_stream
=
lpcm_byte_stream
(
&
p_lpcmdec
->
lpcm_decoder
);
byte_stream
->
p_byte
=
p_lpcmdec
->
p_data
->
p_payload_start
;
byte_stream
->
p_end
=
p_lpcmdec
->
p_data
->
p_payload_end
;
byte_stream
->
info
=
p_lpcmdec
;
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
/* Init the BitStream */
p_lpcmdec
->
p_config
->
decoder_config
.
pf_init_bit_stream
(
&
p_lpcmdec
->
bit_stream
,
p_lpcmdec
->
p_config
->
decoder_config
.
p_decoder_fifo
,
NULL
,
NULL
);
/* Creating the audio output fifo */
/* Creating the audio output fifo */
p_lpcmdec
->
p_aout_fifo
=
aout_CreateFifo
(
AOUT_ADEC_STEREO_FIFO
,
2
,
0
,
0
,
p_lpcmdec
->
p_aout_fifo
=
aout_CreateFifo
(
AOUT_ADEC_STEREO_FIFO
,
2
,
4800
0
,
LPCMDEC_FRAME_SIZE
,
NULL
);
0
,
LPCMDEC_FRAME_SIZE
/
2
,
NULL
);
if
(
p_lpcmdec
->
p_aout_fifo
==
NULL
)
if
(
p_lpcmdec
->
p_aout_fifo
==
NULL
)
{
{
return
-
1
;
return
-
1
;
}
}
intf_DbgMsg
(
"LPCM Debug: lpcm decoder thread %p initialized
\n
"
,
intf_DbgMsg
(
"LPCM Debug: lpcm decoder thread %p initialized"
,
p_lpcmdec
);
p_lpcmdec
);
return
0
;
return
(
0
)
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -144,12 +149,8 @@ static int InitThread (lpcmdec_thread_t * p_lpcmdec)
...
@@ -144,12 +149,8 @@ static int InitThread (lpcmdec_thread_t * p_lpcmdec)
*****************************************************************************/
*****************************************************************************/
static
void
RunThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
static
void
RunThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
{
{
int
sync
;
intf_DbgMsg
(
"LPCM Debug: running lpcm decoder thread (%p) (pid== %i)"
,
p_lpcmdec
,
getpid
()
);
intf_DbgMsg
(
"LPCM Debug: running lpcm decoder thread (%p) (pid== %i)"
,
p_lpcmdec
,
getpid
()
);
/* Fucking holy piece of shit ! */
//msleep (INPUT_PTS_DELAY);
/* Initializing the lpcm decoder thread */
/* Initializing the lpcm decoder thread */
if
(
InitThread
(
p_lpcmdec
))
if
(
InitThread
(
p_lpcmdec
))
...
@@ -157,51 +158,56 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec)
...
@@ -157,51 +158,56 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec)
p_lpcmdec
->
p_fifo
->
b_error
=
1
;
p_lpcmdec
->
p_fifo
->
b_error
=
1
;
}
}
sync
=
0
;
p_lpcmdec
->
sync_ptr
=
0
;
/* lpcm decoder thread's main loop */
/* lpcm decoder thread's main loop */
/* FIXME : do we have enough room to store the decoded frames ?? */
while
((
!
p_lpcmdec
->
p_fifo
->
b_die
)
&&
(
!
p_lpcmdec
->
p_fifo
->
b_error
))
while
((
!
p_lpcmdec
->
p_fifo
->
b_die
)
&&
(
!
p_lpcmdec
->
p_fifo
->
b_error
))
{
{
s16
*
buffer
;
byte_t
*
buffer
,
p_temp
[
LPCMDEC_FRAME_SIZE
];
lpcm_sync_info_t
sync_info
;
int
i_loop
;
byte_t
byte1
,
byte2
;
if
(
!
sync
)
{
/* have to find a synchro point */
}
if
(
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
i_pts
)
if
(
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
i_pts
)
{
{
p_lpcmdec
->
p_aout_fifo
->
date
[
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
]
=
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
i_pts
;
p_lpcmdec
->
p_aout_fifo
->
date
[
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
]
=
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
i_pts
;
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
i_pts
=
0
;
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
)
->
i_pts
=
0
;
}
}
else
else
{
{
p_lpcmdec
->
p_aout_fifo
->
date
[
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_lpcmdec
->
p_aout_fifo
->
date
[
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
}
}
p_lpcmdec
->
p_aout_fifo
->
l_rate
=
sync_info
.
sample_rate
;
buffer
=
((
byte_t
*
)
p_lpcmdec
->
p_aout_fifo
->
buffer
)
+
(
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
*
LPCMDEC_FRAME_SIZE
);
byte1
=
GetBits
(
&
p_lpcmdec
->
bit_stream
,
8
);
byte2
=
GetBits
(
&
p_lpcmdec
->
bit_stream
,
8
);
/* Get the sync word : 0x0180 */
while
(
(
byte1
!=
0x01
||
byte2
!=
0x80
)
&&
(
!
p_lpcmdec
->
p_fifo
->
b_die
)
&&
(
!
p_lpcmdec
->
p_fifo
->
b_error
)
)
{
byte1
=
byte2
;
byte2
=
GetBits
(
&
p_lpcmdec
->
bit_stream
,
8
);
}
buffer
=
((
s16
*
)
p_lpcmdec
->
p_aout_fifo
->
buffer
)
+
(
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
*
LPCMDEC_FRAME_SIZE
);
GetChunk
(
&
p_lpcmdec
->
bit_stream
,
p_temp
,
LPCMDEC_FRAME_SIZE
);
if
(
lpcm_decode_frame
(
&
p_lpcmdec
->
lpcm_decoder
,
buffer
)
)
for
(
i_loop
=
0
;
i_loop
<
LPCMDEC_FRAME_SIZE
/
2
;
i_loop
++
)
{
{
sync
=
0
;
buffer
[
2
*
i_loop
]
=
p_temp
[
2
*
i_loop
+
1
]
;
goto
bad_frame
;
buffer
[
2
*
i_loop
+
1
]
=
p_temp
[
2
*
i_loop
]
;
}
}
vlc_mutex_lock
(
&
p_lpcmdec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_lpcmdec
->
p_aout_fifo
->
data_lock
);
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
=
(
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
=
(
p_lpcmdec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_lpcmdec
->
p_aout_fifo
->
data_wait
);
vlc_cond_signal
(
&
p_lpcmdec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_aout_fifo
->
data_lock
);
intf_DbgMsg
(
"LPCM Debug: %x"
,
*
buffer
);
intf_DbgMsg
(
"LPCM Debug: %x"
,
*
buffer
);
bad_frame:
continue
;
}
}
/* If b_error is set, the lpcm decoder thread enters the error loop */
/* If b_error is set, the lpcm decoder thread enters the error loop */
...
@@ -217,56 +223,52 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec)
...
@@ -217,56 +223,52 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec)
/*****************************************************************************
/*****************************************************************************
* ErrorThread : lpcm decoder's RunThread() error loop
* ErrorThread : lpcm decoder's RunThread() error loop
*****************************************************************************/
*****************************************************************************/
static
void
ErrorThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
static
void
ErrorThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
{
{
/* We take the lock, because we are going to read/write the start/end
/* We take the lock, because we are going to read/write the start/end
* indexes of the decoder fifo */
* indexes of the decoder fifo */
vlc_mutex_lock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
/* Wait until a `die' order is sent */
/* Wait until a `die' order is sent */
while
(
!
p_lpcmdec
->
p_fifo
->
b_die
)
{
while
(
!
p_lpcmdec
->
p_fifo
->
b_die
)
{
/* Trash all received PES packets */
/* Trash all received PES packets */
while
(
!
DECODER_FIFO_ISEMPTY
(
*
p_lpcmdec
->
p_fifo
))
{
while
(
!
DECODER_FIFO_ISEMPTY
(
*
p_lpcmdec
->
p_fifo
)
)
p_lpcmdec
->
p_fifo
->
pf_delete_pes
(
p_lpcmdec
->
p_fifo
->
p_packets_mgt
,
{
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
));
p_lpcmdec
->
p_fifo
->
pf_delete_pes
(
p_lpcmdec
->
p_fifo
->
p_packets_mgt
,
DECODER_FIFO_INCSTART
(
*
p_lpcmdec
->
p_fifo
);
DECODER_FIFO_START
(
*
p_lpcmdec
->
p_fifo
));
DECODER_FIFO_INCSTART
(
*
p_lpcmdec
->
p_fifo
);
}
}
/* Waiting for the input thread to put new PES packets in the fifo */
/* Waiting for the input thread to put new PES packets in the fifo */
vlc_cond_wait
(
&
p_lpcmdec
->
p_fifo
->
data_wait
,
&
p_lpcmdec
->
p_fifo
->
data_lock
);
vlc_cond_wait
(
&
p_lpcmdec
->
p_fifo
->
data_wait
,
&
p_lpcmdec
->
p_fifo
->
data_lock
);
}
}
/* We can release the lock before leaving */
/* We can release the lock before leaving */
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_lpcmdec
->
p_fifo
->
data_lock
);
}
}
/*****************************************************************************
/*****************************************************************************
* EndThread : lpcm decoder thread destruction
* EndThread : lpcm decoder thread destruction
*****************************************************************************/
*****************************************************************************/
static
void
EndThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
static
void
EndThread
(
lpcmdec_thread_t
*
p_lpcmdec
)
{
{
intf_DbgMsg
(
"LPCM Debug: destroying lpcm decoder thread %p"
,
p_lpcmdec
);
intf_DbgMsg
(
"LPCM Debug: destroying lpcm decoder thread %p"
,
p_lpcmdec
);
/* If the audio output fifo was created, we destroy it */
/* If the audio output fifo was created, we destroy it */
if
(
p_lpcmdec
->
p_aout_fifo
!=
NULL
)
{
if
(
p_lpcmdec
->
p_aout_fifo
!=
NULL
)
aout_DestroyFifo
(
p_lpcmdec
->
p_aout_fifo
);
{
aout_DestroyFifo
(
p_lpcmdec
->
p_aout_fifo
);
/* Make sure the output thread leaves the NextFrame() function */
/* Make sure the output thread leaves the NextFrame() function */
vlc_mutex_lock
(
&
(
p_lpcmdec
->
p_aout_fifo
->
data_lock
)
);
vlc_mutex_lock
(
&
(
p_lpcmdec
->
p_aout_fifo
->
data_lock
)
);
vlc_cond_signal
(
&
(
p_lpcmdec
->
p_aout_fifo
->
data_wait
)
);
vlc_cond_signal
(
&
(
p_lpcmdec
->
p_aout_fifo
->
data_wait
)
);
vlc_mutex_unlock
(
&
(
p_lpcmdec
->
p_aout_fifo
->
data_lock
)
);
vlc_mutex_unlock
(
&
(
p_lpcmdec
->
p_aout_fifo
->
data_lock
)
);
}
}
/* Destroy descriptor */
/* Destroy descriptor */
free
(
p_lpcmdec
);
free
(
p_lpcmdec
);
intf_DbgMsg
(
"LPCM Debug: lpcm decoder thread %p destroyed"
,
p_lpcmdec
);
intf_DbgMsg
(
"LPCM Debug: lpcm decoder thread %p destroyed"
,
p_lpcmdec
);
}
}
void
lpcm_byte_stream_next
(
lpcm_byte_stream_t
*
p_byte_stream
)
{
// lpcmdec_thread_t * p_lpcmdec = p_byte_stream->info;
/* We are looking for the next TS packet that contains real data,
* and not just a PES header */
}
src/lpcm_decoder/lpcm_decoder_thread.h
View file @
a3c92b8f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* lpcm_decoder_thread.h : lpcm decoder thread interface
* lpcm_decoder_thread.h : lpcm decoder thread interface
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder_thread.h,v 1.
5 2001/05/01 04:18:18 sam
Exp $
* $Id: lpcm_decoder_thread.h,v 1.
6 2001/06/12 13:50:09 henri
Exp $
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Authors: Samuel Hocevar <sam@zoy.org>
*
*
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
* Boston, MA 02111-1307, USA.
* Boston, MA 02111-1307, USA.
*****************************************************************************/
*****************************************************************************/
#define LPCMDEC_FRAME_SIZE (2008)
/*****************************************************************************
/*****************************************************************************
* lpcmdec_thread_t : lpcm decoder thread descriptor
* lpcmdec_thread_t : lpcm decoder thread descriptor
*****************************************************************************/
*****************************************************************************/
...
@@ -40,20 +42,17 @@ typedef struct lpcmdec_thread_s
...
@@ -40,20 +42,17 @@ typedef struct lpcmdec_thread_s
int
sync_ptr
;
/* sync ptr from lpcm magic header */
int
sync_ptr
;
/* sync ptr from lpcm magic header */
adec_config_t
*
p_config
;
adec_config_t
*
p_config
;
/*
* Decoder properties
*/
lpcmdec_t
lpcm_decoder
;
/*
/*
* Output properties
* Output properties
*/
*/
aout_fifo_t
*
p_aout_fifo
;
/* stores the decompressed audio frames */
aout_fifo_t
*
p_aout_fifo
;
/* stores the decompressed audio frames */
/* The bit stream structure handles the PES stream at the bit level */
bit_stream_t
bit_stream
;
}
lpcmdec_thread_t
;
}
lpcmdec_thread_t
;
/*****************************************************************************
/*****************************************************************************
* Prototypes
* Prototypes
*****************************************************************************/
*****************************************************************************/
vlc_thread_t
lpcmdec_CreateThread
(
adec_config_t
*
p_config
);
vlc_thread_t
lpcmdec_CreateThread
(
adec_config_t
*
p_config
);
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