Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
d30534b0
Commit
d30534b0
authored
May 22, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted aout directx to vlc_clone().
parent
2cb994d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
modules/audio_output/directx.c
modules/audio_output/directx.c
+21
-21
No files found.
modules/audio_output/directx.c
View file @
d30534b0
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_aout.h>
#include <vlc_charset.h>
#include <vlc_charset.h>
#include <vlc_atomic.h>
#include "windows_audio_common.h"
#include "windows_audio_common.h"
...
@@ -43,8 +44,6 @@
...
@@ -43,8 +44,6 @@
*****************************************************************************/
*****************************************************************************/
typedef
struct
notification_thread_t
typedef
struct
notification_thread_t
{
{
VLC_COMMON_MEMBERS
aout_instance_t
*
p_aout
;
aout_instance_t
*
p_aout
;
int
i_frame_size
;
/* size in bytes of one frame */
int
i_frame_size
;
/* size in bytes of one frame */
int
i_write_slot
;
/* current write position in our circular buffer */
int
i_write_slot
;
/* current write position in our circular buffer */
...
@@ -52,6 +51,9 @@ typedef struct notification_thread_t
...
@@ -52,6 +51,9 @@ typedef struct notification_thread_t
mtime_t
start_date
;
mtime_t
start_date
;
HANDLE
event
;
HANDLE
event
;
vlc_thread_t
thread
;
vlc_atomic_t
abort
;
}
notification_thread_t
;
}
notification_thread_t
;
/*****************************************************************************
/*****************************************************************************
...
@@ -100,7 +102,7 @@ static int InitDirectSound ( aout_instance_t * );
...
@@ -100,7 +102,7 @@ static int InitDirectSound ( aout_instance_t * );
static
int
CreateDSBuffer
(
aout_instance_t
*
,
int
,
int
,
int
,
int
,
int
,
bool
);
static
int
CreateDSBuffer
(
aout_instance_t
*
,
int
,
int
,
int
,
int
,
int
,
bool
);
static
int
CreateDSBufferPCM
(
aout_instance_t
*
,
vlc_fourcc_t
*
,
int
,
int
,
int
,
bool
);
static
int
CreateDSBufferPCM
(
aout_instance_t
*
,
vlc_fourcc_t
*
,
int
,
int
,
int
,
bool
);
static
void
DestroyDSBuffer
(
aout_instance_t
*
);
static
void
DestroyDSBuffer
(
aout_instance_t
*
);
static
void
*
DirectSoundThread
(
v
lc_object_t
*
);
static
void
*
DirectSoundThread
(
v
oid
*
);
static
int
FillBuffer
(
aout_instance_t
*
,
int
,
aout_buffer_t
*
);
static
int
FillBuffer
(
aout_instance_t
*
,
int
,
aout_buffer_t
*
);
static
int
ReloadDirectXDevices
(
vlc_object_t
*
,
char
const
*
,
static
int
ReloadDirectXDevices
(
vlc_object_t
*
,
char
const
*
,
...
@@ -300,29 +302,27 @@ static int OpenAudio( vlc_object_t *p_this )
...
@@ -300,29 +302,27 @@ static int OpenAudio( vlc_object_t *p_this )
}
}
/* Now we need to setup our DirectSound play notification structure */
/* Now we need to setup our DirectSound play notification structure */
p_aout
->
output
.
p_sys
->
p_notif
=
p_aout
->
output
.
p_sys
->
p_notif
=
calloc
(
1
,
sizeof
(
*
p_aout
->
output
.
p_sys
->
p_notif
)
);
vlc_object_create
(
p_aout
,
sizeof
(
notification_thread_t
)
);
p_aout
->
output
.
p_sys
->
p_notif
->
p_aout
=
p_aout
;
p_aout
->
output
.
p_sys
->
p_notif
->
p_aout
=
p_aout
;
vlc_atomic_set
(
&
p_aout
->
output
.
p_sys
->
p_notif
->
abort
,
0
);
p_aout
->
output
.
p_sys
->
p_notif
->
event
=
CreateEvent
(
0
,
FALSE
,
FALSE
,
0
);
p_aout
->
output
.
p_sys
->
p_notif
->
event
=
CreateEvent
(
0
,
FALSE
,
FALSE
,
0
);
p_aout
->
output
.
p_sys
->
p_notif
->
i_frame_size
=
p_aout
->
output
.
p_sys
->
p_notif
->
i_frame_size
=
p_aout
->
output
.
p_sys
->
i_frame_size
;
p_aout
->
output
.
p_sys
->
i_frame_size
;
/* then launch the notification thread */
/* then launch the notification thread */
msg_Dbg
(
p_aout
,
"creating DirectSoundThread"
);
msg_Dbg
(
p_aout
,
"creating DirectSoundThread"
);
if
(
vlc_
thread_create
(
p_aout
->
output
.
p_sys
->
p_notif
,
if
(
vlc_
clone
(
&
p_aout
->
output
.
p_sys
->
p_notif
->
thread
,
DirectSoundThread
,
DirectSoundThread
,
p_aout
->
output
.
p_sys
->
p_notif
,
VLC_THREAD_PRIORITY_HIGHEST
)
)
VLC_THREAD_PRIORITY_HIGHEST
)
)
{
{
msg_Err
(
p_aout
,
"cannot create DirectSoundThread"
);
msg_Err
(
p_aout
,
"cannot create DirectSoundThread"
);
CloseHandle
(
p_aout
->
output
.
p_sys
->
p_notif
->
event
);
CloseHandle
(
p_aout
->
output
.
p_sys
->
p_notif
->
event
);
vlc_object_releas
e
(
p_aout
->
output
.
p_sys
->
p_notif
);
fre
e
(
p_aout
->
output
.
p_sys
->
p_notif
);
p_aout
->
output
.
p_sys
->
p_notif
=
NULL
;
p_aout
->
output
.
p_sys
->
p_notif
=
NULL
;
goto
error
;
goto
error
;
}
}
vlc_object_attach
(
p_aout
->
output
.
p_sys
->
p_notif
,
p_aout
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
...
@@ -607,12 +607,12 @@ static void CloseAudio( vlc_object_t *p_this )
...
@@ -607,12 +607,12 @@ static void CloseAudio( vlc_object_t *p_this )
/* kill the position notification thread, if any */
/* kill the position notification thread, if any */
if
(
p_sys
->
p_notif
)
if
(
p_sys
->
p_notif
)
{
{
vlc_
object_kill
(
p_sys
->
p_notif
);
vlc_
atomic_set
(
&
p_aout
->
output
.
p_sys
->
p_notif
->
abort
,
1
);
/* wake up the audio thread if needed */
/* wake up the audio thread if needed */
if
(
!
p_sys
->
b_playing
)
SetEvent
(
p_sys
->
p_notif
->
event
);
if
(
!
p_sys
->
b_playing
)
SetEvent
(
p_sys
->
p_notif
->
event
);
vlc_
thread_join
(
p_sys
->
p_notif
);
vlc_
join
(
p_sys
->
p_notif
->
thread
,
NULL
);
vlc_object_releas
e
(
p_sys
->
p_notif
);
fre
e
(
p_sys
->
p_notif
);
}
}
/* release the secondary buffer */
/* release the secondary buffer */
...
@@ -972,7 +972,7 @@ static int FillBuffer( aout_instance_t *p_aout, int i_frame,
...
@@ -972,7 +972,7 @@ static int FillBuffer( aout_instance_t *p_aout, int i_frame,
}
}
if
(
dsresult
!=
DS_OK
)
if
(
dsresult
!=
DS_OK
)
{
{
msg_Warn
(
p_
notif
,
"cannot lock buffer"
);
msg_Warn
(
p_
aout
,
"cannot lock buffer"
);
if
(
p_buffer
)
aout_BufferFree
(
p_buffer
);
if
(
p_buffer
)
aout_BufferFree
(
p_buffer
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -1009,9 +1009,9 @@ static int FillBuffer( aout_instance_t *p_aout, int i_frame,
...
@@ -1009,9 +1009,9 @@ static int FillBuffer( aout_instance_t *p_aout, int i_frame,
* We use this thread to emulate a callback mechanism. The thread probes for
* We use this thread to emulate a callback mechanism. The thread probes for
* event notification and fills up the DS secondary buffer when needed.
* event notification and fills up the DS secondary buffer when needed.
*****************************************************************************/
*****************************************************************************/
static
void
*
DirectSoundThread
(
v
lc_object_t
*
p_this
)
static
void
*
DirectSoundThread
(
v
oid
*
data
)
{
{
notification_thread_t
*
p_notif
=
(
notification_thread_t
*
)
p_this
;
notification_thread_t
*
p_notif
=
(
notification_thread_t
*
)
data
;
aout_instance_t
*
p_aout
=
p_notif
->
p_aout
;
aout_instance_t
*
p_aout
=
p_notif
->
p_aout
;
mtime_t
last_time
;
mtime_t
last_time
;
int
canc
=
vlc_savecancel
();
int
canc
=
vlc_savecancel
();
...
@@ -1019,12 +1019,12 @@ static void* DirectSoundThread( vlc_object_t *p_this )
...
@@ -1019,12 +1019,12 @@ static void* DirectSoundThread( vlc_object_t *p_this )
/* We don't want any resampling when using S/PDIF output */
/* We don't want any resampling when using S/PDIF output */
bool
b_sleek
=
(
p_aout
->
output
.
output
.
i_format
==
VLC_CODEC_SPDIFL
);
bool
b_sleek
=
(
p_aout
->
output
.
output
.
i_format
==
VLC_CODEC_SPDIFL
);
msg_Dbg
(
p_
notif
,
"DirectSoundThread ready"
);
msg_Dbg
(
p_
aout
,
"DirectSoundThread ready"
);
/* Wait here until Play() is called */
/* Wait here until Play() is called */
WaitForSingleObject
(
p_notif
->
event
,
INFINITE
);
WaitForSingleObject
(
p_notif
->
event
,
INFINITE
);
if
(
vlc_object_alive
(
p_notif
)
)
if
(
!
vlc_atomic_get
(
&
p_notif
->
abort
)
)
{
{
HRESULT
dsresult
;
HRESULT
dsresult
;
mwait
(
p_notif
->
start_date
-
AOUT_PTS_TOLERANCE
/
2
);
mwait
(
p_notif
->
start_date
-
AOUT_PTS_TOLERANCE
/
2
);
...
@@ -1050,7 +1050,7 @@ static void* DirectSoundThread( vlc_object_t *p_this )
...
@@ -1050,7 +1050,7 @@ static void* DirectSoundThread( vlc_object_t *p_this )
}
}
last_time
=
mdate
();
last_time
=
mdate
();
while
(
vlc_object_alive
(
p_notif
)
)
while
(
!
vlc_atomic_get
(
&
p_notif
->
abort
)
)
{
{
DWORD
l_read
;
DWORD
l_read
;
int
l_queued
=
0
,
l_free_slots
;
int
l_queued
=
0
,
l_free_slots
;
...
@@ -1111,7 +1111,7 @@ static void* DirectSoundThread( vlc_object_t *p_this )
...
@@ -1111,7 +1111,7 @@ static void* DirectSoundThread( vlc_object_t *p_this )
CloseHandle
(
p_notif
->
event
);
CloseHandle
(
p_notif
->
event
);
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
msg_Dbg
(
p_
notif
,
"DirectSoundThread exiting"
);
msg_Dbg
(
p_
aout
,
"DirectSoundThread exiting"
);
return
NULL
;
return
NULL
;
}
}
...
...
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