⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tstream.h

📁 winddk src目录下的WDM源码压缩!
💻 H
字号:
/**************************************************************************

    AVStream Simulated Hardware Sample

    Copyright (c) 2001, Microsoft Corporation.

    File:

        TStream.h

    Abstract:

    History:

        created 8/1/2001

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

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

    Constants

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

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

    CTsSynthesizer

    This class synthesizes a transport stream for output from the
    capture filter.

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

class CTsSynthesizer {

protected:

    //
    // The packet size of the transport stream
    //
    ULONG m_PacketSize;

    //
    // The number of packets in a capture buffer
    //
    ULONG m_PacketsPerBuffer;

    //
    // The size of the actual data in the capture buffer
    //
    ULONG m_SampleSize;

    //
    // The synthesis buffer.  All transport stream samples are created in this
    // buffer.  This must be set with SetBuffer() before any sample creation
    // routines are called.
    //
    PUCHAR m_SynthesisBuffer;

    //
    // The default cursor.  This is a pointer into the synthesis buffer where
    // the next transport stream byte will be placed. 
    //
    PUCHAR m_Cursor;

public:

    //
    // SetSampleSize():
    //
    // Set the size of the synthesis buffer.
    //
    void
    SetSampleSize (
        ULONG PacketSize,
        ULONG PacketsPerBuffer
        )
    {
        m_PacketSize = PacketSize;
        m_PacketsPerBuffer = PacketsPerBuffer;
        m_SampleSize = PacketSize * PacketsPerBuffer;
    }

    //
    // SetBuffer():
    //
    // Set the buffer the synthesizer generates images to.
    //
    void
    SetBuffer (
        PUCHAR SynthesisBuffer
        )
    {
        m_SynthesisBuffer = SynthesisBuffer;
    }

    //
    // GetTsLocation():
    //
    // Set the cursor to point at the given packet index.
    //
    virtual PUCHAR
    GetTsLocation (
        ULONG PacketIndex
        )
    {
        if (   m_SynthesisBuffer 
            && m_PacketSize 
            && (PacketIndex < m_PacketsPerBuffer)
           )
        {
            m_Cursor = m_SynthesisBuffer + (PacketIndex * m_PacketSize);
        }
        else
        {
            m_Cursor = NULL;
        }

        return m_Cursor;
    }

    //
    // PutPacket():
    //
    // Place a transport stream packet at the default cursor location.
    // The cursor location must be set via GetTsLocation(PacketIndex).
    //
    virtual void
    PutPacket (
        PUCHAR  TsPacket
        )

    {
        //
        //  Copy the transport packet to the synthesis buffer.
        //
        RtlCopyMemory (
            m_Cursor,
            TsPacket,
            m_PacketSize
            );
        m_Cursor += m_PacketSize;
    }
    
    //
    // SynthesizeTS():
    //
    // Synthesize the next transport stream buffer to be captured.
    //
    virtual void
    SynthesizeTS (
        );

    //
    // DEFAULT CONSTRUCTOR
    //
    CTsSynthesizer (
        ) :
        m_PacketSize (0),
        m_PacketsPerBuffer (0),
        m_SynthesisBuffer (NULL)
    {
    }

    //
    // CONSTRUCTOR:
    //
    CTsSynthesizer (
        ULONG PacketSize,
        ULONG PacketsPerBuffer
        ) :
        m_PacketSize (PacketSize),
        m_PacketsPerBuffer (PacketsPerBuffer),
        m_SynthesisBuffer (NULL)
    {
    }

    //
    // DESTRUCTOR:
    //
    virtual
    ~CTsSynthesizer (
        )
    {
    }

};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -