Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
e97f189c
Commit
e97f189c
authored
Jan 24, 2000
by
Michel Kaempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* GoldenEye rewlz :
- explications du commit au prochain commit :-)
parent
07f2392f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
66 deletions
+114
-66
include/audio_output.h
include/audio_output.h
+3
-4
src/ac3_decoder/ac3_decoder.c
src/ac3_decoder/ac3_decoder.c
+6
-0
src/audio_output/audio_output.c
src/audio_output/audio_output.c
+105
-62
No files found.
include/audio_output.h
View file @
e97f189c
...
@@ -176,12 +176,11 @@ typedef struct aout_thread_s
...
@@ -176,12 +176,11 @@ typedef struct aout_thread_s
/* The size of the audio output buffer is kept in audio units, as this is
/* The size of the audio output buffer is kept in audio units, as this is
* the only unit that is common with every audio decoder and audio fifo */
* the only unit that is common with every audio decoder and audio fifo */
long
l_units
;
long
l_units
;
long
l_msleep
;
mtime_t
date
;
/* date is the moment where the first audio unit of the output buffer
/* date is the moment where the first audio unit of the output buffer
* should be played and is kept up-to-date with the following incremental
* will be played */
* structure */
mtime_t
date
;
aout_increment_t
date_increment
;
}
aout_thread_t
;
}
aout_thread_t
;
...
...
src/ac3_decoder/ac3_decoder.c
View file @
e97f189c
...
@@ -277,6 +277,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
...
@@ -277,6 +277,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
downmix
(
p_ac3dec
,
((
ac3dec_frame_t
*
)
p_ac3dec
->
p_aout_fifo
->
buffer
)[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
);
downmix
(
p_ac3dec
,
((
ac3dec_frame_t
*
)
p_ac3dec
->
p_aout_fifo
->
buffer
)[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
);
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_ac3dec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
/* frame 2 */
/* frame 2 */
...
@@ -297,6 +298,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
...
@@ -297,6 +298,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_ac3dec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
/* frame 3 */
/* frame 3 */
...
@@ -317,6 +319,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
...
@@ -317,6 +319,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_ac3dec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
/* frame 4 */
/* frame 4 */
...
@@ -337,6 +340,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
...
@@ -337,6 +340,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_ac3dec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
/* frame 5 */
/* frame 5 */
...
@@ -357,6 +361,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
...
@@ -357,6 +361,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_ac3dec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
/* frame 6 */
/* frame 6 */
...
@@ -377,6 +382,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
...
@@ -377,6 +382,7 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_ac3dec
->
p_aout_fifo
->
date
[
p_ac3dec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_lock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_ac3dec
->
p_aout_fifo
->
l_end_frame
=
(
p_ac3dec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
vlc_cond_signal
(
&
p_ac3dec
->
p_aout_fifo
->
data_wait
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
vlc_mutex_unlock
(
&
p_ac3dec
->
p_aout_fifo
->
data_lock
);
parse_auxdata
(
p_ac3dec
);
parse_auxdata
(
p_ac3dec
);
...
...
src/audio_output/audio_output.c
View file @
e97f189c
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
* Local prototypes
* Local prototypes
******************************************************************************/
******************************************************************************/
static
int
aout_SpawnThread
(
aout_thread_t
*
p_aout
);
static
int
aout_SpawnThread
(
aout_thread_t
*
p_aout
);
/* Creating as much aout_Thread functions as configurations is one solution,
/* Creating as much aout_Thread functions as configurations is one solution,
...
@@ -56,7 +55,7 @@ void aout_Thread_S16_Stereo ( aout_thread_t * p_aout );
...
@@ -56,7 +55,7 @@ void aout_Thread_S16_Stereo ( aout_thread_t * p_aout );
void
aout_Thread_U16_Stereo
(
aout_thread_t
*
p_aout
);
void
aout_Thread_U16_Stereo
(
aout_thread_t
*
p_aout
);
static
__inline__
void
InitializeIncrement
(
aout_increment_t
*
p_increment
,
long
l_numerator
,
long
l_denominator
);
static
__inline__
void
InitializeIncrement
(
aout_increment_t
*
p_increment
,
long
l_numerator
,
long
l_denominator
);
static
__inline__
int
NextFrame
(
aout_thread_t
*
p_aout
,
aout_fifo_t
*
p_fifo
/*, mtime_t aout_date*/
);
static
__inline__
int
NextFrame
(
aout_thread_t
*
p_aout
,
aout_fifo_t
*
p_fifo
,
mtime_t
aout_date
);
/******************************************************************************
/******************************************************************************
* aout_CreateThread: initialize audio thread
* aout_CreateThread: initialize audio thread
...
@@ -138,7 +137,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
...
@@ -138,7 +137,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
{
{
int
i_fifo
;
int
i_fifo
;
long
l_bytes
;
long
l_bytes
;
s64
s64_numerator
,
s64_denominator
;
void
*
aout_thread
=
NULL
;
void
*
aout_thread
=
NULL
;
intf_DbgMsg
(
"aout debug: spawning audio output thread (%p)
\n
"
,
p_aout
);
intf_DbgMsg
(
"aout debug: spawning audio output thread (%p)
\n
"
,
p_aout
);
...
@@ -160,6 +158,7 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
...
@@ -160,6 +158,7 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
* AOUT_BUFFER_DURATION is given in microseconds, the output rate is given
* AOUT_BUFFER_DURATION is given in microseconds, the output rate is given
* in Hz, that's why we need to divide by 10^6 microseconds (1 second) */
* in Hz, that's why we need to divide by 10^6 microseconds (1 second) */
p_aout
->
l_units
=
(
long
)(
((
s64
)
p_aout
->
dsp
.
l_rate
*
AOUT_BUFFER_DURATION
)
/
1000000
);
p_aout
->
l_units
=
(
long
)(
((
s64
)
p_aout
->
dsp
.
l_rate
*
AOUT_BUFFER_DURATION
)
/
1000000
);
p_aout
->
l_msleep
=
((
s64
)
p_aout
->
l_units
*
1000000
)
/
(
s64
)
p_aout
->
dsp
.
l_rate
;
/* Make aout_thread point to the right thread function, and compute the
/* Make aout_thread point to the right thread function, and compute the
* byte size of the audio output buffer */
* byte size of the audio output buffer */
...
@@ -251,24 +250,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
...
@@ -251,24 +250,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
return
(
-
1
);
return
(
-
1
);
}
}
/* Initialize the incremental structure that is used to work out the date
* of the first audio unit in the output buffer */
s64_numerator
=
(
s64
)
p_aout
->
l_units
*
1000000
;
s64_denominator
=
(
s64
)
p_aout
->
dsp
.
l_rate
;
p_aout
->
date_increment
.
l_remainder
=
-
(
long
)
s64_denominator
;
p_aout
->
date_increment
.
l_euclidean_integer
=
0
;
while
(
s64_numerator
>=
s64_denominator
)
{
p_aout
->
date_increment
.
l_euclidean_integer
++
;
s64_numerator
-=
s64_denominator
;
}
p_aout
->
date_increment
.
l_euclidean_remainder
=
(
long
)
s64_numerator
;
p_aout
->
date_increment
.
l_euclidean_denominator
=
(
long
)
s64_denominator
;
/* Before launching the thread, we try to predict the date of the first
/* Before launching the thread, we try to predict the date of the first
* audio unit in the first output buffer */
* audio unit in the first output buffer */
p_aout
->
date
=
mdate
();
p_aout
->
date
=
mdate
();
...
@@ -391,7 +372,6 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
...
@@ -391,7 +372,6 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
* out the fifo's current rate (as soon as the decoder has decoded
* out the fifo's current rate (as soon as the decoder has decoded
* enough frames, the members of the fifo structure that are not
* enough frames, the members of the fifo structure that are not
* initialized now will be calculated) */
* initialized now will be calculated) */
p_aout
->
fifo
[
i_fifo
].
l_unit
=
0
;
/* !! */
p_aout
->
fifo
[
i_fifo
].
b_start_frame
=
0
;
p_aout
->
fifo
[
i_fifo
].
b_start_frame
=
0
;
p_aout
->
fifo
[
i_fifo
].
b_next_frame
=
0
;
p_aout
->
fifo
[
i_fifo
].
b_next_frame
=
0
;
break
;
break
;
...
@@ -457,7 +437,7 @@ static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long
...
@@ -457,7 +437,7 @@ static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long
/******************************************************************************
/******************************************************************************
* NextFrame
* NextFrame
******************************************************************************/
******************************************************************************/
static
__inline__
int
NextFrame
(
aout_thread_t
*
p_aout
,
aout_fifo_t
*
p_fifo
/*, mtime_t aout_date*/
)
static
__inline__
int
NextFrame
(
aout_thread_t
*
p_aout
,
aout_fifo_t
*
p_fifo
,
mtime_t
aout_date
)
{
{
long
l_units
,
l_rate
;
long
l_units
,
l_rate
;
...
@@ -473,6 +453,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -473,6 +453,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
{
{
p_fifo
->
b_start_frame
=
1
;
p_fifo
->
b_start_frame
=
1
;
p_fifo
->
l_next_frame
=
(
p_fifo
->
l_start_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_fifo
->
l_next_frame
=
(
p_fifo
->
l_start_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_fifo
->
l_unit
=
p_fifo
->
l_start_frame
*
(
p_fifo
->
l_frame_size
>>
p_fifo
->
b_stereo
);
break
;
break
;
}
}
p_fifo
->
l_start_frame
=
(
p_fifo
->
l_start_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_fifo
->
l_start_frame
=
(
p_fifo
->
l_start_frame
+
1
)
&
AOUT_FIFO_SIZE
;
...
@@ -483,24 +464,25 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -483,24 +464,25 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
return
(
-
1
);
return
(
-
1
);
}
}
}
}
/*
if ( aout_date < p_fifo->date[p_fifo->l_start_frame] )
#if 0
if ( aout_date < p_fifo->date[p_fifo->l_start_frame] - 100000 )
{
{
fprintf(stderr, "+");
fprintf( stderr, "-" );
p_fifo->l_dr = 0;
vlc_mutex_unlock( &p_fifo->data_lock );
vlc_mutex_unlock( &p_fifo->data_lock );
return( -1 );
return( -1 );
}
}
*/
#endif
/* We are looking for the next dated frame */
/* We are looking for the next dated frame */
while
(
1
)
{
while
(
p_fifo
->
l_next_frame
!=
p_fifo
->
l_end_frame
)
while
(
p_fifo
->
l_next_frame
!=
p_fifo
->
l_end_frame
)
{
{
if
(
p_fifo
->
date
[
p_fifo
->
l_next_frame
]
!=
LAST_MDATE
)
if
(
p_fifo
->
date
[
p_fifo
->
l_next_frame
]
!=
LAST_MDATE
)
{
{
/*
#if 0
if ( aout_date < p_fifo->date[p_fifo->l_next_frame] )
{
*/
if ( p_fifo->date[p_fifo->l_start_frame] >= p_fifo->date[p_fifo->l_next_frame] )
if ( p_fifo->date[p_fifo->l_start_frame] >= p_fifo->date[p_fifo->l_next_frame] )
{
{
fprintf( stderr, "aout debug: %lli >= %lli\n", p_fifo->date[p_fifo->l_start_frame], p_fifo->date[p_fifo->l_next_frame] );
fprintf( stderr, "aout debug: %lli >= %lli\n", p_fifo->date[p_fifo->l_start_frame], p_fifo->date[p_fifo->l_next_frame] );
...
@@ -512,23 +494,55 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -512,23 +494,55 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
fprintf( stderr, "aout debug: (%lli - %lli) > 1000000\n", p_fifo->date[p_fifo->l_next_frame], p_fifo->date[p_fifo->l_start_frame] );
fprintf( stderr, "aout debug: (%lli - %lli) > 1000000\n", p_fifo->date[p_fifo->l_next_frame], p_fifo->date[p_fifo->l_start_frame] );
p_fifo->date[p_fifo->l_start_frame] = p_fifo->date[p_fifo->l_next_frame] - ((1000000 * ((mtime_t)(p_fifo->l_frame_size * ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE))) >> p_fifo->b_stereo) / ((mtime_t)p_fifo->l_rate));
p_fifo->date[p_fifo->l_start_frame] = p_fifo->date[p_fifo->l_next_frame] - ((1000000 * ((mtime_t)(p_fifo->l_frame_size * ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE))) >> p_fifo->b_stereo) / ((mtime_t)p_fifo->l_rate));
}
}
#endif
p_fifo
->
b_next_frame
=
1
;
#if 0
break
;
if ( aout_date < p_fifo->date[p_fifo->l_next_frame] + 100000 )
{
/*
#endif
p_fifo
->
b_next_frame
=
1
;
break
;
#if 0
}
}
else
else
{
{
fprintf(stderr, "-");
fprintf( stderr, "+" );
// p_fifo->b_next_frame = 1;
// break;
p_fifo->l_start_frame = p_fifo->l_next_frame;
p_fifo->l_start_frame = p_fifo->l_next_frame;
p_fifo->l_unit = p_fifo->l_start_frame * (p_fifo->l_frame_size >> p_fifo->b_stereo);
p_fifo->l_dr = 0;
}
}
*/
#endif
}
}
p_fifo
->
l_next_frame
=
(
p_fifo
->
l_next_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_fifo
->
l_next_frame
=
(
p_fifo
->
l_next_frame
+
1
)
&
AOUT_FIFO_SIZE
;
}
}
if
(
p_fifo
->
l_next_frame
==
p_fifo
->
l_end_frame
)
{
if
(
(((
p_fifo
->
l_end_frame
+
1
)
-
p_fifo
->
l_start_frame
)
&
AOUT_FIFO_SIZE
)
==
0
)
{
fprintf
(
stderr
,
"aout debug: synkro suxx rocks;
\n
"
);
p_fifo
->
l_start_frame
=
0
;
p_fifo
->
b_start_frame
=
0
;
/* p_fifo->l_next_frame = 0; */
/* p_fifo->b_next_frame = 0; */
p_fifo
->
l_end_frame
=
0
;
vlc_mutex_unlock
(
&
p_fifo
->
data_lock
);
return
(
-
1
);
}
while
(
p_fifo
->
l_next_frame
==
p_fifo
->
l_end_frame
)
{
vlc_cond_wait
(
&
p_fifo
->
data_wait
,
&
p_fifo
->
data_lock
);
}
}
else
{
break
;
}
}
#if 0
if ( p_fifo->l_next_frame == p_fifo->l_end_frame )
if ( p_fifo->l_next_frame == p_fifo->l_end_frame )
{
{
fprintf( stderr, "aout debug: synkro suxx rocks (%li);\n", p_fifo->l_dr );
if ( (((p_fifo->l_end_frame + 1) - p_fifo->l_start_frame) & AOUT_FIFO_SIZE) == 0 )
if ( (((p_fifo->l_end_frame + 1) - p_fifo->l_start_frame) & AOUT_FIFO_SIZE) == 0 )
{
{
p_fifo->l_start_frame = 0;
p_fifo->l_start_frame = 0;
...
@@ -540,12 +554,45 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -540,12 +554,45 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
vlc_mutex_unlock( &p_fifo->data_lock );
vlc_mutex_unlock( &p_fifo->data_lock );
return( -1 );
return( -1 );
}
}
#endif
l_units
=
((
p_fifo
->
l_next_frame
-
p_fifo
->
l_start_frame
)
&
AOUT_FIFO_SIZE
)
*
(
p_fifo
->
l_frame_size
>>
p_fifo
->
b_stereo
);
l_units
=
((
p_fifo
->
l_next_frame
-
p_fifo
->
l_start_frame
)
&
AOUT_FIFO_SIZE
)
*
(
p_fifo
->
l_frame_size
>>
p_fifo
->
b_stereo
);
// fprintf( stderr, "%li", p_fifo->l_unit - (p_fifo->l_start_frame * (p_fifo->l_frame_size >> p_fifo->b_stereo)) );
#if 0
// fprintf( stderr, "aout debug: %lli;\n", aout_date - p_fifo->date[p_fifo->l_start_frame] );
if ( /*(p_fifo->date[p_fifo->l_start_frame] < aout_date) &&*/ (aout_date < p_fifo->date[p_fifo->l_next_frame]) )
{
fprintf( stderr, "*" );
l_rate = (long)(((mtime_t)l_units * 1000000) / (p_fifo->date[p_fifo->l_next_frame] - aout_date));
}
else
{
l_rate = (long)(((mtime_t)l_units * 1000000) / (p_fifo->date[p_fifo->l_next_frame] - p_fifo->date[p_fifo->l_start_frame]));
}
#endif
// l_rate = (long)( ((mtime_t)l_units * 1000000) / (p_fifo->date[p_fifo->l_next_frame] - ((p_fifo->date[p_fifo->l_start_frame] + aout_date) / 2)) );
// fprintf( stderr, "aout debug: l_rate == %li;\n", l_rate );
// fprintf( stderr, "aout debug: %li;\n", l_rate );
// fprintf( stderr, "aout debug: %lli, %li, %lli;\n", aout_date - p_fifo->date[p_fifo->l_start_frame], p_fifo->l_unit - (p_fifo->l_start_frame * (p_fifo->l_frame_size >> p_fifo->b_stereo)), p_fifo->date[p_fifo->l_next_frame] - aout_date );
/*
if ( aout_date < p_fifo->date[p_fifo->l_start_frame] )
{
p_fifo->l_dr -= 1;
}
else if ( p_fifo->date[p_fifo->l_start_frame] < aout_date )
{
p_fifo->l_dr += 1;
}
*/
l_rate
=
p_fifo
->
l_rate
+
((
aout_date
-
p_fifo
->
date
[
p_fifo
->
l_start_frame
])
/
8
);
// l_rate = (long)(((mtime_t)l_units * 1000000) / (p_fifo->date[p_fifo->l_next_frame] - p_fifo->date[p_fifo->l_start_frame])) + p_fifo->l_dr;
// fprintf( stderr, "aout debug: l_rate == %li (%lli);\n", l_rate /*+ p_fifo->l_dr*/, aout_date - p_fifo->date[p_fifo->l_start_frame] );
l_rate
=
(
long
)(
((
mtime_t
)
l_units
*
1000000
)
// p_fifo->delta += aout_date - p_fifo->date[p_fifo->l_start_frame];
/
(
p_fifo
->
date
[
p_fifo
->
l_next_frame
]
-
p_fifo
->
date
[
p_fifo
->
l_start_frame
])
)
;
// p_fifo->n += 1
;
// fprintf( stderr, "aout debug:
l_rate == %li\n"
, l_rate );
// fprintf( stderr, "aout debug:
%lli, %lli, %li;\n", aout_date - p_fifo->date[p_fifo->l_start_frame], p_fifo->delta/p_fifo->n
, l_rate );
InitializeIncrement
(
&
p_fifo
->
unit_increment
,
l_rate
,
p_aout
->
dsp
.
l_rate
);
InitializeIncrement
(
&
p_fifo
->
unit_increment
,
l_rate
,
p_aout
->
dsp
.
l_rate
);
...
@@ -581,8 +628,8 @@ void aout_Thread_S16_Mono( aout_thread_t * p_aout )
...
@@ -581,8 +628,8 @@ void aout_Thread_S16_Mono( aout_thread_t * p_aout )
void
aout_Thread_S16_Stereo
(
aout_thread_t
*
p_aout
)
void
aout_Thread_S16_Stereo
(
aout_thread_t
*
p_aout
)
{
{
int
i_fifo
;
int
i_fifo
;
long
l_units
;
long
l_buffer
,
l_buffer_limit
;
long
l_buffer
,
l_buffer_limit
;
long
l_units
,
l_bytes
;
intf_DbgMsg
(
"adec debug: running audio output thread (%p) (pid == %i)
\n
"
,
p_aout
,
getpid
());
intf_DbgMsg
(
"adec debug: running audio output thread (%p) (pid == %i)
\n
"
,
p_aout
,
getpid
());
...
@@ -599,14 +646,6 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -599,14 +646,6 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
break
;
break
;
case
AOUT_INTF_MONO_FIFO
:
case
AOUT_INTF_MONO_FIFO
:
if
(
p_aout
->
fifo
[
i_fifo
].
b_die
)
{
free
(
p_aout
->
fifo
[
i_fifo
].
buffer
);
/* !! */
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
/* !! */
intf_DbgMsg
(
"aout debug: audio output fifo (%p) destroyed
\n
"
,
&
p_aout
->
fifo
[
i_fifo
]);
continue
;
}
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
p_aout
->
l_units
)
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
p_aout
->
l_units
)
{
{
l_buffer
=
0
;
l_buffer
=
0
;
...
@@ -638,14 +677,6 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -638,14 +677,6 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
break
;
break
;
case
AOUT_INTF_STEREO_FIFO
:
case
AOUT_INTF_STEREO_FIFO
:
if
(
p_aout
->
fifo
[
i_fifo
].
b_die
)
{
free
(
p_aout
->
fifo
[
i_fifo
].
buffer
);
/* !! */
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
/* !! */
intf_DbgMsg
(
"aout debug: audio output fifo (%p) destroyed
\n
"
,
&
p_aout
->
fifo
[
i_fifo
]);
continue
;
}
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
p_aout
->
l_units
)
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
p_aout
->
l_units
)
{
{
l_buffer
=
0
;
l_buffer
=
0
;
...
@@ -692,7 +723,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -692,7 +723,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
{
{
if
(
!
p_aout
->
fifo
[
i_fifo
].
b_next_frame
)
if
(
!
p_aout
->
fifo
[
i_fifo
].
b_next_frame
)
{
{
if
(
NextFrame
(
p_aout
,
&
p_aout
->
fifo
[
i_fifo
]
/*, p_aout->date + (mtime_t)((l_buffer >> p_aout->dsp.b_stereo) / p_aout->dsp.l_rate)*/
)
)
if
(
NextFrame
(
p_aout
,
&
p_aout
->
fifo
[
i_fifo
]
,
p_aout
->
date
+
((((
mtime_t
)(
l_buffer
>>
1
))
*
1000000
)
/
((
mtime_t
)
p_aout
->
dsp
.
l_rate
))
)
)
{
{
break
;
break
;
}
}
...
@@ -769,7 +800,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -769,7 +800,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
{
{
if
(
!
p_aout
->
fifo
[
i_fifo
].
b_next_frame
)
if
(
!
p_aout
->
fifo
[
i_fifo
].
b_next_frame
)
{
{
if
(
NextFrame
(
p_aout
,
&
p_aout
->
fifo
[
i_fifo
]
/*, p_aout->date + (mtime_t)((l_buffer >> p_aout->dsp.b_stereo) / p_aout->dsp.l_rate)*/
)
)
if
(
NextFrame
(
p_aout
,
&
p_aout
->
fifo
[
i_fifo
]
,
p_aout
->
date
+
((((
mtime_t
)(
l_buffer
>>
1
))
*
1000000
)
/
((
mtime_t
)
p_aout
->
dsp
.
l_rate
))
)
)
{
{
break
;
break
;
}
}
...
@@ -846,10 +877,18 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -846,10 +877,18 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
}
}
aout_dspGetBufInfo
(
&
p_aout
->
dsp
);
aout_dspGetBufInfo
(
&
p_aout
->
dsp
);
l_bytes
=
(
p_aout
->
dsp
.
buf_info
.
fragstotal
*
p_aout
->
dsp
.
buf_info
.
fragsize
)
-
p_aout
->
dsp
.
buf_info
.
bytes
;
p_aout
->
date
=
mdate
()
+
((((
mtime_t
)(
l_bytes
/
4
))
*
1000000
)
/
((
mtime_t
)
p_aout
->
dsp
.
l_rate
));
/* sizeof(s16) << p_aout->dsp.b_stereo == 4 */
aout_dspPlaySamples
(
&
p_aout
->
dsp
,
(
byte_t
*
)
p_aout
->
buffer
,
l_buffer_limit
*
sizeof
(
s16
)
);
if
(
l_bytes
>
(
l_buffer_limit
*
sizeof
(
s16
))
)
{
msleep
(
p_aout
->
l_msleep
);
}
#if 0
if ( p_aout->dsp.buf_info.fragments == p_aout->dsp.buf_info.fragstotal ) /* ?? */
if ( p_aout->dsp.buf_info.fragments == p_aout->dsp.buf_info.fragstotal ) /* ?? */
{
{
aout_dspPlaySamples
(
&
p_aout
->
dsp
,
(
byte_t
*
)
p_aout
->
buffer
,
sizeof
(
s16
)
*
l_buffer_limit
);
p_aout->date = mdate();
p_aout->date = mdate();
aout_dspPlaySamples( &p_aout->dsp, (byte_t *)p_aout->buffer, sizeof(s16) * l_buffer_limit );
}
}
else if ( p_aout->dsp.buf_info.bytes >=
else if ( p_aout->dsp.buf_info.bytes >=
((p_aout->dsp.buf_info.fragsize * p_aout->dsp.buf_info.fragstotal) -
((p_aout->dsp.buf_info.fragsize * p_aout->dsp.buf_info.fragstotal) -
...
@@ -859,10 +898,14 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -859,10 +898,14 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
}
}
else
else
{
{
fprintf( stderr, "%lli\n", mdate() - date );
date = mdate();
aout_dspPlaySamples( &p_aout->dsp, (byte_t *)p_aout->buffer, sizeof(s16) * l_buffer_limit );
aout_dspPlaySamples( &p_aout->dsp, (byte_t *)p_aout->buffer, sizeof(s16) * l_buffer_limit );
// fprintf( stderr, "%lli\n", (date + ((((mtime_t)((p_aout->dsp.buf_info.fragstotal * p_aout->dsp.buf_info.fragsize - p_aout->dsp.buf_info.bytes) / 4)) * 1000000)/((mtime_t)p_aout->dsp.l_rate))) - p_aout->date );
msleep( p_aout->date_increment.l_euclidean_integer );
msleep( p_aout->date_increment.l_euclidean_integer );
}
}
UPDATE_INCREMENT( p_aout->date_increment, p_aout->date )
UPDATE_INCREMENT( p_aout->date_increment, p_aout->date )
#endif
}
}
vlc_mutex_lock
(
&
p_aout
->
fifos_lock
);
vlc_mutex_lock
(
&
p_aout
->
fifos_lock
);
...
...
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