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
4c04bf3e
Commit
4c04bf3e
authored
Jun 07, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/audio_output/directx.c: backport of 11335.
parent
5ecedd59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
5 deletions
+75
-5
modules/audio_output/directx.c
modules/audio_output/directx.c
+75
-5
No files found.
modules/audio_output/directx.c
View file @
4c04bf3e
...
...
@@ -152,6 +152,10 @@ typedef struct notification_thread_t
struct
aout_sys_t
{
HINSTANCE
hdsound_dll
;
/* handle of the opened dsound dll */
int
i_device_id
;
/* user defined device */
LPGUID
p_device_guid
;
LPDIRECTSOUND
p_dsobject
;
/* main Direct Sound object */
LPDIRECTSOUNDBUFFER
p_dsbuffer
;
/* the sound buffer we use (direct sound
* takes care of mixing all the
...
...
@@ -206,6 +210,15 @@ static int FillBuffer ( aout_instance_t *, int, aout_buffer_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define DEVICE_TEXT N_("Output device")
#define DEVICE_LONGTEXT N_( \
"DirectX device number: 0 default device, 1..N device by number" \
"(Note that the default device appears as 0 AND another number)." )
#define FLOAT_TEXT N_("Use float32 output")
#define FLOAT_LONGTEXT N_( \
"The option allows you to enable or disable the high-quality float32 " \
"audio output mode (which is not well supported by some soundcards)." )
vlc_module_begin
();
set_description
(
_
(
"DirectX audio output"
)
);
set_shortname
(
"DirectX"
);
...
...
@@ -213,6 +226,10 @@ vlc_module_begin();
set_category
(
CAT_AUDIO
);
set_subcategory
(
SUBCAT_AUDIO_AOUT
);
add_shortcut
(
"directx"
);
add_integer
(
"directx-audio-device"
,
0
,
NULL
,
DEVICE_TEXT
,
DEVICE_LONGTEXT
,
VLC_TRUE
);
add_bool
(
"directx-audio-float32"
,
1
,
0
,
FLOAT_TEXT
,
FLOAT_LONGTEXT
,
VLC_TRUE
);
set_callbacks
(
OpenAudio
,
CloseAudio
);
vlc_module_end
();
...
...
@@ -247,6 +264,15 @@ static int OpenAudio( vlc_object_t *p_this )
p_aout
->
output
.
pf_play
=
Play
;
aout_VolumeSoftInit
(
p_aout
);
/* Retrieve config values */
var_Create
(
p_aout
,
"directx-audio-float32"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_aout
,
"directx-audio-device"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_aout
,
"directx-audio-device"
,
&
val
);
p_aout
->
output
.
p_sys
->
i_device_id
=
val
.
i_int
;
p_aout
->
output
.
p_sys
->
p_device_guid
=
0
;
/* Initialise DirectSound */
if
(
InitDirectSound
(
p_aout
)
)
{
...
...
@@ -590,15 +616,40 @@ static void CloseAudio( vlc_object_t *p_this )
/* free DSOUND.DLL */
if
(
p_sys
->
hdsound_dll
)
FreeLibrary
(
p_sys
->
hdsound_dll
);
if
(
p_aout
->
output
.
p_sys
->
p_device_guid
)
free
(
p_aout
->
output
.
p_sys
->
p_device_guid
);
free
(
p_sys
);
}
/*****************************************************************************
* CallBackDirectSoundEnum: callback to enumerate available devices
*****************************************************************************/
static
int
CALLBACK
CallBackDirectSoundEnum
(
LPGUID
p_guid
,
LPCSTR
psz_desc
,
LPCSTR
psz_mod
,
LPVOID
_p_aout
)
{
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
_p_aout
;
msg_Dbg
(
p_aout
,
"found device: %s"
,
psz_desc
);
if
(
p_aout
->
output
.
p_sys
->
i_device_id
==
0
&&
p_guid
)
{
p_aout
->
output
.
p_sys
->
p_device_guid
=
malloc
(
sizeof
(
GUID
)
);
*
p_aout
->
output
.
p_sys
->
p_device_guid
=
*
p_guid
;
msg_Dbg
(
p_aout
,
"using device: %s"
,
psz_desc
);
}
p_aout
->
output
.
p_sys
->
i_device_id
--
;
return
1
;
}
/*****************************************************************************
* InitDirectSound: handle all the gory details of DirectSound initialisation
*****************************************************************************/
static
int
InitDirectSound
(
aout_instance_t
*
p_aout
)
{
HRESULT
(
WINAPI
*
OurDirectSoundCreate
)(
LPGUID
,
LPDIRECTSOUND
*
,
LPUNKNOWN
);
HRESULT
(
WINAPI
*
OurDirectSoundEnumerate
)(
LPDSENUMCALLBACK
,
LPVOID
);
p_aout
->
output
.
p_sys
->
hdsound_dll
=
LoadLibrary
(
"DSOUND.DLL"
);
if
(
p_aout
->
output
.
p_sys
->
hdsound_dll
==
NULL
)
...
...
@@ -607,17 +658,32 @@ static int InitDirectSound( aout_instance_t *p_aout )
goto
error
;
}
OurDirectSoundCreate
=
(
void
*
)
GetProcAddress
(
p_aout
->
output
.
p_sys
->
hdsound_dll
,
"DirectSoundCreate"
);
OurDirectSoundCreate
=
(
void
*
)
GetProcAddress
(
p_aout
->
output
.
p_sys
->
hdsound_dll
,
"DirectSoundCreate"
);
if
(
OurDirectSoundCreate
==
NULL
)
{
msg_Warn
(
p_aout
,
"GetProcAddress FAILED"
);
goto
error
;
}
/* Get DirectSoundEnumerate */
OurDirectSoundEnumerate
=
(
void
*
)
GetProcAddress
(
p_aout
->
output
.
p_sys
->
hdsound_dll
,
"DirectSoundEnumerateA"
);
if
(
OurDirectSoundEnumerate
)
{
/* Attempt enumeration */
if
(
FAILED
(
OurDirectSoundEnumerate
(
CallBackDirectSoundEnum
,
p_aout
)
)
)
{
msg_Dbg
(
p_aout
,
"enumeration of DirectSound devices failed"
);
}
}
/* Create the direct sound object */
if
FAILED
(
OurDirectSoundCreate
(
NULL
,
&
p_aout
->
output
.
p_sys
->
p_dsobject
,
if
FAILED
(
OurDirectSoundCreate
(
p_aout
->
output
.
p_sys
->
p_device_guid
,
&
p_aout
->
output
.
p_sys
->
p_dsobject
,
NULL
)
)
{
msg_Warn
(
p_aout
,
"cannot create a direct sound device"
);
...
...
@@ -839,9 +905,13 @@ static int CreateDSBufferPCM( aout_instance_t *p_aout, int *i_format,
int
i_channels
,
int
i_nb_channels
,
int
i_rate
,
vlc_bool_t
b_probe
)
{
vlc_value_t
val
;
var_Get
(
p_aout
,
"directx-audio-float32"
,
&
val
);
/* Float32 audio samples are not supported for 5.1 output on the emu101k */
if
(
i_nb_channels
>
2
||
if
(
!
val
.
b_bool
||
i_nb_channels
>
2
||
CreateDSBuffer
(
p_aout
,
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
),
i_channels
,
i_nb_channels
,
i_rate
,
FRAME_SIZE
*
4
*
i_nb_channels
,
b_probe
)
...
...
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