1 /*****************************************************************************
2 * mmdevice.h : Windows Multimedia Device API audio output plugin for VLC
3 *****************************************************************************
4 * Copyright (C) 2012 RĂ©mi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_AOUT_MMDEVICE_H
22 # define VLC_AOUT_MMDEVICE_H 1
24 #define MM_PASSTHROUGH_DISABLED 0
25 #define MM_PASSTHROUGH_ENABLED 1
26 #define MM_PASSTHROUGH_ENABLED_HD 2
27 #define MM_PASSTHROUGH_DEFAULT MM_PASSTHROUGH_DISABLED
29 typedef struct aout_stream aout_stream_t
;
32 * Audio output simplified API for Windows
36 struct vlc_common_members obj
;
39 HRESULT (*time_get
)(aout_stream_t
*, vlc_tick_t
*);
40 HRESULT (*play
)(aout_stream_t
*, block_t
*);
41 HRESULT (*pause
)(aout_stream_t
*, bool);
42 HRESULT (*flush
)(aout_stream_t
*);
47 HRESULT (*activate
)(void *device
, REFIID
, PROPVARIANT
*, void **);
52 * Creates an audio output stream on a given Windows multimedia device.
53 * \param s audio output stream object to be initialized
54 * \param fmt audio output sample format [IN/OUT]
55 * \param sid audio output session GUID [IN]
57 typedef HRESULT (*aout_stream_start_t
)(aout_stream_t
*s
,
58 audio_sample_format_t
*fmt
, const GUID
*sid
);
61 * Destroys an audio output stream.
63 typedef HRESULT (*aout_stream_stop_t
)(aout_stream_t
*);
65 static inline HRESULT
aout_stream_TimeGet(aout_stream_t
*s
, vlc_tick_t
*delay
)
67 return (s
->time_get
)(s
, delay
);
70 static inline HRESULT
aout_stream_Play(aout_stream_t
*s
, block_t
*block
)
72 return (s
->play
)(s
, block
);
75 static inline HRESULT
aout_stream_Pause(aout_stream_t
*s
, bool paused
)
77 return (s
->pause
)(s
, paused
);
80 static inline HRESULT
aout_stream_Flush(aout_stream_t
*s
, bool wait
)
83 { /* Loosy drain emulation */
86 if (SUCCEEDED(aout_stream_TimeGet(s
, &delay
))
87 && delay
<= INT64_C(5000000))
88 Sleep(MS_FROM_VLC_TICK( delay
) + 1);
96 HRESULT
aout_stream_Activate(aout_stream_t
*s
, REFIID iid
,
97 PROPVARIANT
*actparms
, void **pv
)
99 return s
->owner
.activate(s
->owner
.device
, iid
, actparms
, pv
);