Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
5e9d8674
Commit
5e9d8674
authored
Oct 13, 2002
by
Eric Petit
Browse files
Now BeOS sound is (almost) clean.
It is kludgy, but it works ;)
parent
af3a25f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/gui/beos/AudioOutput.cpp
View file @
5e9d8674
...
...
@@ -2,7 +2,7 @@
* aout.cpp: BeOS audio output
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: AudioOutput.cpp,v 1.1
0
2002/10/1
2
1
2:24:52
titer Exp $
* $Id: AudioOutput.cpp,v 1.1
1
2002/10/1
3
1
5:39:16
titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
...
...
@@ -37,6 +37,8 @@
#include
<vlc/aout.h>
#include
"aout_internal.h"
#define FRAME_SIZE 2048
/*****************************************************************************
* aout_sys_t: BeOS audio output method descriptor
*****************************************************************************/
...
...
@@ -45,11 +47,9 @@ typedef struct aout_sys_t
{
BSoundPlayer
*
p_player
;
float
*
p_buffer
;
size_t
i_buffer_size
;
int
i_got_data
;
}
aout_sys_t
;
#define FRAME_SIZE 2048
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
...
...
@@ -66,8 +66,8 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
p_aout
->
output
.
p_sys
=
(
aout_sys_t
*
)
malloc
(
sizeof
(
aout_sys_t
)
);
aout_sys_t
*
p_sys
=
p_aout
->
output
.
p_sys
;
p_sys
->
i_
buffer_size
=
0
;
p_sys
->
p_buffer
=
NULL
;
p_sys
->
i_
got_data
=
0
;
p_sys
->
p_buffer
=
(
float
*
)
malloc
(
16384
);
/*FIXME*/
aout_VolumeSoftInit
(
p_aout
);
...
...
@@ -109,41 +109,33 @@ static void Play( void *aout, void *buffer, size_t size,
aout_sys_t
*
p_sys
=
p_aout
->
output
.
p_sys
;
float
*
p_buffer
=
(
float
*
)
buffer
;
if
(
format
.
format
!=
media_raw_audio_format
::
B_AUDIO_FLOAT
)
/* <kludge> */
/* Usually BSoundPlay asks for 8192 bytes buffers, while vlc gives
a 16384 one. So we keep the second half of it in p_sys->p_buffer */
if
(
p_sys
->
i_got_data
)
{
m
sg_Err
(
p_aout
,
"Bad audio format"
);
return
;
m
emcpy
(
p_buffer
,
p_sys
->
p_buffer
,
8192
);
p_sys
->
i_got_data
=
0
;
}
if
(
p_sys
->
i_buffer_size
<
size
)
else
{
p_aout_buffer
=
aout_FifoPop
(
p_aout
,
&
p_aout
->
output
.
fifo
);
if
(
p_aout_buffer
!=
NULL
)
{
if
(
p_sys
->
p_buffer
==
NULL
)
{
p_sys
->
p_buffer
=
(
float
*
)
malloc
(
p_aout_buffer
->
i_nb_bytes
);
p_sys
->
i_buffer_size
=
p_aout_buffer
->
i_nb_bytes
;
}
else
{
realloc
(
p_sys
->
p_buffer
,
p_sys
->
i_buffer_size
+
p_aout_buffer
->
i_nb_bytes
);
memcpy
(
p_sys
->
p_buffer
+
p_sys
->
i_buffer_size
,
p_aout_buffer
->
p_buffer
,
p_aout_buffer
->
i_nb_bytes
);
p_sys
->
i_buffer_size
+=
p_aout_buffer
->
i_nb_bytes
;
}
memcpy
(
p_buffer
,
p_aout_buffer
->
p_buffer
,
8192
);
memcpy
(
p_sys
->
p_buffer
,
p_aout_buffer
->
p_buffer
+
8192
,
8192
);
p_sys
->
i_got_data
=
1
;
}
}
if
(
p_sys
->
i_buffer_size
>=
size
)
{
memcpy
(
p_buffer
,
p_sys
->
p_buffer
,
MIN
(
size
,
p_sys
->
i_buffer_size
)
);
p_sys
->
i_buffer_size
-=
MIN
(
size
,
p_sys
->
i_buffer_size
);
}
/* </kludge> */
}
/*****************************************************************************
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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