Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
06895b5b
Commit
06895b5b
authored
May 07, 2003
by
Eric Petit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modules/gui/beos/AudioOutput.cpp: cleaning
parent
a0764279
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
56 deletions
+46
-56
modules/gui/beos/AudioOutput.cpp
modules/gui/beos/AudioOutput.cpp
+46
-56
No files found.
modules/gui/beos/AudioOutput.cpp
View file @
06895b5b
...
...
@@ -2,7 +2,7 @@
* AudioOutput.cpp: BeOS audio output
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: AudioOutput.cpp,v 1.2
7 2003/01/14 15:31:12
titer Exp $
* $Id: AudioOutput.cpp,v 1.2
8 2003/05/07 19:20:23
titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
...
...
@@ -46,48 +46,56 @@ extern "C"
* aout_sys_t: BeOS audio output method descriptor
*****************************************************************************/
typedef
struct
latency_t
{
VLC_COMMON_MEMBERS
BSoundPlayer
*
p_player
;
mtime_t
latency
;
}
latency_t
;
typedef
struct
aout_sys_t
{
BSoundPlayer
*
p_player
;
vlc_mutex_t
lock
;
mtime_t
latency
;
BSoundPlayer
*
p_player
;
latency_t
*
p_latency
;
}
aout_sys_t
;
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static
void
Play
(
void
*
p_aout
,
void
*
p_buffer
,
size_t
size
,
const
media_raw_audio_format
&
format
);
static
void
DoNothing
(
aout_instance_t
*
p_aout
);
static
int
CheckLatency
(
aout_instance_t
*
p_aout
);
static
void
Play
(
void
*
p_aout
,
void
*
p_buffer
,
size_t
size
,
const
media_raw_audio_format
&
format
);
static
void
DoNothing
(
aout_instance_t
*
p_aout
);
static
int
CheckLatency
(
latency_t
*
p_latency
);
/*****************************************************************************
* OpenAudio
*****************************************************************************/
int
E_
(
OpenAudio
)
(
vlc_object_t
*
p_this
)
{
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
p_this
;
p_aout
->
output
.
p_sys
=
(
aout_sys_t
*
)
malloc
(
sizeof
(
aout_sys_t
)
);
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
p_this
;
p_aout
->
output
.
p_sys
=
(
aout_sys_t
*
)
malloc
(
sizeof
(
aout_sys_t
)
);
if
(
p_aout
->
output
.
p_sys
==
NULL
)
{
msg_Err
(
p_aout
,
"Not enough memory"
);
return
-
1
;
}
aout_sys_t
*
p_sys
=
p_aout
->
output
.
p_sys
;
aout_sys_t
*
p_sys
=
p_aout
->
output
.
p_sys
;
aout_VolumeSoftInit
(
p_aout
);
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_aout
->
output
.
output
);
/* BSoundPlayer does not support more than 2 channels AFAIK */
if
(
i_nb_channels
>
2
)
if
(
i_nb_channels
>
2
)
{
i_nb_channels
=
2
;
p_aout
->
output
.
output
.
i_physical_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
;
}
media_raw_audio_format
*
p_format
;
media_raw_audio_format
*
p_format
;
p_format
=
(
media_raw_audio_format
*
)
malloc
(
sizeof
(
media_raw_audio_format
)
);
...
...
@@ -114,18 +122,17 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
return
-
1
;
}
/* FIXME
FIXME FIXME
/* FIXME
* We should check BSoundPlayer Latency() everytime we call
* aout_OutputNextBuffer(). Unfortunatly, it does not seem to work
* correctly: on my computer, it hangs for about 5 seconds at the
* beginning of the file. This is not acceptable, so we will start
* playing the file with a default latency (my computer's one ;p )
* and we create a thread who's going to update it ASAP. According
* to what I've seen, the latency is almost constant most of the
* time anyway -- titer */
p_sys
->
latency
=
16209
;
vlc_mutex_init
(
p_aout
,
&
p_sys
->
lock
);
if
(
vlc_thread_create
(
p_aout
,
"latency"
,
CheckLatency
,
* and we create a thread which is going to update it ASAP. */
p_sys
->
p_latency
=
(
latency_t
*
)
vlc_object_create
(
p_aout
,
sizeof
(
latency_t
)
);
p_sys
->
p_latency
->
p_player
=
p_sys
->
p_player
;
p_sys
->
p_latency
->
latency
=
27613
;
if
(
vlc_thread_create
(
p_sys
->
p_latency
,
"latency"
,
CheckLatency
,
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
)
)
{
msg_Err
(
p_aout
,
"cannot create Latency thread"
);
...
...
@@ -140,16 +147,17 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
/*****************************************************************************
* CloseAudio
*****************************************************************************/
void
E_
(
CloseAudio
)
(
vlc_object_t
*
p_this
)
void
E_
(
CloseAudio
)
(
vlc_object_t
*
p_this
)
{
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
p_this
;
aout_sys_t
*
p_sys
=
(
aout_sys_t
*
)
p_aout
->
output
.
p_sys
;
/* Stop the latency thread */
p_sys
->
p_latency
->
b_die
=
VLC_TRUE
;
vlc_thread_join
(
p_sys
->
p_latency
);
vlc_object_destroy
(
p_sys
->
p_latency
);
p_aout
->
b_die
=
VLC_TRUE
;
vlc_thread_join
(
p_aout
);
p_aout
->
b_die
=
VLC_FALSE
;
vlc_mutex_destroy
(
&
p_sys
->
lock
);
/* Clean up */
p_sys
->
p_player
->
Stop
();
delete
p_sys
->
p_player
;
free
(
p_sys
);
...
...
@@ -158,30 +166,27 @@ void E_(CloseAudio) ( vlc_object_t *p_this )
/*****************************************************************************
* Play
*****************************************************************************/
static
void
Play
(
void
*
aout
,
void
*
p_buffer
,
size_t
i_size
,
static
void
Play
(
void
*
_p_aout
,
void
*
_
p_buffer
,
size_t
i_size
,
const
media_raw_audio_format
&
format
)
{
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
aout
;
aout_sys_t
*
p_sys
=
(
aout_sys_t
*
)
p_aout
->
output
.
p_sys
;
aout_buffer_t
*
p_aout_buffer
;
mtime_t
play_time
=
0
;
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
_p_aout
;
float
*
p_buffer
=
(
float
*
)
_p_buffer
;
aout_sys_t
*
p_sys
=
(
aout_sys_t
*
)
p_aout
->
output
.
p_sys
;
/* FIXME (see above) */
vlc_mutex_lock
(
&
p_sys
->
lock
);
play_time
=
mdate
()
+
p_sys
->
latency
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
mtime_t
play_time
=
mdate
()
+
p_sys
->
p_latency
->
latency
;
p_aout_buffer
=
aout_OutputNextBuffer
(
p_aout
,
play_time
,
VLC_FALSE
);
aout_buffer_t
*
p_aout_buffer
=
aout_OutputNextBuffer
(
p_aout
,
play_time
,
VLC_FALSE
);
if
(
p_aout_buffer
!=
NULL
)
{
p_aout
->
p_vlc
->
pf_memcpy
(
(
float
*
)
p_buffer
,
p_aout_buffer
->
p_buffer
,
i_size
);
p_aout
->
p_vlc
->
pf_memcpy
(
p_buffer
,
p_aout_buffer
->
p_buffer
,
i_size
);
aout_BufferFree
(
p_aout_buffer
);
}
else
{
p_aout
->
p_vlc
->
pf_memset
(
(
float
*
)
p_buffer
,
0
,
i_size
);
p_aout
->
p_vlc
->
pf_memset
(
p_buffer
,
0
,
i_size
);
}
}
...
...
@@ -196,26 +201,11 @@ static void DoNothing( aout_instance_t *p_aout )
/*****************************************************************************
* CheckLatency
*****************************************************************************/
static
int
CheckLatency
(
aout_instance_t
*
p_aout
)
static
int
CheckLatency
(
latency_t
*
p_latency
)
{
aout_sys_t
*
p_sys
=
(
aout_sys_t
*
)
p_aout
->
output
.
p_sys
;
mtime_t
last_check
=
0
;
mtime_t
latency
;
while
(
!
p_aout
->
b_die
)
while
(
!
p_latency
->
b_die
)
{
/* check every 0.1 second */
if
(
mdate
()
>
last_check
+
100000
)
{
latency
=
p_sys
->
p_player
->
Latency
();
if
(
latency
>
0
)
{
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
latency
=
latency
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
}
last_check
=
mdate
();
}
p_latency
->
latency
=
p_latency
->
p_player
->
Latency
();
snooze
(
5000
);
}
return
VLC_SUCCESS
;
...
...
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