mfreadwrite/reader: Add missing allocation check (Coverity).
[wine/zf.git] / dlls / wmp / wmp_private.h
blobe1a1e036cd17add03d94ca269338c7313c2f5a45
1 /*
2 * Copyright 2014 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include "windows.h"
22 #include "wine/heap.h"
23 #include "ole2.h"
24 #include "dshow.h"
25 #include "wmp.h"
27 #define TID_LIST \
28 XIID(NULL) \
29 CTID(WindowsMediaPlayer)
31 typedef enum {
32 #define XIID(iface) iface ## _tid,
33 #define CTID(name) name ## _tid,
34 TID_LIST
35 #undef XIID
36 #undef CTID
37 LAST_tid
38 } typeinfo_id;
40 HRESULT get_typeinfo(typeinfo_id tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
42 typedef struct {
43 IConnectionPoint IConnectionPoint_iface;
45 IConnectionPointContainer *container;
47 IDispatch **sinks;
48 DWORD sinks_size;
50 IID iid;
51 } ConnectionPoint;
53 typedef struct {
54 IWMPMedia IWMPMedia_iface;
56 LONG ref;
58 WCHAR *url;
59 WCHAR *name;
61 DOUBLE duration;
62 } WMPMedia;
64 typedef struct {
65 IWMPPlaylist IWMPPlaylist_iface;
67 LONG ref;
68 LONG count;
70 WCHAR *url;
71 WCHAR *name;
72 } WMPPlaylist;
74 struct WindowsMediaPlayer {
75 IOleObject IOleObject_iface;
76 IProvideClassInfo2 IProvideClassInfo2_iface;
77 IPersistStreamInit IPersistStreamInit_iface;
78 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
79 IConnectionPointContainer IConnectionPointContainer_iface;
80 IOleControl IOleControl_iface;
81 IWMPPlayer4 IWMPPlayer4_iface;
82 IWMPPlayer IWMPPlayer_iface;
83 IWMPSettings IWMPSettings_iface;
84 IWMPControls IWMPControls_iface;
85 IWMPNetwork IWMPNetwork_iface;
87 LONG ref;
89 IOleClientSite *client_site;
90 HWND hwnd;
91 SIZEL extent;
93 /* Settings */
94 VARIANT_BOOL auto_start;
95 VARIANT_BOOL invoke_urls;
96 VARIANT_BOOL enable_error_dialogs;
97 LONG volume;
99 ConnectionPoint *wmpocx;
101 WMPMedia *media;
102 WMPPlaylist *playlist;
104 /* DirectShow stuff */
105 IGraphBuilder* filter_graph;
106 IMediaControl* media_control;
107 IMediaEvent* media_event;
108 IMediaSeeking* media_seeking;
109 IBasicAudio* basic_audio;
111 /* Async event notification */
112 HWND msg_window;
115 BOOL init_player(WindowsMediaPlayer*) DECLSPEC_HIDDEN;
116 void destroy_player(WindowsMediaPlayer*) DECLSPEC_HIDDEN;
117 WMPMedia *unsafe_impl_from_IWMPMedia(IWMPMedia *iface) DECLSPEC_HIDDEN;
118 WMPPlaylist *unsafe_impl_from_IWMPPlaylist(IWMPPlaylist *iface) DECLSPEC_HIDDEN;
119 HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia) DECLSPEC_HIDDEN;
120 HRESULT create_playlist(BSTR name, BSTR url, LONG count, IWMPPlaylist **ppPlaylist) DECLSPEC_HIDDEN;
121 void ConnectionPointContainer_Init(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;
122 void ConnectionPointContainer_Destroy(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;
123 void call_sink(ConnectionPoint *This, DISPID dispid, DISPPARAMS *dispparams) DECLSPEC_HIDDEN;
125 HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
127 void unregister_wmp_class(void) DECLSPEC_HIDDEN;
128 void unregister_player_msg_class(void) DECLSPEC_HIDDEN;
130 extern HINSTANCE wmp_instance DECLSPEC_HIDDEN;
132 static inline WCHAR *heap_strdupW(const WCHAR *str)
134 WCHAR *ret;
136 if(str) {
137 size_t size = lstrlenW(str)+1;
138 ret = heap_alloc(size*sizeof(WCHAR));
139 if(ret)
140 memcpy(ret, str, size*sizeof(WCHAR));
141 }else {
142 ret = NULL;
145 return ret;
148 static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
150 if(!p)
151 return E_POINTER;
153 if(value) {
154 *p = SysAllocString(value);
155 if(!*p)
156 return E_OUTOFMEMORY;
157 }else {
158 *p = NULL;
161 return S_OK;