Mercurial > mplayer.hg
annotate loader/dmo/buffer.c @ 36892:f50427ad9ff6
Internally map item 'potmeter' onto 'hpotmeter'.
Former version of the GUI treated a potmeter very similar to a hpotmeter
(the Win32 GUI still does so) and lots of skins are solely using
potmeters instead of hpotmeters, although this doesn't make sense at
all.
The current version of the GUI is treating a potmeter differently, but
in order to not break old skins, restore the old behaviour.
For the X11/GTK GUI, a potmeter is now simply a hpotmeter with
button=NULL and (button)width=(button)height=0. For the Win32 GUI
(where skins unfortunately are handled a bit differently and things
are more complicated) a potmeter is now a hpotmeter without button
but (button)width=(widget)width and (button)height=(widget)height.
Additionally, print a legacy information, because the item 'potmeter' is
obsolete now and oughtn't be used any longer.
author | ib |
---|---|
date | Mon, 10 Mar 2014 17:32:29 +0000 |
parents | 9fc9d1e788aa |
children |
rev | line source |
---|---|
8294 | 1 #include "DMO_Filter.h" |
2 | |
30170
008338d7679f
Drop -Iloader from CPPFLAGS for the loader subdirectory.
diego
parents:
25794
diff
changeset
|
3 #include "loader/wine/winerror.h" |
008338d7679f
Drop -Iloader from CPPFLAGS for the loader subdirectory.
diego
parents:
25794
diff
changeset
|
4 #include "loader/wine/windef.h" |
8294 | 5 |
6 #include <stdio.h> | |
7 #include <string.h> | |
8 #include <stdlib.h> | |
9 | |
25794
2c8cdb9123b8
Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents:
8294
diff
changeset
|
10 struct CMediaBuffer |
8294 | 11 { |
12 IMediaBuffer_vt* vt; | |
13 DECLARE_IUNKNOWN(); | |
14 GUID interfaces[2]; | |
15 void* mem; | |
16 unsigned long len; | |
17 unsigned long maxlen; | |
18 int freemem; | |
19 }; | |
20 | |
21 static HRESULT STDCALL CMediaBuffer_SetLength(IMediaBuffer* This, | |
22 unsigned long cbLength) | |
23 { | |
24 CMediaBuffer* cmb = (CMediaBuffer*) This; | |
25 Debug printf("CMediaBuffer_SetLength(%p) called (%ld, %ld)\n", This, cbLength, cmb->maxlen); | |
26 if (cbLength > cmb->maxlen) | |
27 return E_INVALIDARG; | |
28 cmb->len = cbLength; | |
29 return S_OK; | |
30 } | |
31 | |
32 static HRESULT STDCALL CMediaBuffer_GetMaxLength(IMediaBuffer* This, | |
33 /* [out] */ unsigned long *pcbMaxLength) | |
34 { | |
35 CMediaBuffer* cmb = (CMediaBuffer*) This; | |
36 Debug printf("CMediaBuffer_GetMaxLength(%p) called -> %ld\n", This, cmb->maxlen); | |
37 if (!pcbMaxLength) | |
38 return E_POINTER; | |
39 *pcbMaxLength = cmb->maxlen; | |
40 return S_OK; | |
41 } | |
42 | |
43 static HRESULT STDCALL CMediaBuffer_GetBufferAndLength(IMediaBuffer* This, | |
44 /* [out] */ char** ppBuffer, | |
45 /* [out] */ unsigned long* pcbLength) | |
46 { | |
47 CMediaBuffer* cmb = (CMediaBuffer*) This; | |
48 Debug printf("CMediaBuffer_GetBufferAndLength(%p) called -> %p %ld\n", This, cmb->mem, cmb->len); | |
49 if (!ppBuffer && !pcbLength) | |
50 return E_POINTER; | |
51 if (ppBuffer) | |
52 *ppBuffer = cmb->mem; | |
53 if (pcbLength) | |
54 *pcbLength = cmb->len; | |
55 return S_OK; | |
56 } | |
57 | |
58 static void CMediaBuffer_Destroy(CMediaBuffer* This) | |
59 { | |
60 Debug printf("CMediaBuffer_Destroy(%p) called\n", This); | |
61 if (This->freemem) | |
62 free(This->mem); | |
63 free(This->vt); | |
64 free(This); | |
65 } | |
66 | |
67 IMPLEMENT_IUNKNOWN(CMediaBuffer) | |
68 | |
69 CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, | |
70 unsigned long len, int copy) | |
71 { | |
30702 | 72 CMediaBuffer* This = malloc(sizeof(CMediaBuffer)); |
8294 | 73 |
74 if (!This) | |
75 return NULL; | |
76 | |
30702 | 77 This->vt = malloc(sizeof(IMediaBuffer_vt)); |
8294 | 78 if (!This->vt) |
79 { | |
80 CMediaBuffer_Destroy(This); | |
81 return NULL; | |
82 } | |
83 | |
84 This->refcount = 1; | |
85 This->len = len; | |
86 This->maxlen = maxlen; | |
87 This->freemem = 0; | |
88 This->mem = mem; | |
89 if (copy) | |
90 /* make a private copy of data */ | |
91 This->mem = 0; | |
92 if (This->mem == NULL) | |
93 { | |
94 if (This->maxlen) | |
95 { | |
96 This->mem = malloc(This->maxlen); | |
97 if (!This->mem) | |
98 { | |
99 CMediaBuffer_Destroy(This); | |
100 return NULL; | |
101 } | |
102 This->freemem = 1; | |
103 if (copy) | |
104 memcpy(This->mem, mem, This->len); | |
105 } | |
106 } | |
107 This->vt->QueryInterface = CMediaBuffer_QueryInterface; | |
108 This->vt->AddRef = CMediaBuffer_AddRef; | |
109 This->vt->Release = CMediaBuffer_Release; | |
110 | |
111 This->vt->SetLength = CMediaBuffer_SetLength; | |
112 This->vt->GetMaxLength = CMediaBuffer_GetMaxLength; | |
113 This->vt->GetBufferAndLength = CMediaBuffer_GetBufferAndLength; | |
114 | |
115 This->interfaces[0] = IID_IUnknown; | |
116 This->interfaces[1] = IID_IMediaBuffer; | |
117 | |
118 return This; | |
119 } |