summaryrefslogtreecommitdiff
path: root/avstream/avscamera/sys/AvsCameraDevice.cpp
blob: 8916e2effa5bd98170d230a3549184eb35b17b4f (plain)
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
36
37
38
39
40
41
42
43
44
45
46
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**************************************************************************

    A/V Stream Camera Sample

    Copyright (c) 2015, Microsoft Corporation.

    File:

        AvsCameraDevice.cpp

    Abstract:

        Device class implementation.  Derived from CCaptureDevice.
        This class overloads our base device class implementation.

    History:

        created 02/24/2015

**************************************************************************/

#include "Common.h"

/**************************************************************************

    PAGEABLE CODE

**************************************************************************/

#ifdef ALLOC_PRAGMA
#pragma code_seg("PAGE")
#endif // ALLOC_PRAGMA

//
// DispatchCreate():
//
// This is the Add Device dispatch for the capture device.  It creates
// the CCaptureDevice and associates it with the device via the bag.
//
NTSTATUS
CAvsCameraDevice::
DispatchCreate (
    _In_ PKSDEVICE Device
)
{
    PAGED_CODE();

    DBG_ENTER("()");

    CAvsCameraDevice *CapDevice = new (NonPagedPoolNx, 'eviD') CAvsCameraDevice (Device);
    if( !CapDevice)
    {
        //
        //  Return failure if we couldn't create the device.
        //
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    NTSTATUS Status = CapDevice->Prepare();
    if (!NT_SUCCESS (Status))
    {
        //  Init failure.
        delete CapDevice;
    }

    DBG_LEAVE("()");
    return Status;
}

NTSTATUS
CAvsCameraDevice::
Initialize()
{
    PAGED_CODE();

    static
    CSensorContext Context[] =
    {
        { L"RFC", &AvsCameraFilterDescriptor,    AcpiPldPanelBack, AcpiPldRotation0 },
        { L"FFC", &AvsCameraFilterDescriptorFFC, AcpiPldPanelFront, AcpiPldRotation90 }
    };

    m_FilterDescriptorCount = SIZEOF_ARRAY(Context);
    m_Context = Context;

    return CCaptureDevice::Initialize();
}

CSensor *
CAvsCameraDevice::
CreateSensor(
    _In_    const KSFILTER_DESCRIPTOR  *Descriptors
)
{
    PAGED_CODE();

    return new (NonPagedPoolNx, 'sneS') CSensorSimulation( this, Descriptors );
}