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
9b3216c8
Commit
9b3216c8
authored
May 21, 2002
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ./plugins/directx/aout_directx.c: fixed compile warnings.
parent
d4a50a34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
71 deletions
+71
-71
plugins/directx/aout_directx.c
plugins/directx/aout_directx.c
+71
-71
No files found.
plugins/directx/aout_directx.c
View file @
9b3216c8
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* aout_directx.c: Windows DirectX audio output method
* aout_directx.c: Windows DirectX audio output method
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: aout_directx.c,v 1.2
0 2002/02/24 22:06:50 sam
Exp $
* $Id: aout_directx.c,v 1.2
1 2002/05/21 07:48:50 gbazin
Exp $
*
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
*
...
@@ -68,12 +68,12 @@ typedef struct aout_sys_s
...
@@ -68,12 +68,12 @@ typedef struct aout_sys_s
HINSTANCE
hdsound_dll
;
/* handle of the opened dsound dll */
HINSTANCE
hdsound_dll
;
/* handle of the opened dsound dll */
int
i_buffer_size
;
/* secondary sound buffer size */
long
l_buffer_size
;
/* secondary sound buffer size */
int
i_write_position
;
/* next write position for the buffer */
long
l_write_position
;
/* next write position for the buffer */
volatile
boolean_t
b_buffer_underflown
;
/* buffer underflow detection */
volatile
boolean_t
b_buffer_underflown
;
/* buffer underflow detection */
volatile
int
i_data_played_from_beginning
;
/* for underflow detection */
volatile
long
l_data_played_from_beginning
;
/* for underflow detection */
volatile
int
i_data_written_from_beginning
;
/* for underflow detection */
volatile
long
l_data_written_from_beginning
;
/* for underflow detection */
vlc_mutex_t
buffer_lock
;
/* audio buffer lock */
vlc_mutex_t
buffer_lock
;
/* audio buffer lock */
...
@@ -141,8 +141,8 @@ static int aout_Open( aout_thread_t *p_aout )
...
@@ -141,8 +141,8 @@ static int aout_Open( aout_thread_t *p_aout )
p_aout
->
p_sys
->
p_dsbuffer
=
NULL
;
p_aout
->
p_sys
->
p_dsbuffer
=
NULL
;
p_aout
->
p_sys
->
p_dsnotify
=
NULL
;
p_aout
->
p_sys
->
p_dsnotify
=
NULL
;
p_aout
->
p_sys
->
b_notification_thread_die
=
0
;
p_aout
->
p_sys
->
b_notification_thread_die
=
0
;
p_aout
->
p_sys
->
i
_data_written_from_beginning
=
0
;
p_aout
->
p_sys
->
l
_data_written_from_beginning
=
0
;
p_aout
->
p_sys
->
i
_data_played_from_beginning
=
0
;
p_aout
->
p_sys
->
l
_data_played_from_beginning
=
0
;
vlc_mutex_init
(
&
p_aout
->
p_sys
->
buffer_lock
);
vlc_mutex_init
(
&
p_aout
->
p_sys
->
buffer_lock
);
...
@@ -205,7 +205,7 @@ static int aout_SetFormat( aout_thread_t *p_aout )
...
@@ -205,7 +205,7 @@ static int aout_SetFormat( aout_thread_t *p_aout )
{
{
HRESULT
dsresult
;
HRESULT
dsresult
;
WAVEFORMATEX
*
p_waveformat
;
WAVEFORMATEX
*
p_waveformat
;
unsigned
int
i_size_struct
;
unsigned
long
i_size_struct
;
intf_WarnMsg
(
3
,
"aout: DirectX aout_SetFormat "
);
intf_WarnMsg
(
3
,
"aout: DirectX aout_SetFormat "
);
...
@@ -273,7 +273,7 @@ static int aout_SetFormat( aout_thread_t *p_aout )
...
@@ -273,7 +273,7 @@ static int aout_SetFormat( aout_thread_t *p_aout )
*****************************************************************************/
*****************************************************************************/
static
int
aout_GetBufInfo
(
aout_thread_t
*
p_aout
,
int
i_buffer_limit
)
static
int
aout_GetBufInfo
(
aout_thread_t
*
p_aout
,
int
i_buffer_limit
)
{
{
int
i_play_position
,
i_notused
,
i
_result
;
long
l_play_position
,
l_notused
,
l
_result
;
HRESULT
dsresult
;
HRESULT
dsresult
;
if
(
p_aout
->
p_sys
->
b_buffer_underflown
)
if
(
p_aout
->
p_sys
->
b_buffer_underflown
)
...
@@ -283,22 +283,22 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit )
...
@@ -283,22 +283,22 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit )
}
}
dsresult
=
IDirectSoundBuffer_GetCurrentPosition
(
p_aout
->
p_sys
->
p_dsbuffer
,
dsresult
=
IDirectSoundBuffer_GetCurrentPosition
(
p_aout
->
p_sys
->
p_dsbuffer
,
&
i_play_position
,
&
i
_notused
);
&
l_play_position
,
&
l
_notused
);
if
(
dsresult
!=
DS_OK
)
if
(
dsresult
!=
DS_OK
)
{
{
intf_WarnMsg
(
3
,
"aout: DirectX aout_GetBufInfo cannot get current pos"
);
intf_WarnMsg
(
3
,
"aout: DirectX aout_GetBufInfo cannot get current pos"
);
return
(
i_buffer_limit
);
return
(
i_buffer_limit
);
}
}
i_result
=
(
p_aout
->
p_sys
->
i_write_position
>=
i
_play_position
)
?
l_result
=
(
p_aout
->
p_sys
->
l_write_position
>=
l
_play_position
)
?
(
p_aout
->
p_sys
->
i_write_position
-
i
_play_position
)
(
p_aout
->
p_sys
->
l_write_position
-
l
_play_position
)
:
(
p_aout
->
p_sys
->
i_buffer_size
-
i
_play_position
:
(
p_aout
->
p_sys
->
l_buffer_size
-
l
_play_position
+
p_aout
->
p_sys
->
i
_write_position
);
+
p_aout
->
p_sys
->
l
_write_position
);
#if 0
#if 0
intf_WarnMsg( 3, "aout: DirectX aout_GetBufInfo: %
i", i
_result);
intf_WarnMsg( 3, "aout: DirectX aout_GetBufInfo: %
li", l
_result);
#endif
#endif
return
i
_result
;
return
l
_result
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -310,7 +310,7 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit )
...
@@ -310,7 +310,7 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit )
static
void
aout_Play
(
aout_thread_t
*
p_aout
,
byte_t
*
buffer
,
int
i_size
)
static
void
aout_Play
(
aout_thread_t
*
p_aout
,
byte_t
*
buffer
,
int
i_size
)
{
{
VOID
*
p_write_position
,
*
p_start_buffer
;
VOID
*
p_write_position
,
*
p_start_buffer
;
int
i_bytes1
,
i_bytes2
,
i
_play_position
;
long
l_bytes1
,
l_bytes2
,
l
_play_position
;
HRESULT
dsresult
;
HRESULT
dsresult
;
/* protect buffer access (because of DirectSoundThread) */
/* protect buffer access (because of DirectSoundThread) */
...
@@ -322,30 +322,30 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
...
@@ -322,30 +322,30 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
* as soon as possible. This is why we query the play position */
* as soon as possible. This is why we query the play position */
dsresult
=
IDirectSoundBuffer_GetCurrentPosition
(
dsresult
=
IDirectSoundBuffer_GetCurrentPosition
(
p_aout
->
p_sys
->
p_dsbuffer
,
p_aout
->
p_sys
->
p_dsbuffer
,
&
i
_play_position
,
&
l
_play_position
,
&
p_aout
->
p_sys
->
i
_write_position
);
&
p_aout
->
p_sys
->
l
_write_position
);
if
(
dsresult
!=
DS_OK
)
if
(
dsresult
!=
DS_OK
)
{
{
intf_WarnMsg
(
3
,
"aout: aout_Play can'get buffer position"
);
intf_WarnMsg
(
3
,
"aout: aout_Play can'get buffer position"
);
p_aout
->
p_sys
->
i
_write_position
=
0
;
p_aout
->
p_sys
->
l
_write_position
=
0
;
}
}
intf_WarnMsg
(
3
,
"aout: aout_Play underflow"
);
intf_WarnMsg
(
3
,
"aout: aout_Play underflow"
);
/* reinitialise the underflow detection counters */
/* reinitialise the underflow detection counters */
p_aout
->
p_sys
->
b_buffer_underflown
=
0
;
p_aout
->
p_sys
->
b_buffer_underflown
=
0
;
p_aout
->
p_sys
->
i
_data_written_from_beginning
=
0
;
p_aout
->
p_sys
->
l
_data_written_from_beginning
=
0
;
#define WRITE_P p_aout->p_sys->
i
_write_position
#define WRITE_P p_aout->p_sys->
l
_write_position
#define PLAY_P
i
_play_position
#define PLAY_P
l
_play_position
#define BUF_SIZE p_aout->p_sys->
i
_buffer_size
#define BUF_SIZE p_aout->p_sys->
l
_buffer_size
p_aout
->
p_sys
->
i
_data_played_from_beginning
=
-
(
WRITE_P
%
(
BUF_SIZE
/
2
));
p_aout
->
p_sys
->
l
_data_played_from_beginning
=
-
(
WRITE_P
%
(
BUF_SIZE
/
2
));
if
(
PLAY_P
<
BUF_SIZE
/
2
&&
WRITE_P
>
BUF_SIZE
/
2
)
if
(
PLAY_P
<
BUF_SIZE
/
2
&&
WRITE_P
>
BUF_SIZE
/
2
)
{
{
p_aout
->
p_sys
->
i
_data_played_from_beginning
-=
(
BUF_SIZE
/
2
);
p_aout
->
p_sys
->
l
_data_played_from_beginning
-=
(
BUF_SIZE
/
2
);
}
}
if
(
PLAY_P
>
BUF_SIZE
/
2
&&
WRITE_P
<
BUF_SIZE
/
2
)
if
(
PLAY_P
>
BUF_SIZE
/
2
&&
WRITE_P
<
BUF_SIZE
/
2
)
{
{
p_aout
->
p_sys
->
i
_data_played_from_beginning
-=
(
BUF_SIZE
/
2
);
p_aout
->
p_sys
->
l
_data_played_from_beginning
-=
(
BUF_SIZE
/
2
);
}
}
#undef WRITE_P
#undef WRITE_P
#undef PLAY_P
#undef PLAY_P
...
@@ -354,23 +354,23 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
...
@@ -354,23 +354,23 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
/* Before copying anything, we have to lock the buffer */
/* Before copying anything, we have to lock the buffer */
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
p_aout
->
p_sys
->
i
_write_position
,
/* Offset of lock start */
p_aout
->
p_sys
->
l
_write_position
,
/* Offset of lock start */
i_size
,
/* Number of bytes to lock */
i_size
,
/* Number of bytes to lock */
&
p_write_position
,
/* Address of lock start */
&
p_write_position
,
/* Address of lock start */
&
i
_bytes1
,
/* Count of bytes locked before wrap around */
&
l
_bytes1
,
/* Count of bytes locked before wrap around */
&
p_start_buffer
,
/* Buffer adress (if wrap around) */
&
p_start_buffer
,
/* Buffer adress (if wrap around) */
&
i
_bytes2
,
/* Count of bytes after wrap around */
&
l
_bytes2
,
/* Count of bytes after wrap around */
0
);
/* Flags */
0
);
/* Flags */
if
(
dsresult
==
DSERR_BUFFERLOST
)
if
(
dsresult
==
DSERR_BUFFERLOST
)
{
{
IDirectSoundBuffer_Restore
(
p_aout
->
p_sys
->
p_dsbuffer
);
IDirectSoundBuffer_Restore
(
p_aout
->
p_sys
->
p_dsbuffer
);
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
p_aout
->
p_sys
->
i
_write_position
,
p_aout
->
p_sys
->
l
_write_position
,
i_size
,
i_size
,
&
p_write_position
,
&
p_write_position
,
&
i
_bytes1
,
&
l
_bytes1
,
&
p_start_buffer
,
&
p_start_buffer
,
&
i
_bytes2
,
&
l
_bytes2
,
0
);
0
);
}
}
...
@@ -382,20 +382,20 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
...
@@ -382,20 +382,20 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
}
}
/* Now do the actual memcpy (two memcpy because the buffer is circular) */
/* Now do the actual memcpy (two memcpy because the buffer is circular) */
memcpy
(
p_write_position
,
buffer
,
i
_bytes1
);
memcpy
(
p_write_position
,
buffer
,
l
_bytes1
);
if
(
p_start_buffer
!=
NULL
)
if
(
p_start_buffer
!=
NULL
)
{
{
memcpy
(
p_start_buffer
,
buffer
+
i_bytes1
,
i
_bytes2
);
memcpy
(
p_start_buffer
,
buffer
+
l_bytes1
,
l
_bytes2
);
}
}
/* Now the data has been copied, unlock the buffer */
/* Now the data has been copied, unlock the buffer */
IDirectSoundBuffer_Unlock
(
p_aout
->
p_sys
->
p_dsbuffer
,
IDirectSoundBuffer_Unlock
(
p_aout
->
p_sys
->
p_dsbuffer
,
p_write_position
,
i_bytes1
,
p_start_buffer
,
i
_bytes2
);
p_write_position
,
l_bytes1
,
p_start_buffer
,
l
_bytes2
);
/* Update the write position index of the buffer*/
/* Update the write position index of the buffer*/
p_aout
->
p_sys
->
i
_write_position
+=
i_size
;
p_aout
->
p_sys
->
l
_write_position
+=
i_size
;
p_aout
->
p_sys
->
i_write_position
%=
p_aout
->
p_sys
->
i
_buffer_size
;
p_aout
->
p_sys
->
l_write_position
%=
p_aout
->
p_sys
->
l
_buffer_size
;
p_aout
->
p_sys
->
i
_data_written_from_beginning
+=
i_size
;
p_aout
->
p_sys
->
l
_data_written_from_beginning
+=
i_size
;
vlc_mutex_unlock
(
&
p_aout
->
p_sys
->
buffer_lock
);
vlc_mutex_unlock
(
&
p_aout
->
p_sys
->
buffer_lock
);
...
@@ -574,11 +574,11 @@ static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout )
...
@@ -574,11 +574,11 @@ static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout )
memset
(
&
dsbcaps
,
0
,
sizeof
(
DSBCAPS
));
memset
(
&
dsbcaps
,
0
,
sizeof
(
DSBCAPS
));
dsbcaps
.
dwSize
=
sizeof
(
DSBCAPS
);
dsbcaps
.
dwSize
=
sizeof
(
DSBCAPS
);
IDirectSoundBuffer_GetCaps
(
p_aout
->
p_sys
->
p_dsbuffer
,
&
dsbcaps
);
IDirectSoundBuffer_GetCaps
(
p_aout
->
p_sys
->
p_dsbuffer
,
&
dsbcaps
);
p_aout
->
p_sys
->
i
_buffer_size
=
dsbcaps
.
dwBufferBytes
;
p_aout
->
p_sys
->
l
_buffer_size
=
dsbcaps
.
dwBufferBytes
;
p_aout
->
p_sys
->
i
_write_position
=
0
;
p_aout
->
p_sys
->
l
_write_position
=
0
;
intf_WarnMsg
(
3
,
"aout: DirectX DirectxCreateSecondaryBuffer: %i"
,
intf_WarnMsg
(
3
,
"aout: DirectX DirectxCreateSecondaryBuffer: %
l
i"
,
p_aout
->
p_sys
->
i
_buffer_size
);
p_aout
->
p_sys
->
l
_buffer_size
);
/* Now the secondary buffer is created, we need to setup its position
/* Now the secondary buffer is created, we need to setup its position
* notification */
* notification */
...
@@ -646,9 +646,9 @@ static void DirectSoundThread( aout_thread_t *p_aout )
...
@@ -646,9 +646,9 @@ static void DirectSoundThread( aout_thread_t *p_aout )
{
{
HANDLE
notification_events
[
2
];
HANDLE
notification_events
[
2
];
VOID
*
p_write_position
,
*
p_start_buffer
;
VOID
*
p_write_position
,
*
p_start_buffer
;
int
i_bytes1
,
i
_bytes2
;
long
l_bytes1
,
l
_bytes2
;
HRESULT
dsresult
;
HRESULT
dsresult
;
int
i_buffer_size
,
i_play_position
,
i
_data_in_buffer
;
long
l_buffer_size
,
l_play_position
,
l
_data_in_buffer
;
notification_events
[
0
]
=
p_aout
->
p_sys
->
notification_events
[
0
].
hEventNotify
;
notification_events
[
0
]
=
p_aout
->
p_sys
->
notification_events
[
0
].
hEventNotify
;
notification_events
[
1
]
=
p_aout
->
p_sys
->
notification_events
[
1
].
hEventNotify
;
notification_events
[
1
]
=
p_aout
->
p_sys
->
notification_events
[
1
].
hEventNotify
;
...
@@ -665,7 +665,7 @@ static void DirectSoundThread( aout_thread_t *p_aout )
...
@@ -665,7 +665,7 @@ static void DirectSoundThread( aout_thread_t *p_aout )
while
(
!
p_aout
->
p_sys
->
b_notification_thread_die
)
while
(
!
p_aout
->
p_sys
->
b_notification_thread_die
)
{
{
/* wait for the position notification */
/* wait for the position notification */
i
_play_position
=
WaitForMultipleObjects
(
2
,
notification_events
,
l
_play_position
=
WaitForMultipleObjects
(
2
,
notification_events
,
0
,
INFINITE
);
0
,
INFINITE
);
vlc_mutex_lock
(
&
p_aout
->
p_sys
->
buffer_lock
);
vlc_mutex_lock
(
&
p_aout
->
p_sys
->
buffer_lock
);
...
@@ -675,28 +675,28 @@ static void DirectSoundThread( aout_thread_t *p_aout )
...
@@ -675,28 +675,28 @@ static void DirectSoundThread( aout_thread_t *p_aout )
}
}
/* check for buffer underflow (bodge for wrap around) */
/* check for buffer underflow (bodge for wrap around) */
i_buffer_size
=
p_aout
->
p_sys
->
i
_buffer_size
;
l_buffer_size
=
p_aout
->
p_sys
->
l
_buffer_size
;
i_play_position
=
(
i_play_position
-
WAIT_OBJECT_0
)
*
i
_buffer_size
/
2
;
l_play_position
=
(
l_play_position
-
WAIT_OBJECT_0
)
*
l
_buffer_size
/
2
;
p_aout
->
p_sys
->
i_data_played_from_beginning
+=
(
i
_buffer_size
/
2
);
p_aout
->
p_sys
->
l_data_played_from_beginning
+=
(
l
_buffer_size
/
2
);
i_data_in_buffer
=
p_aout
->
p_sys
->
i
_data_written_from_beginning
-
l_data_in_buffer
=
p_aout
->
p_sys
->
l
_data_written_from_beginning
-
p_aout
->
p_sys
->
i
_data_played_from_beginning
;
p_aout
->
p_sys
->
l
_data_played_from_beginning
;
/* detect wrap-around */
/* detect wrap-around */
if
(
i_data_in_buffer
<
(
-
i
_buffer_size
/
2
)
)
if
(
l_data_in_buffer
<
(
-
l
_buffer_size
/
2
)
)
{
{
intf_WarnMsg
(
3
,
"aout: DirectSoundThread wrap around: %
i"
,
i
_data_in_buffer
);
intf_WarnMsg
(
3
,
"aout: DirectSoundThread wrap around: %
li"
,
l
_data_in_buffer
);
i_data_in_buffer
+=
i
_buffer_size
;
l_data_in_buffer
+=
l
_buffer_size
;
}
}
/* detect underflow */
/* detect underflow */
if
(
i
_data_in_buffer
<=
0
)
if
(
l
_data_in_buffer
<=
0
)
{
{
intf_WarnMsg
(
3
,
"aout: DirectSoundThread underflow: %li"
,
i
_data_in_buffer
);
intf_WarnMsg
(
3
,
"aout: DirectSoundThread underflow: %li"
,
l
_data_in_buffer
);
p_aout
->
p_sys
->
b_buffer_underflown
=
1
;
p_aout
->
p_sys
->
b_buffer_underflown
=
1
;
p_aout
->
p_sys
->
i
_write_position
=
p_aout
->
p_sys
->
l
_write_position
=
(
i_play_position
+
i_buffer_size
/
2
)
%
i
_buffer_size
;
(
l_play_position
+
l_buffer_size
/
2
)
%
l
_buffer_size
;
i_data_in_buffer
=
i
_buffer_size
/
2
;
l_data_in_buffer
=
l
_buffer_size
/
2
;
p_aout
->
p_sys
->
i_data_played_from_beginning
-=
(
i
_buffer_size
/
2
);
p_aout
->
p_sys
->
l_data_played_from_beginning
-=
(
l
_buffer_size
/
2
);
}
}
...
@@ -704,23 +704,23 @@ static void DirectSoundThread( aout_thread_t *p_aout )
...
@@ -704,23 +704,23 @@ static void DirectSoundThread( aout_thread_t *p_aout )
/* Before copying anything, we have to lock the buffer */
/* Before copying anything, we have to lock the buffer */
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
p_aout
->
p_sys
->
i
_write_position
,
/* Offset of lock start */
p_aout
->
p_sys
->
l
_write_position
,
/* Offset of lock start */
i_buffer_size
-
i
_data_in_buffer
,
/* Number of bytes */
l_buffer_size
-
l
_data_in_buffer
,
/* Number of bytes */
&
p_write_position
,
/* Address of lock start */
&
p_write_position
,
/* Address of lock start */
&
i
_bytes1
,
/* Count of bytes locked before wrap around */
&
l
_bytes1
,
/* Count of bytes locked before wrap around */
&
p_start_buffer
,
/* Buffer adress (if wrap around) */
&
p_start_buffer
,
/* Buffer adress (if wrap around) */
&
i
_bytes2
,
/* Count of bytes after wrap around */
&
l
_bytes2
,
/* Count of bytes after wrap around */
0
);
/* Flags */
0
);
/* Flags */
if
(
dsresult
==
DSERR_BUFFERLOST
)
if
(
dsresult
==
DSERR_BUFFERLOST
)
{
{
IDirectSoundBuffer_Restore
(
p_aout
->
p_sys
->
p_dsbuffer
);
IDirectSoundBuffer_Restore
(
p_aout
->
p_sys
->
p_dsbuffer
);
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
dsresult
=
IDirectSoundBuffer_Lock
(
p_aout
->
p_sys
->
p_dsbuffer
,
p_aout
->
p_sys
->
i
_write_position
,
p_aout
->
p_sys
->
l
_write_position
,
i_buffer_size
-
i
_data_in_buffer
,
l_buffer_size
-
l
_data_in_buffer
,
&
p_write_position
,
&
p_write_position
,
&
i
_bytes1
,
&
l
_bytes1
,
&
p_start_buffer
,
&
p_start_buffer
,
&
i
_bytes2
,
&
l
_bytes2
,
0
);
0
);
}
}
if
(
dsresult
!=
DS_OK
)
if
(
dsresult
!=
DS_OK
)
...
@@ -731,15 +731,15 @@ static void DirectSoundThread( aout_thread_t *p_aout )
...
@@ -731,15 +731,15 @@ static void DirectSoundThread( aout_thread_t *p_aout )
}
}
/* Now do the actual memcpy (two because the buffer is circular) */
/* Now do the actual memcpy (two because the buffer is circular) */
memset
(
p_write_position
,
0
,
i
_bytes1
);
memset
(
p_write_position
,
0
,
l
_bytes1
);
if
(
p_start_buffer
!=
NULL
)
if
(
p_start_buffer
!=
NULL
)
{
{
memset
(
p_start_buffer
,
0
,
i
_bytes2
);
memset
(
p_start_buffer
,
0
,
l
_bytes2
);
}
}
/* Now the data has been copied, unlock the buffer */
/* Now the data has been copied, unlock the buffer */
IDirectSoundBuffer_Unlock
(
p_aout
->
p_sys
->
p_dsbuffer
,
IDirectSoundBuffer_Unlock
(
p_aout
->
p_sys
->
p_dsbuffer
,
p_write_position
,
i_bytes1
,
p_start_buffer
,
i
_bytes2
);
p_write_position
,
l_bytes1
,
p_start_buffer
,
l
_bytes2
);
vlc_mutex_unlock
(
&
p_aout
->
p_sys
->
buffer_lock
);
vlc_mutex_unlock
(
&
p_aout
->
p_sys
->
buffer_lock
);
...
...
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