qcap_main.c 5.82 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
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>

#define COBJMACROS

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

37 38 39 40
#include "qcap_main.h"

#include "wine/unicode.h"
#include "wine/debug.h"
41 42 43

WINE_DEFAULT_DEBUG_CHANNEL(qcap);

44
static LONG objects_ref = 0;
45

46
static const WCHAR wAudioCaptureFilter[] =
47 48 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
{'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};
 
76
FactoryTemplate const g_Templates[] = {
77
    {
78 79
        wAudioCaptureFilter,
        &CLSID_AudioRecord,
80
        QCAP_createAudioCaptureFilter,
81 82
        NULL
    },{
83 84
        wAVICompressor,
        &CLSID_AVICo,
85
        QCAP_createAVICompressor,
86
        NULL
87
    },{
88
        wVFWCaptFilter,
89
        &CLSID_VfwCapture,
90 91
        QCAP_createVFWCaptureFilter,
        NULL
92
    },{
93
        wVFWCaptFilterProp,
94 95
        &CLSID_CaptureProperties,
        NULL, /* FIXME: Implement QCAP_createVFWCaptureFilterPropertyPage */
96 97 98
        NULL
    },{
        wAVIMux,
99
        &CLSID_AviDest,
100
        QCAP_createAVIMux,
101 102 103
        NULL
    },{
        wAVIMuxPropPage,
104
        &CLSID_AviMuxProptyPage,
105
        NULL, /* FIXME: Implement QCAP_createAVIMuxPropertyPage */
106 107 108
        NULL
    },{
        wAVIMuxPropPage1,
109
        &CLSID_AviMuxProptyPage1,
110
        NULL, /* FIXME: Implement QCAP_createAVIMuxPropertyPage1 */
111 112 113 114
        NULL
    },{
        wFileWriter,
        &CLSID_FileWriter,
115
        NULL, /* FIXME: Implement QCAP_createFileWriter */
116
        NULL
117
    },{
118 119 120 121 122 123 124 125 126
        wCaptGraphBuilder,
        &CLSID_CaptureGraphBuilder,
        QCAP_createCaptureGraphBuilder2,
        NULL
    },{
        wCaptGraphBuilder2,
        &CLSID_CaptureGraphBuilder2,
        QCAP_createCaptureGraphBuilder2,
        NULL
127
    },{
128
        wInfPinTeeFilter, 
129 130
        &CLSID_InfTee,
        NULL, /* FIXME: Implement QCAP_createInfinitePinTeeFilter */
131 132 133
        NULL
    },{
        wSmartTeeFilter,
134
        &CLSID_SmartTee,
135
        QCAP_createSmartTeeFilter,
136 137 138
        NULL
    },{
        wAudioInMixerProp,
139 140
        &CLSID_AudioInputMixerProperties,
        NULL, /* FIXME: Implement QCAP_createAudioInputMixerPropertyPage */
141
        NULL
142
    }
143 144
};

145
const int g_cTemplates = ARRAY_SIZE(g_Templates);
146

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

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

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

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

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

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

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