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
9be218d5
Commit
9be218d5
authored
May 17, 2000
by
Renaud Dartus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout des fonctions de r�glage du volume (touches : +, -, m)
parent
a61212cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
396 additions
and
5 deletions
+396
-5
include/audio_output.h
include/audio_output.h
+11
-0
src/audio_output/audio_output.c
src/audio_output/audio_output.c
+370
-2
src/interface/interface.c
src/interface/interface.c
+15
-3
No files found.
include/audio_output.h
View file @
9be218d5
...
@@ -57,12 +57,19 @@
...
@@ -57,12 +57,19 @@
/* Default stereo mode (0 stands for mono, 1 for stereo) */
/* Default stereo mode (0 stands for mono, 1 for stereo) */
#define AOUT_DEFAULT_STEREO 1
#define AOUT_DEFAULT_STEREO 1
/* #define AOUT_DEFAULT_STEREO 0 */
/* Audio output rate, in Hz */
/* Audio output rate, in Hz */
#define AOUT_MIN_RATE 22050
/* XXX?? */
#define AOUT_MIN_RATE 22050
/* XXX?? */
#define AOUT_DEFAULT_RATE 44100
#define AOUT_DEFAULT_RATE 44100
#define AOUT_MAX_RATE 48000
#define AOUT_MAX_RATE 48000
/* Volume (default 100) */
#define VOL 100
#define VOLSTEP 5
#define VOLMAX 300
/* Number of audio output frames contained in an audio output fifo.
/* Number of audio output frames contained in an audio output fifo.
* (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the
* (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the
* %(AOUT_FIFO_SIZE + 1) operation with an &AOUT_FIFO_SIZE.
* %(AOUT_FIFO_SIZE + 1) operation with an &AOUT_FIFO_SIZE.
...
@@ -227,6 +234,10 @@ typedef struct aout_thread_s
...
@@ -227,6 +234,10 @@ typedef struct aout_thread_s
* for the OSS output */
* for the OSS output */
p_aout_sys_t
p_sys
;
p_aout_sys_t
p_sys
;
/* there is the current volume */
int
vol
;
}
aout_thread_t
;
}
aout_thread_t
;
/* Those are from <linux/soundcard.h> but are needed because of formats
/* Those are from <linux/soundcard.h> but are needed because of formats
...
...
src/audio_output/audio_output.c
View file @
9be218d5
...
@@ -95,6 +95,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
...
@@ -95,6 +95,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
/* Request an interface plugin */
/* Request an interface plugin */
psz_method
=
main_GetPszVariable
(
AOUT_METHOD_VAR
,
AOUT_DEFAULT_METHOD
);
psz_method
=
main_GetPszVariable
(
AOUT_METHOD_VAR
,
AOUT_DEFAULT_METHOD
);
if
(
RequestPlugin
(
&
p_aout
->
aout_plugin
,
"aout"
,
psz_method
)
)
if
(
RequestPlugin
(
&
p_aout
->
aout_plugin
,
"aout"
,
psz_method
)
)
{
{
intf_ErrMsg
(
"error: could not open audio plugin aout_%s.so
\n
"
,
psz_method
);
intf_ErrMsg
(
"error: could not open audio plugin aout_%s.so
\n
"
,
psz_method
);
...
@@ -154,6 +155,11 @@ aout_thread_t *aout_CreateThread( int *pi_status )
...
@@ -154,6 +155,11 @@ aout_thread_t *aout_CreateThread( int *pi_status )
return
(
NULL
);
return
(
NULL
);
}
}
/* Initialize the vomue level */
p_aout
->
vol
=
VOL
;
/* FIXME: maybe it would be cleaner to change SpawnThread prototype
/* FIXME: maybe it would be cleaner to change SpawnThread prototype
* see vout to handle status correctly ?? however, it is not critical since
* see vout to handle status correctly ?? however, it is not critical since
* this thread is only called in main and all calls are blocking */
* this thread is only called in main and all calls are blocking */
...
@@ -563,6 +569,366 @@ void aout_Thread_S8_Stereo( aout_thread_t * p_aout )
...
@@ -563,6 +569,366 @@ void aout_Thread_S8_Stereo( aout_thread_t * p_aout )
void
aout_Thread_U8_Mono
(
aout_thread_t
*
p_aout
)
void
aout_Thread_U8_Mono
(
aout_thread_t
*
p_aout
)
{
{
int
i_fifo
;
long
l_buffer
,
l_buffer_limit
;
long
l_units
,
l_bytes
;
intf_DbgMsg
(
"adec debug: ********aout_Thread_U8_Mono********
\n
"
);
intf_DbgMsg
(
"adec debug: running audio output thread (%p) (pid == %i)
\n
"
,
p_aout
,
getpid
());
/* As the s32_buffer was created with calloc(), we don't have to set this
* memory to zero and we can immediately jump into the thread's loop */
while
(
!
p_aout
->
b_die
)
{
vlc_mutex_lock
(
&
p_aout
->
fifos_lock
);
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
{
switch
(
p_aout
->
fifo
[
i_fifo
].
i_type
)
{
case
AOUT_EMPTY_FIFO
:
break
;
case
AOUT_INTF_MONO_FIFO
:
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
p_aout
->
l_units
)
{
l_buffer
=
0
;
while
(
l_buffer
<
(
p_aout
->
l_units
/*<< 1*/
)
)
/* p_aout->b_stereo == 1 */
{
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
}
p_aout
->
fifo
[
i_fifo
].
l_units
-=
p_aout
->
l_units
;
}
else
{
l_buffer
=
0
;
while
(
l_buffer
<
(
p_aout
->
fifo
[
i_fifo
].
l_units
/*<< 1*/
)
)
/* p_aout->b_stereo == 1 */
{
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
}
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
]);
/* !! */
}
break
;
case
AOUT_INTF_STEREO_FIFO
:
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
p_aout
->
l_units
)
{
l_buffer
=
0
;
while
(
l_buffer
<
(
p_aout
->
l_units
/*<< 1*/
)
)
/* p_aout->b_stereo == 1 */
{
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
2
*
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
2
*
p_aout
->
fifo
[
i_fifo
].
l_unit
+
1
]
);
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
}
p_aout
->
fifo
[
i_fifo
].
l_units
-=
p_aout
->
l_units
;
}
else
{
l_buffer
=
0
;
while
(
l_buffer
<
(
p_aout
->
fifo
[
i_fifo
].
l_units
/*<< 1*/
)
)
/* p_aout->b_stereo == 1 */
{
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
2
*
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
2
*
p_aout
->
fifo
[
i_fifo
].
l_unit
+
1
]
);
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
}
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
]);
/* !! */
}
break
;
case
AOUT_ADEC_MONO_FIFO
:
if
(
p_aout
->
fifo
[
i_fifo
].
b_die
)
{
free
(
p_aout
->
fifo
[
i_fifo
].
buffer
);
free
(
p_aout
->
fifo
[
i_fifo
].
date
);
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
;
}
l_units
=
p_aout
->
l_units
;
l_buffer
=
0
;
while
(
l_units
>
0
)
{
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
>>
1
))
*
1000000
)
/
((
mtime_t
)
p_aout
->
l_rate
)))
)
{
break
;
}
}
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
l_units
)
{
l_buffer_limit
=
p_aout
->
l_units
/*<< 1*/
;
/* p_aout->b_stereo == 1 */
while
(
l_buffer
<
l_buffer_limit
)
{
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
if
(
p_aout
->
fifo
[
i_fifo
].
l_unit
>=
/* p_aout->fifo[i_fifo].b_stereo == 0 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
0
))
)
{
p_aout
->
fifo
[
i_fifo
].
l_unit
-=
/* p_aout->fifo[i_fifo].b_stereo == 0 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
0
));
}
}
p_aout
->
fifo
[
i_fifo
].
l_units
-=
l_units
;
break
;
}
else
{
l_buffer_limit
=
l_buffer
+
(
p_aout
->
fifo
[
i_fifo
].
l_units
<<
1
);
/* p_aout->b_stereo == 1 */
while
(
l_buffer
<
l_buffer_limit
)
{
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
if
(
p_aout
->
fifo
[
i_fifo
].
l_unit
>=
/* p_aout->fifo[i_fifo].b_stereo == 0 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
0
))
)
{
p_aout
->
fifo
[
i_fifo
].
l_unit
-=
/* p_aout->fifo[i_fifo].b_stereo == 0 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
0
));
}
}
l_units
-=
p_aout
->
fifo
[
i_fifo
].
l_units
;
vlc_mutex_lock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
p_aout
->
fifo
[
i_fifo
].
l_next_frame
;
vlc_cond_signal
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
);
vlc_mutex_unlock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
/* p_aout->fifo[i_fifo].b_start_frame = 1; */
p_aout
->
fifo
[
i_fifo
].
l_next_frame
+=
1
;
p_aout
->
fifo
[
i_fifo
].
l_next_frame
&=
AOUT_FIFO_SIZE
;
p_aout
->
fifo
[
i_fifo
].
b_next_frame
=
0
;
}
}
break
;
case
AOUT_ADEC_STEREO_FIFO
:
if
(
p_aout
->
fifo
[
i_fifo
].
b_die
)
{
free
(
p_aout
->
fifo
[
i_fifo
].
buffer
);
free
(
p_aout
->
fifo
[
i_fifo
].
date
);
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
;
}
l_units
=
p_aout
->
l_units
;
l_buffer
=
0
;
while
(
l_units
>
0
)
{
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
>>
1
))
*
1000000
)
/
((
mtime_t
)
p_aout
->
l_rate
)))
)
{
break
;
}
}
#define SOUND 1
#define DEBUG 0
#define COEFF 2
if
(
p_aout
->
fifo
[
i_fifo
].
l_units
>
l_units
)
{
l_buffer_limit
=
p_aout
->
l_units
/*<< 1*/
;
/* p_aout->b_stereo == 1 */
//fprintf(stderr,"l_buffer_limit:%d\n",l_buffer_limit);
while
(
l_buffer
<
l_buffer_limit
)
{
#if SOUND
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
+
1
]
);
/*
//fprintf(stderr,"1deb ");
l_buffer++;
p_aout->s32_buffer[l_buffer] += (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[COEFF*p_aout->fifo[i_fifo].l_unit] ) / 2;
p_aout->s32_buffer[l_buffer] += (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[COEFF*p_aout->fifo[i_fifo].l_unit+1] ) / 2;
l_buffer++;
//fprintf (stderr,"1fin ");
*/
#endif
#if DEBUG
//fprintf(stderr,"p_aout->s32_buffer[l_buffer] 11 : %x (%d)",p_aout->s32_buffer[l_buffer-1],p_aout->s32_buffer[l_buffer-1]);
fprintf
(
stderr
,
"p_aout->fifo %ld
\n
"
,
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
);
fprintf
(
stderr
,
"%d - p_aout->s32b %ld
\n
"
,
l_buffer
,
(
s32
)
(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
]
)
);
//fprintf(stderr,"p_aout->s32_buffer[l_buffer] 12 : %x (%d)\n",p_aout->s32_buffer[l_buffer-1],p_aout->s32_buffer[l_buffer-1]);
#endif
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
if
(
p_aout
->
fifo
[
i_fifo
].
l_unit
>=
/* p_aout->fifo[i_fifo].b_stereo == 1 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
2
/*1*/
))
)
{
p_aout
->
fifo
[
i_fifo
].
l_unit
-=
/* p_aout->fifo[i_fifo].b_stereo == 1 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
2
/*1*/
));
}
}
p_aout
->
fifo
[
i_fifo
].
l_units
-=
l_units
;
break
;
}
else
{
//#if 0
l_buffer_limit
=
l_buffer
+
(
p_aout
->
fifo
[
i_fifo
].
l_units
/*<< 1*/
);
//fprintf(stderr,"l_buffer_limit:%d\n",l_buffer_limit);
/* p_aout->b_stereo == 1 */
while
(
l_buffer
<
l_buffer_limit
)
{
#if SOUND
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
]
);
p_aout
->
s32_buffer
[
l_buffer
++
]
+=
(
s32
)(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
+
1
]
);
/*
//fprintf(stderr,"2deb ");
l_buffer++;
//fprintf(stderr,"793 ");
// !!!!!! Seg Fault !!!!!!!
//fprintf(stderr,"\n p->aout_buffer : %d\t%d\n",p_aout->s32_buffer[l_buffer],COEFF*p_aout->fifo[i_fifo].l_unit);
if( COEFF*p_aout->fifo[i_fifo].l_unit < 60000 )
{
p_aout->s32_buffer[l_buffer] += (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[COEFF*p_aout->fifo[i_fifo].l_unit] ) / 2;
// fprintf(stderr,"795 ");
p_aout->s32_buffer[l_buffer] += (s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[COEFF*p_aout->fifo[i_fifo].l_unit+1] ) / 2;
//fprintf(stderr,"797 ");
l_buffer++;
}
//fprintf(stderr,"2fin ");
*/
#endif
#if DEBUG
//fprintf(stderr,"p_aout->s32_buffer[l_buffer] 21 : %x (%d)",p_aout->s32_buffer[l_buffer-1],p_aout->s32_buffer[l_buffer-1]);
fprintf
(
stderr
,
"p_aout->fifo %ld
\n
"
,
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
);
fprintf
(
stderr
,
"%d - p_aout->s32b %ld
\n
"
,
l_buffer
,
(
s32
)
(
((
s16
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
)[
COEFF
*
p_aout
->
fifo
[
i_fifo
].
l_unit
]
)
);
//fprintf(stderr,"p_aout->s32_buffer[l_buffer] 22 : %x (%d)\n",p_aout->s32_buffer[l_buffer-1],p_aout->s32_buffer[l_buffer-1]);
#endif
UPDATE_INCREMENT
(
p_aout
->
fifo
[
i_fifo
].
unit_increment
,
p_aout
->
fifo
[
i_fifo
].
l_unit
)
//fprintf(stderr,"807 ");
if
(
p_aout
->
fifo
[
i_fifo
].
l_unit
>=
/* p_aout->fifo[i_fifo].b_stereo == 1 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
2
/*1*/
))
)
{
//fprintf(stderr,"811 ");
p_aout
->
fifo
[
i_fifo
].
l_unit
-=
/* p_aout->fifo[i_fifo].b_stereo == 1 */
((
AOUT_FIFO_SIZE
+
1
)
*
(
p_aout
->
fifo
[
i_fifo
].
l_frame_size
>>
2
/*1*/
));
}
}
//fprintf(stderr,"816 ");
l_units
-=
p_aout
->
fifo
[
i_fifo
].
l_units
;
//fprintf(stderr,"818 ");
vlc_mutex_lock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
//fprintf(stderr,"820 ");
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
p_aout
->
fifo
[
i_fifo
].
l_next_frame
;
//fprintf(stderr,"822 ");
vlc_cond_signal
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
);
//fprintf(stderr,"824 ");
vlc_mutex_unlock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
//fprintf(stderr,"826 ");
/* p_aout->fifo[i_fifo].b_start_frame = 1; */
p_aout
->
fifo
[
i_fifo
].
l_next_frame
+=
1
;
//fprintf(stderr,"829 ");
p_aout
->
fifo
[
i_fifo
].
l_next_frame
&=
AOUT_FIFO_SIZE
;
//fprintf(stderr,"831 ");
p_aout
->
fifo
[
i_fifo
].
b_next_frame
=
0
;
//#endif
//fprintf(stderr,"837 ");
}
//fprintf(stderr,"838 ");
/* !!!!!!!!!!!!! Seg Fault !!!!!!!!!!!!!!!!! */
}
//fprintf(stderr,"839 ");
break
;
default:
//fprintf(stderr,"841 ");
intf_DbgMsg
(
"aout debug: unknown fifo type (%i)
\n
"
,
p_aout
->
fifo
[
i_fifo
].
i_type
);
//fprintf(stderr,"842 ");
break
;
}
}
//fprintf(stderr,"843 ");
vlc_mutex_unlock
(
&
p_aout
->
fifos_lock
);
//fprintf(stderr,"845 ");
l_buffer_limit
=
p_aout
->
l_units
/*<< 1*/
;
/* p_aout->b_stereo == 1 */
//fprintf(stderr,"\nici commence l'envoie sur sb\n");
for
(
l_buffer
=
0
;
l_buffer
<
l_buffer_limit
;
l_buffer
++
)
{
//fprintf(stderr,"3deb ");
//fprintf(stderr,"p_aout->s_32_buffer[l_buffer] : %x (%d)\n",p_aout->s32_buffer[l_buffer],p_aout->s32_buffer[l_buffer]);
((
u8
*
)
p_aout
->
buffer
)[
l_buffer
]
=
(
u8
)(
(
p_aout
->
s32_buffer
[
/*2 **/
l_buffer
]
/
256
)
+
128
);
//fprintf(stderr,"p_aout->buffer[l_buffer] : %x (%d)\n", ((u8 *)p_aout->buffer)[l_buffer], ((u8 *)p_aout->buffer)[l_buffer] );
p_aout
->
s32_buffer
[
/*2 **/
l_buffer
]
=
0
;
// p_aout->s32_buffer[2 * l_buffer + 1] = 0;
//fprintf(stderr,"3fin ");
}
l_bytes
=
p_aout
->
p_sys_getbufinfo
(
p_aout
,
l_buffer_limit
);
p_aout
->
date
=
mdate
()
+
((((
mtime_t
)(
l_bytes
/
2
))
*
1000000
)
/
((
mtime_t
)
p_aout
->
l_rate
));
/* sizeof(u8) << (p_aout->b_stereo) == 2 */
p_aout
->
p_sys_playsamples
(
p_aout
,
(
byte_t
*
)
p_aout
->
buffer
,
l_buffer_limit
*
sizeof
(
u8
)
);
if
(
l_bytes
>
(
l_buffer_limit
*
sizeof
(
u8
))
)
{
msleep
(
p_aout
->
l_msleep
);
}
}
vlc_mutex_lock
(
&
p_aout
->
fifos_lock
);
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
{
switch
(
p_aout
->
fifo
[
i_fifo
].
i_type
)
{
case
AOUT_EMPTY_FIFO
:
break
;
case
AOUT_INTF_MONO_FIFO
:
case
AOUT_INTF_STEREO_FIFO
:
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
]);
break
;
case
AOUT_ADEC_MONO_FIFO
:
case
AOUT_ADEC_STEREO_FIFO
:
free
(
p_aout
->
fifo
[
i_fifo
].
buffer
);
free
(
p_aout
->
fifo
[
i_fifo
].
date
);
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
]);
break
;
default:
break
;
}
}
vlc_mutex_unlock
(
&
p_aout
->
fifos_lock
);
}
}
void
aout_Thread_U8_Stereo
(
aout_thread_t
*
p_aout
)
void
aout_Thread_U8_Stereo
(
aout_thread_t
*
p_aout
)
...
@@ -813,7 +1179,8 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
...
@@ -813,7 +1179,8 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
for
(
l_buffer
=
0
;
l_buffer
<
l_buffer_limit
;
l_buffer
++
)
for
(
l_buffer
=
0
;
l_buffer
<
l_buffer_limit
;
l_buffer
++
)
{
{
((
u8
*
)
p_aout
->
buffer
)[
l_buffer
]
=
(
u8
)(
(
p_aout
->
s32_buffer
[
l_buffer
]
/
256
)
+
128
);
((
u8
*
)
p_aout
->
buffer
)[
l_buffer
]
=
(
u8
)(
(
(
p_aout
->
s32_buffer
[
l_buffer
]
/
256
)
+
128
)
*
\
((
float
)
p_aout
->
vol
/
100
)
);
p_aout
->
s32_buffer
[
l_buffer
]
=
0
;
p_aout
->
s32_buffer
[
l_buffer
]
=
0
;
}
}
l_bytes
=
p_aout
->
p_sys_getbufinfo
(
p_aout
,
l_buffer_limit
);
l_bytes
=
p_aout
->
p_sys_getbufinfo
(
p_aout
,
l_buffer_limit
);
...
@@ -1108,7 +1475,8 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -1108,7 +1475,8 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
for
(
l_buffer
=
0
;
l_buffer
<
l_buffer_limit
;
l_buffer
++
)
for
(
l_buffer
=
0
;
l_buffer
<
l_buffer_limit
;
l_buffer
++
)
{
{
((
s16
*
)
p_aout
->
buffer
)[
l_buffer
]
=
(
s16
)(
p_aout
->
s32_buffer
[
l_buffer
]
/
AOUT_MAX_FIFOS
);
((
s16
*
)
p_aout
->
buffer
)[
l_buffer
]
=
(
s16
)(
(
p_aout
->
s32_buffer
[
l_buffer
]
/
AOUT_MAX_FIFOS
)
*
\
((
float
)
p_aout
->
vol
/
100
)
)
;
p_aout
->
s32_buffer
[
l_buffer
]
=
0
;
p_aout
->
s32_buffer
[
l_buffer
]
=
0
;
}
}
...
...
src/interface/interface.c
View file @
9be218d5
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
#include "plugins.h"
#include "plugins.h"
#include "input.h"
#include "input.h"
#include "audio_output.h"
#include "intf_msg.h"
#include "intf_msg.h"
#include "interface.h"
#include "interface.h"
#include "intf_cmd.h"
#include "intf_cmd.h"
...
@@ -263,6 +265,8 @@ int intf_SelectChannel( intf_thread_t * p_intf, int i_channel )
...
@@ -263,6 +265,8 @@ int intf_SelectChannel( intf_thread_t * p_intf, int i_channel )
*****************************************************************************/
*****************************************************************************/
int
intf_ProcessKey
(
intf_thread_t
*
p_intf
,
int
i_key
)
int
intf_ProcessKey
(
intf_thread_t
*
p_intf
,
int
i_key
)
{
{
static
int
i_volbackup
;
switch
(
i_key
)
switch
(
i_key
)
{
{
case
'Q'
:
/* quit order */
case
'Q'
:
/* quit order */
...
@@ -286,14 +290,22 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
...
@@ -286,14 +290,22 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
intf_SelectChannel
(
p_intf
,
i_key
-
'0'
);
intf_SelectChannel
(
p_intf
,
i_key
-
'0'
);
break
;
break
;
case
'+'
:
/* volume + */
case
'+'
:
/* volume + */
/* XXX?? */
if
(
(
p_main
->
p_aout
!=
NULL
)
&&
(
p_main
->
p_aout
->
vol
<
VOLMAX
)
)
p_main
->
p_aout
->
vol
+=
VOLSTEP
;
break
;
break
;
case
'-'
:
/* volume - */
case
'-'
:
/* volume - */
/* XXX?? */
if
(
(
p_main
->
p_aout
!=
NULL
)
&&
(
p_main
->
p_aout
->
vol
>
VOLSTEP
)
)
p_main
->
p_aout
->
vol
-=
VOLSTEP
;
break
;
break
;
case
'M'
:
/* toggle mute */
case
'M'
:
/* toggle mute */
case
'm'
:
case
'm'
:
/* XXX?? */
if
(
(
p_main
->
p_aout
!=
NULL
)
&&
(
p_main
->
p_aout
->
vol
))
{
i_volbackup
=
p_main
->
p_aout
->
vol
;
p_main
->
p_aout
->
vol
=
0
;
}
else
if
(
(
p_main
->
p_aout
!=
NULL
)
&&
(
!
p_main
->
p_aout
->
vol
))
p_main
->
p_aout
->
vol
=
i_volbackup
;
break
;
break
;
case
'g'
:
/* gamma - */
case
'g'
:
/* gamma - */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_gamma
>
-
INTF_GAMMA_LIMIT
)
)
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_gamma
>
-
INTF_GAMMA_LIMIT
)
)
...
...
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