示例#1
0
static void test_query_interface(void)
{
    HRESULT hr;
    IBaseFilter *pBaseFilter = NULL;
    IBasicVideo *pBasicVideo = NULL;
    IDirectDrawVideo *pDirectDrawVideo = NULL;
    IKsPropertySet *pKsPropertySet = NULL;
    IMediaPosition *pMediaPosition = NULL;
    IMediaSeeking *pMediaSeeking = NULL;
    IQualityControl *pQualityControl = NULL;
    IQualProp *pQualProp = NULL;
    IVideoWindow *pVideoWindow = NULL;

    QI_SUCCEED(pVideoRenderer, IID_IBaseFilter, pBaseFilter);
    RELEASE_EXPECT(pBaseFilter, 1);
    QI_SUCCEED(pVideoRenderer, IID_IBasicVideo, pBasicVideo);
    RELEASE_EXPECT(pBasicVideo, 1);
    QI_SUCCEED(pVideoRenderer, IID_IMediaSeeking, pMediaSeeking);
    RELEASE_EXPECT(pMediaSeeking, 1);
    QI_SUCCEED(pVideoRenderer, IID_IQualityControl, pQualityControl);
    RELEASE_EXPECT(pQualityControl, 1);
    todo_wine {
    QI_SUCCEED(pVideoRenderer, IID_IDirectDrawVideo, pDirectDrawVideo);
    RELEASE_EXPECT(pDirectDrawVideo, 1);
    QI_SUCCEED(pVideoRenderer, IID_IKsPropertySet, pKsPropertySet);
    RELEASE_EXPECT(pKsPropertySet, 1);
    QI_SUCCEED(pVideoRenderer, IID_IMediaPosition, pMediaPosition);
    RELEASE_EXPECT(pMediaPosition, 1);
    QI_SUCCEED(pVideoRenderer, IID_IQualProp, pQualProp);
    RELEASE_EXPECT(pQualProp, 1);
    }
    QI_SUCCEED(pVideoRenderer, IID_IVideoWindow, pVideoWindow);
    RELEASE_EXPECT(pVideoWindow, 1);
}
示例#2
0
static void test_query_interface(void)
{
    HRESULT hr;
    IBaseFilter *pBaseFilter = NULL;
    IBasicAudio *pBasicAudio = NULL;
    IMediaPosition *pMediaPosition = NULL;
    IMediaSeeking *pMediaSeeking = NULL;
    IQualityControl *pQualityControl = NULL;
    IPersistPropertyBag *ppb = NULL;
    IDirectSound3DBuffer *ds3dbuf = NULL;
    IReferenceClock *clock = NULL;
    IAMDirectSound *pAMDirectSound = NULL;

    QI_SUCCEED(pDSRender, IID_IBaseFilter, pBaseFilter);
    RELEASE_EXPECT(pBaseFilter, 1);
    QI_SUCCEED(pDSRender, IID_IBasicAudio, pBasicAudio);
    RELEASE_EXPECT(pBasicAudio, 1);
    QI_SUCCEED(pDSRender, IID_IMediaSeeking, pMediaSeeking);
    RELEASE_EXPECT(pMediaSeeking, 1);
    QI_SUCCEED(pDSRender, IID_IReferenceClock, clock);
    RELEASE_EXPECT(clock, 1);
    QI_SUCCEED(pDSRender, IID_IAMDirectSound, pAMDirectSound);
    RELEASE_EXPECT( pAMDirectSound, 1);
    todo_wine {
    QI_SUCCEED(pDSRender, IID_IDirectSound3DBuffer, ds3dbuf);
    RELEASE_EXPECT(ds3dbuf, 1);
    QI_SUCCEED(pDSRender, IID_IPersistPropertyBag, ppb);
    if (ppb)
    {
        IPropertyBag bag = { &PB_Vtbl };
        hr = IPersistPropertyBag_Load(ppb, &bag, NULL);
        ok(hr == S_OK, "Couldn't load default device: %08x\n", hr);
    }
    RELEASE_EXPECT(ppb, 1);
    }
    QI_SUCCEED(pDSRender, IID_IMediaPosition, pMediaPosition);
    RELEASE_EXPECT(pMediaPosition, 1);
    QI_SUCCEED(pDSRender, IID_IQualityControl, pQualityControl);
    RELEASE_EXPECT(pQualityControl, 1);
}
示例#3
0
文件: filter.c 项目: AndreRH/wine
static void test_aggregation(const CLSID clsid_inner, const IID iid_inner, const char *testid, int testrun)
{
    const CLSID clsid_outer = CLSID_SystemClock;
    const IID iid_outer = IID_IReferenceClock;
    HRESULT hr;
    ULONG refCount;
    IUnknown *unk_outer = NULL;
    IUnknown *unk_inner = NULL;
    IUnknown *unk_inner_fail = NULL;
    IUnknown *unk_outer_test = NULL;
    IUnknown *unk_inner_test = NULL;
    IUnknown *unk_aggregatee = NULL;
    IUnknown *unk_aggregator = NULL;
    IUnknown *unk_test = NULL;

    hr = CoCreateInstance(&clsid_outer, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (LPVOID*)&unk_outer);
    ok(hr == S_OK, "%s: run %d: First CoCreateInstance failed with %x\n", testid, testrun, hr);
    ok(unk_outer != NULL, "%s: run %d: unk_outer is NULL\n", testid, testrun);

    if (!unk_outer)
    {
        skip("%s: run %d: unk_outer is NULL\n", testid, testrun);
        return;
    }

    /* for aggregation, we should only be able to request IUnknown */
    hr = CoCreateInstance(&clsid_inner, unk_outer, CLSCTX_INPROC_SERVER, &iid_inner, (LPVOID*)&unk_inner_fail);
    if (hr == REGDB_E_CLASSNOTREG)
    {
        skip("%s: run %d: Class not registered\n", testid, testrun);
        return;
    }
    ok(hr == E_NOINTERFACE, "%s: run %d: Second CoCreateInstance returned %x\n", testid, testrun, hr);
    ok(unk_inner_fail == NULL, "%s: run %d: unk_inner_fail is not NULL\n", testid, testrun);

    /* aggregation, request IUnknown */
    hr = CoCreateInstance(&clsid_inner, unk_outer, CLSCTX_INPROC_SERVER, &IID_IUnknown, (LPVOID*)&unk_inner);
    todo_wine ok(hr == S_OK, "%s: run %d: Third CoCreateInstance returned %x\n", testid, testrun, hr);
    todo_wine ok(unk_inner != NULL, "%s: run %d: unk_inner is NULL\n", testid, testrun);

    if (!unk_inner)
    {
        skip("%s: run %d: unk_inner is NULL\n", testid, testrun);
        return;
    }

    ADDREF_EXPECT(unk_outer, 2);
    ADDREF_EXPECT(unk_inner, 2);
    RELEASE_EXPECT(unk_outer, 1);
    RELEASE_EXPECT(unk_inner, 1);

    QI_FAIL(unk_outer, iid_inner, unk_aggregatee);
    QI_FAIL(unk_inner, iid_outer, unk_aggregator);

    QI_SUCCEED(unk_outer, iid_outer, unk_aggregator);
    QI_SUCCEED(unk_outer, IID_IUnknown, unk_outer_test);
    QI_SUCCEED(unk_inner, iid_inner, unk_aggregatee);
    QI_SUCCEED(unk_inner, IID_IUnknown, unk_inner_test);

    if (!unk_aggregator || !unk_outer_test || !unk_aggregatee || !unk_inner_test)
    {
        skip("%s: run %d: One of the required interfaces is NULL\n", testid, testrun);
        return;
    }

    ADDREF_EXPECT(unk_aggregator, 5);
    ADDREF_EXPECT(unk_outer_test, 6);
    ADDREF_EXPECT(unk_aggregatee, 7);
    ADDREF_EXPECT(unk_inner_test, 3);
    RELEASE_EXPECT(unk_aggregator, 6);
    RELEASE_EXPECT(unk_outer_test, 5);
    RELEASE_EXPECT(unk_aggregatee, 4);
    RELEASE_EXPECT(unk_inner_test, 2);

    QI_SUCCEED(unk_aggregator, IID_IUnknown, unk_test);
    QI_SUCCEED(unk_outer_test, IID_IUnknown, unk_test);
    QI_SUCCEED(unk_aggregatee, IID_IUnknown, unk_test);
    QI_SUCCEED(unk_inner_test, IID_IUnknown, unk_test);

    QI_FAIL(unk_aggregator, iid_inner, unk_test);
    QI_FAIL(unk_outer_test, iid_inner, unk_test);
    QI_FAIL(unk_aggregatee, iid_inner, unk_test);
    QI_SUCCEED(unk_inner_test, iid_inner, unk_test);

    QI_SUCCEED(unk_aggregator, iid_outer, unk_test);
    QI_SUCCEED(unk_outer_test, iid_outer, unk_test);
    QI_SUCCEED(unk_aggregatee, iid_outer, unk_test);
    QI_FAIL(unk_inner_test, iid_outer, unk_test);

    RELEASE_EXPECT(unk_aggregator, 10);
    RELEASE_EXPECT(unk_outer_test, 9);
    RELEASE_EXPECT(unk_aggregatee, 8);
    RELEASE_EXPECT(unk_inner_test, 2);
    RELEASE_EXPECT(unk_outer, 7);
    RELEASE_EXPECT(unk_inner, 1);

    do
    {
        refCount = IUnknown_Release(unk_inner);
    } while (refCount);

    do
    {
        refCount = IUnknown_Release(unk_outer);
    } while (refCount);
}
示例#4
0
文件: misc.c 项目: AmesianX/wine
static void test_aggregation(const CLSID clsidOuter, const CLSID clsidInner,
                             const IID iidOuter, const IID iidInner)
{
    HRESULT hr;
    ULONG refCount;
    IUnknown *pUnkOuter = NULL;
    IUnknown *pUnkInner = NULL;
    IUnknown *pUnkInnerFail = NULL;
    IUnknown *pUnkOuterTest = NULL;
    IUnknown *pUnkInnerTest = NULL;
    IUnknown *pUnkAggregatee = NULL;
    IUnknown *pUnkAggregator = NULL;
    IUnknown *pUnkTest = NULL;

    hr = CoCreateInstance(&clsidOuter, NULL, CLSCTX_INPROC_SERVER,
                          &IID_IUnknown, (LPVOID*)&pUnkOuter);
    ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
    ok(pUnkOuter != NULL, "pUnkOuter is NULL\n");

    if (!pUnkOuter)
    {
        skip("pUnkOuter is NULL\n");
        return;
    }

    /* for aggregation, we should only be able to request IUnknown */
    hr = CoCreateInstance(&clsidInner, pUnkOuter, CLSCTX_INPROC_SERVER,
                          &iidInner, (LPVOID*)&pUnkInnerFail);
    if (hr == REGDB_E_CLASSNOTREG)
    {
        skip("Class not registered\n");
        return;
    }
    ok(hr == E_NOINTERFACE, "CoCreateInstance returned %x\n", hr);
    ok(pUnkInnerFail == NULL, "pUnkInnerFail is not NULL\n");

    /* aggregation, request IUnknown */
    hr = CoCreateInstance(&clsidInner, pUnkOuter, CLSCTX_INPROC_SERVER,
                          &IID_IUnknown, (LPVOID*)&pUnkInner);
    ok(hr == S_OK, "CoCreateInstance returned %x\n", hr);
    ok(pUnkInner != NULL, "pUnkInner is NULL\n");

    if (!pUnkInner)
    {
        skip("pUnkInner is NULL\n");
        return;
    }

    ADDREF_EXPECT(pUnkOuter, 2);
    ADDREF_EXPECT(pUnkInner, 2);
    RELEASE_EXPECT(pUnkOuter, 1);
    RELEASE_EXPECT(pUnkInner, 1);

    QI_FAIL(pUnkOuter, iidInner, pUnkAggregatee);
    QI_FAIL(pUnkInner, iidOuter, pUnkAggregator);

    /* these QueryInterface calls should work */
    QI_SUCCEED(pUnkOuter, iidOuter, pUnkAggregator);
    QI_SUCCEED(pUnkOuter, IID_IUnknown, pUnkOuterTest);
    /* IGraphConfig interface comes with DirectShow 9 */
    if(IsEqualGUID(&IID_IGraphConfig, &iidInner))
    {
        hr = IUnknown_QueryInterface(pUnkInner, &iidInner, (LPVOID*)&pUnkAggregatee);
        ok(hr == S_OK || broken(hr == E_NOINTERFACE), "IUnknown_QueryInterface returned %x\n", hr);
        ok(pUnkAggregatee != NULL || broken(!pUnkAggregatee), "Pointer is NULL\n");
    }
    else
    {
        QI_SUCCEED(pUnkInner, iidInner, pUnkAggregatee);
    }
    QI_SUCCEED(pUnkInner, IID_IUnknown, pUnkInnerTest);

    if (!pUnkAggregator || !pUnkOuterTest || !pUnkAggregatee
                    || !pUnkInnerTest)
    {
        skip("One of the required interfaces is NULL\n");
        return;
    }

    ADDREF_EXPECT(pUnkAggregator, 5);
    ADDREF_EXPECT(pUnkOuterTest, 6);
    ADDREF_EXPECT(pUnkAggregatee, 7);
    ADDREF_EXPECT(pUnkInnerTest, 3);
    RELEASE_EXPECT(pUnkAggregator, 6);
    RELEASE_EXPECT(pUnkOuterTest, 5);
    RELEASE_EXPECT(pUnkAggregatee, 4);
    RELEASE_EXPECT(pUnkInnerTest, 2);

    QI_SUCCEED(pUnkAggregator, IID_IUnknown, pUnkTest);
    QI_SUCCEED(pUnkOuterTest, IID_IUnknown, pUnkTest);
    QI_SUCCEED(pUnkAggregatee, IID_IUnknown, pUnkTest);
    QI_SUCCEED(pUnkInnerTest, IID_IUnknown, pUnkTest);

    QI_FAIL(pUnkAggregator, iidInner, pUnkTest);
    QI_FAIL(pUnkOuterTest, iidInner, pUnkTest);
    QI_FAIL(pUnkAggregatee, iidInner, pUnkTest);
    QI_SUCCEED(pUnkInnerTest, iidInner, pUnkTest);

    QI_SUCCEED(pUnkAggregator, iidOuter, pUnkTest);
    QI_SUCCEED(pUnkOuterTest, iidOuter, pUnkTest);
    QI_SUCCEED(pUnkAggregatee, iidOuter, pUnkTest);
    QI_FAIL(pUnkInnerTest, iidOuter, pUnkTest);

    RELEASE_EXPECT(pUnkAggregator, 10);
    RELEASE_EXPECT(pUnkOuterTest, 9);
    RELEASE_EXPECT(pUnkAggregatee, 8);
    RELEASE_EXPECT(pUnkInnerTest, 2);
    RELEASE_EXPECT(pUnkOuter, 7);
    RELEASE_EXPECT(pUnkInner, 1);

    do
    {
        refCount = IUnknown_Release(pUnkInner);
    } while (refCount);

    do
    {
        refCount = IUnknown_Release(pUnkOuter);
    } while (refCount);
}