evr.c 2.26 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/*
 * Copyright 2017 Fabian Maurer
 *
 * 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
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#define COBJMACROS

#include "wine/debug.h"

#include <stdio.h>

#include "evr_private.h"
#include "d3d9.h"
#include "wine/strmbase.h"

#include "initguid.h"
#include "dxva2api.h"

WINE_DEFAULT_DEBUG_CHANNEL(evr);

typedef struct
{
36
    struct strmbase_renderer renderer;
37 38
} evr_filter;

39
static inline evr_filter *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
40
{
41
    return CONTAINING_RECORD(iface, evr_filter, renderer);
42 43
}

44
static void evr_destroy(struct strmbase_renderer *iface)
45
{
46
    evr_filter *filter = impl_from_strmbase_renderer(iface);
47 48 49

    strmbase_renderer_cleanup(&filter->renderer);
    CoTaskMemFree(filter);
50 51
}

52
static HRESULT WINAPI evr_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *sample)
53
{
54 55 56
    FIXME("Not implemented.\n");
    return E_NOTIMPL;
}
57

58
static HRESULT WINAPI evr_CheckMediaType(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
59 60 61
{
    FIXME("Not implemented.\n");
    return E_NOTIMPL;
62 63
}

64
static const struct strmbase_renderer_ops renderer_ops =
65
{
66 67 68
    .pfnCheckMediaType = evr_CheckMediaType,
    .pfnDoRenderSample = evr_DoRenderSample,
    .renderer_destroy = evr_destroy,
69 70
};

71
HRESULT evr_filter_create(IUnknown *outer, void **out)
72 73 74
{
    evr_filter *object;

75
    *out = NULL;
76 77 78 79 80

    object = CoTaskMemAlloc(sizeof(evr_filter));
    if (!object)
        return E_OUTOFMEMORY;

81
    strmbase_renderer_init(&object->renderer, outer,
82
            &CLSID_EnhancedVideoRenderer, L"EVR Input0", &renderer_ops);
83

84
    *out = &object->renderer.filter.IUnknown_inner;
85 86 87

    return S_OK;
}