summaryrefslogtreecommitdiff
path: root/avstream/avssamp/audio.h
blob: 0240ddc853c1885e477e2ac15a031a735040e999 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**************************************************************************

    AVStream Filter-Centric Sample

    Copyright (c) 1999 - 2001, Microsoft Corporation

    File:

        audio.h

    Abstract:

        This file contains the audio capture pin header.

    History:

        created 6/28/01

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

class CAudioCapturePin :
    public CCapturePin

{

private:

    //
    // The wave object used to synthesize audio data.
    //
    CWaveObject *m_WaveObject;

public:

    //
    // CAudioCapturePin():
    //
    // Construct a new audio capture pin.
    //
    CAudioCapturePin (
        IN PKSPIN Pin
        ) : CCapturePin (Pin)
    {
    }

    //
    // ~CAudioCapturePin():
    //
    // Destruct an audio capture pin.
    //
    ~CAudioCapturePin (
        )
    {
    }

    //
    // Acquire():
    //
    // Called when the audio capture pin is transitioning into the acquire
    // state (from either stop or pause).  This routine will get ahold of
    // the wave object from the filter.
    //
    virtual
    NTSTATUS
    Acquire (
        IN KSSTATE FromState
        );

    //
    // CaptureFrame():
    //
    // This is called when the filter processes and wants to trigger processing
    // of an audio frame.  The routine will compute how far into the stream
    // we've progressed and ask the filter's wave object to copy enough
    // "synthesized" audio data from the wave object in order to reach
    // the position.
    //
    virtual
    NTSTATUS
    CaptureFrame (
        IN PKSPROCESSPIN ProcessPin,
        IN ULONG Tick
        );

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

        Dispatch Functions

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

    //
    // DispatchCreate():
    //
    // This is the creation dispatch for the audio capture pin on the filter.
    // It creates the CAudioCapturePin, associates it with the AVStream pin
    // object and bags the class object for automatic cleanup when the
    // pin is closed.
    //
    static
    NTSTATUS
    DispatchCreate (
        IN PKSPIN Pin,
        IN PIRP Irp
        );

    //
    // DispatchSetFormat():
    //
    // This is the set data format dispatch for the pin.  This will be called 
    // BEFORE pin creation to validate that a data format selected is a match
    // for the range pulled out of our range list.  It will also be called
    // for format changes.
    //
    // If OldFormat is NULL, this is an indication that it's the initial
    // call and not a format change.  Even fixed format pins get this call
    // once.
    //
    static
    NTSTATUS
    DispatchSetFormat (
        IN PKSPIN Pin,
        IN PKSDATAFORMAT OldFormat OPTIONAL,
        IN PKSMULTIPLE_ITEM OldAttributeList OPTIONAL,
        IN const KSDATARANGE *DataRange,
        IN const KSATTRIBUTE_LIST *AttributeRange OPTIONAL
        );

    //
    // IntersectHandler():
    //
    // This is the data intersection handler for the capture pin.  This 
    // determines an optimal format in the intersection of two ranges,
    // one local and one possibly foreign.  If there is no compatible format,
    // STATUS_NO_MATCH is returned.
    //
    static
    NTSTATUS
    IntersectHandler (
        IN PKSFILTER Filter,
        IN PIRP Irp,
        IN PKSP_PIN PinInstance,
        IN PKSDATARANGE CallerDataRange,
        IN PKSDATARANGE DescriptorDataRange,
        IN ULONG BufferSize,
        OUT PVOID Data OPTIONAL,
        OUT PULONG DataSize
        );
        

};