qcap_main.c 5.99 KB
Newer Older
1
/*
2
 * Qcap implementation, dllentry points
3 4
 *
 * Copyright (C) 2003 Dominik Strasser
5
 * Copyright (C) 2005 Rolf Kalbermatter
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20
 */
21
#include "config.h"
22

23 24 25 26 27 28 29 30 31 32
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>

#define COBJMACROS
#define NONAMELESSSTRUCT
#define NONAMELESSUNION

#include "windef.h"
#include "winbase.h"
33
#include "wingdi.h"
34
#include "winerror.h"
35 36 37
#include "objbase.h"
#include "uuids.h"
#include "strmif.h"
38

39 40 41 42
#include "qcap_main.h"

#include "wine/unicode.h"
#include "wine/debug.h"
43 44 45

WINE_DEFAULT_DEBUG_CHANNEL(qcap);

46
static LONG objects_ref = 0;
47

48
static const WCHAR wAudioCaptureFilter[] =
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
{'A','u','d','i','o',' ','C','a','p','t','u','r','e',' ','F','i','l','t','e','r',0};
static const WCHAR wAVICompressor[] =
{'A','V','I',' ','C','o','m','p','r','e','s','s','o','r',0};
static const WCHAR wVFWCaptFilter[] =
{'V','F','W',' ','C','a','p','t','u','r','e',' ','F','i','l','t','e','r',0};
static const WCHAR wVFWCaptFilterProp[] =
{'V','F','W',' ','C','a','p','t','u','r','e',' ','F','i','l','t','e','r',' ',
 'P','r','o','p','e','r','t','y',' ','P','a','g','e',0};
static const WCHAR wAVIMux[] =
{'A','V','I',' ','m','u','x',0};
static const WCHAR wAVIMuxPropPage[] =
{'A','V','I',' ','m','u','x',' ','P','r','o','p','e','r','t','y',' ','P','a','g','e',0};
static const WCHAR wAVIMuxPropPage1[] =
{'A','V','I',' ','m','u','x',' ','P','r','o','p','e','r','t','y',' ','P','a','g','e','1',0};
static const WCHAR wFileWriter[] =
{'F','i','l','e',' ','W','r','i','t','e','r',0};
static const WCHAR wCaptGraphBuilder[] =
{'C','a','p','t','u','r','e',' ','G','r','a','p','h',' ','B','u','i','l','d','e','r',0};
static const WCHAR wCaptGraphBuilder2[] =
{'C','a','p','t','u','r','e',' ','G','r','a','p','h',' ','B','u','i','l','d','e','r','2',0};
static const WCHAR wInfPinTeeFilter[] =
{'I','n','f','i','n','i','t','e',' ','P','i','n',' ','T','e','e',' ','F','i',
 'l','t','e','r',0};
static const WCHAR wSmartTeeFilter[] =
{'S','m','a','r','t',' ','T','e','e',' ','F','i','l','t','e','r',0};
static const WCHAR wAudioInMixerProp[] =
{'A','u','d','i','o','I','n','p','u','t','M','i','x','e','r',' ','P','r','o',
 'p','e','r','t','y',' ','P','a','g','e',0};
 
78
FactoryTemplate const g_Templates[] = {
79
    {
80 81 82
        wAudioCaptureFilter,
        &CLSID_AudioRecord,
        NULL, /* FIXME: Implement QCAP_createAudioCaptureFilter */
83 84
        NULL
    },{
85 86 87
        wAVICompressor,
        &CLSID_AVICo,
        NULL, /* FIXME: Implement QCAP_createAVICompressor */
88
        NULL
89
    },{
90
        wVFWCaptFilter,
91
        &CLSID_VfwCapture,
92 93
        QCAP_createVFWCaptureFilter,
        NULL
94
    },{
95
        wVFWCaptFilterProp,
96 97
        &CLSID_CaptureProperties,
        NULL, /* FIXME: Implement QCAP_createVFWCaptureFilterPropertyPage */
98 99 100
        NULL
    },{
        wAVIMux,
101 102
        &CLSID_AviDest,
        NULL, /* FIXME: Implement QCAP_createAVImux */
103 104 105
        NULL
    },{
        wAVIMuxPropPage,
106 107
        &CLSID_AviMuxProptyPage,
        NULL, /* FIXME: Implement QCAP_createAVImuxPropertyPage */
108 109 110
        NULL
    },{
        wAVIMuxPropPage1,
111 112
        &CLSID_AviMuxProptyPage1,
        NULL, /* FIXME: Implement QCAP_createAVImuxPropertyPage1 */
113 114 115 116
        NULL
    },{
        wFileWriter,
        &CLSID_FileWriter,
117
        NULL, /* FIXME: Implement QCAP_createFileWriter */
118
        NULL
119
    },{
120 121 122 123 124 125 126 127 128
        wCaptGraphBuilder,
        &CLSID_CaptureGraphBuilder,
        QCAP_createCaptureGraphBuilder2,
        NULL
    },{
        wCaptGraphBuilder2,
        &CLSID_CaptureGraphBuilder2,
        QCAP_createCaptureGraphBuilder2,
        NULL
129
    },{
130
        wInfPinTeeFilter, 
131 132
        &CLSID_InfTee,
        NULL, /* FIXME: Implement QCAP_createInfinitePinTeeFilter */
133 134 135
        NULL
    },{
        wSmartTeeFilter,
136 137
        &CLSID_SmartTee,
        NULL, /* FIXME: Implement QCAP_createSmartTeeFilter */
138 139 140
        NULL
    },{
        wAudioInMixerProp,
141 142
        &CLSID_AudioInputMixerProperties,
        NULL, /* FIXME: Implement QCAP_createAudioInputMixerPropertyPage */
143
        NULL
144
    }
145 146
};

147
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
148

149
/***********************************************************************
150 151 152 153
 *    Dll EntryPoint (QCAP.@)
 */
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
154
    return STRMBASE_DllMain(hInstDLL,fdwReason,lpv);
155 156
}

157 158 159 160 161 162 163 164
/***********************************************************************
 *    DllGetClassObject
 */
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
    return STRMBASE_DllGetClassObject( rclsid, riid, ppv );
}

165 166
/***********************************************************************
 *    DllRegisterServer (QCAP.@)
167
 */
168
HRESULT WINAPI DllRegisterServer(void)
169
{
170
    TRACE("()\n");
171
    return AMovieDllRegisterServer2(TRUE);
172 173 174 175 176
}

/***********************************************************************
 *    DllUnregisterServer (QCAP.@)
 */
177
HRESULT WINAPI DllUnregisterServer(void)
178 179
{
    TRACE("\n");
180
    return AMovieDllRegisterServer2(FALSE);
181 182 183
}

/***********************************************************************
184
 *    DllCanUnloadNow (QCAP.@)
185
 */
186
HRESULT WINAPI DllCanUnloadNow(void)
187 188 189
{
    TRACE("\n");

190
    if (STRMBASE_DllCanUnloadNow() && objects_ref == 0)
191
        return S_OK;
192
    return S_FALSE;
193 194 195
}

DWORD ObjectRefCount(BOOL increment)
196
{
197 198 199
    if (increment)
        return InterlockedIncrement(&objects_ref);
    return InterlockedDecrement(&objects_ref);
200
}