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

📄 sbe.cs

📁 DirectShowLibV1-5針對DirectShow一些函數以及指令和LIB的檔案
💻 CS
📖 第 1 页 / 共 2 页
字号:
#region license

/*
DirectShowLib - Provide access to DirectShow interfaces via .NET
Copyright (C) 2006
http://sourceforge.net/projects/directshownet/

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
*/

#endregion

using System;
using System.Runtime.InteropServices;
using System.Text;

namespace DirectShowLib.SBE
{
    #region Declarations

    /// <summary>
    /// From unnamed structure
    /// </summary>
    public enum RecordingType
    {
        Content = 0, //  no post-recording or overlapped
        Reference //  allows post-recording & overlapped
    }

    /// <summary>
    /// From STREAMBUFFER_ATTR_DATATYPE
    /// </summary>
    public enum StreamBufferAttrDataType
    {
        DWord = 0,
        String = 1,
        Binary = 2,
        Bool = 3,
        QWord = 4,
        Word = 5,
        Guid = 6
    }

    /// <summary>
    /// From unnamed structure
    /// </summary>
    public enum StreamBufferEventCode
    {
        TimeHole = 0x0326, // STREAMBUFFER_EC_TIMEHOLE
        StaleDataRead, // STREAMBUFFER_EC_STALE_DATA_READ
        StaleFileDeleted, // STREAMBUFFER_EC_STALE_FILE_DELETED
        ContentBecomingStale, // STREAMBUFFER_EC_CONTENT_BECOMING_STALE
        WriteFailure, // STREAMBUFFER_EC_WRITE_FAILURE
        ReadFailure, // STREAMBUFFER_EC_READ_FAILURE
        RateChanged // STREAMBUFFER_EC_RATE_CHANGED
    }


    /// <summary>
    /// From g_wszStreamBufferRecording* static const WCHAR
    /// </summary>
    sealed public class StreamBufferRecording
    {
        private StreamBufferRecording()
        {
        }

        ////////////////////////////////////////////////////////////////
        //
        // List of pre-defined attributes
        //
        public readonly string Duration = "Duration";

        public readonly string Bitrate = "Bitrate";
        public readonly string Seekable = "Seekable";
        public readonly string Stridable = "Stridable";
        public readonly string Broadcast = "Broadcast";
        public readonly string Protected = "Is_Protected";
        public readonly string Trusted = "Is_Trusted";
        public readonly string Signature_Name = "Signature_Name";
        public readonly string HasAudio = "HasAudio";
        public readonly string HasImage = "HasImage";
        public readonly string HasScript = "HasScript";
        public readonly string HasVideo = "HasVideo";
        public readonly string CurrentBitrate = "CurrentBitrate";
        public readonly string OptimalBitrate = "OptimalBitrate";
        public readonly string HasAttachedImages = "HasAttachedImages";
        public readonly string SkipBackward = "Can_Skip_Backward";
        public readonly string SkipForward = "Can_Skip_Forward";
        public readonly string NumberOfFrames = "NumberOfFrames";
        public readonly string FileSize = "FileSize";
        public readonly string HasArbitraryDataStream = "HasArbitraryDataStream";
        public readonly string HasFileTransferStream = "HasFileTransferStream";

        ////////////////////////////////////////////////////////////////
        //
        // The content description object supports 5 basic attributes.
        //
        public readonly string Title = "Title";

        public readonly string Author = "Author";
        public readonly string Description = "Description";
        public readonly string Rating = "Rating";
        public readonly string Copyright = "Copyright";

        ////////////////////////////////////////////////////////////////
        //
        // These attributes are used to configure DRM using IWMDRMWriter::SetDRMAttribute.
        //
        public readonly string Use_DRM = "Use_DRM";

        public readonly string DRM_Flags = "DRM_Flags";
        public readonly string DRM_Level = "DRM_Level";

        ////////////////////////////////////////////////////////////////
        //
        // These are the additional attributes defined in the WM attribute
        // namespace that give information about the content.
        //
        public readonly string AlbumTitle = "WM/AlbumTitle";

        public readonly string Track = "WM/Track";
        public readonly string PromotionURL = "WM/PromotionURL";
        public readonly string AlbumCoverURL = "WM/AlbumCoverURL";
        public readonly string Genre = "WM/Genre";
        public readonly string Year = "WM/Year";
        public readonly string GenreID = "WM/GenreID";
        public readonly string MCDI = "WM/MCDI";
        public readonly string Composer = "WM/Composer";
        public readonly string Lyrics = "WM/Lyrics";
        public readonly string TrackNumber = "WM/TrackNumber";
        public readonly string ToolName = "WM/ToolName";
        public readonly string ToolVersion = "WM/ToolVersion";
        public readonly string IsVBR = "IsVBR";
        public readonly string AlbumArtist = "WM/AlbumArtist";

        ////////////////////////////////////////////////////////////////
        //
        // These optional attributes may be used to give information
        // about the branding of the content.
        //
        public readonly string BannerImageType = "BannerImageType";

        public readonly string BannerImageData = "BannerImageData";
        public readonly string BannerImageURL = "BannerImageURL";
        public readonly string CopyrightURL = "CopyrightURL";

        ////////////////////////////////////////////////////////////////
        //
        // Optional attributes, used to give information
        // about video stream properties.
        //
        public readonly string AspectRatioX = "AspectRatioX";

        public readonly string AspectRatioY = "AspectRatioY";

        ////////////////////////////////////////////////////////////////
        //
        // The NSC file supports the following attributes.
        //
        public readonly string NSCName = "NSC_Name";

        public readonly string NSCAddress = "NSC_Address";
        public readonly string NSCPhone = "NSC_Phone";
        public readonly string NSCEmail = "NSC_Email";
        public readonly string NSCDescription = "NSC_Description";
    }


    /// <summary>
    /// From STREAMBUFFER_ATTRIBUTE
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct StreamBufferAttribute
    {
        [MarshalAs(UnmanagedType.LPWStr)] public string pszName;
        public StreamBufferAttrDataType StreamBufferAttributeType;
        public IntPtr pbAttribute; // BYTE *
        public short cbLength;
    }

    /// <summary>
    /// From SBE_PIN_DATA
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct SBEPinData
    {
        public long cDataBytes; //  total sample payload bytes
        public long cSamplesProcessed; //  samples processed
        public long cDiscontinuities; //  number of discontinuities
        public long cSyncPoints; //  number of syncpoints
        public long cTimestamps; //  number of timestamps
    }

    #endregion

    #region Interfaces

    [ComImport,
    Guid("9ce50f2d-6ba7-40fb-a034-50b1a674ec78"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStreamBufferInitialize
    {
        [PreserveSig]
        int SetHKEY([In] IntPtr hkeyRoot); // HKEY

        [PreserveSig]
        int SetSIDs(
            [In] int cSIDs,
            [In, MarshalAs(UnmanagedType.LPArray)] IntPtr [] ppSID // PSID *
            );
    }

    [ComImport,
    Guid("afd1f242-7efd-45ee-ba4e-407a25c9a77a"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStreamBufferSink
    {
        [PreserveSig]
        int LockProfile([In, MarshalAs(UnmanagedType.LPWStr)] string pszStreamBufferFilename);

        [PreserveSig]
        int CreateRecorder(
            [In, MarshalAs(UnmanagedType.LPWStr)] string pszFilename,
            [In] RecordingType dwRecordType,
            [Out, MarshalAs(UnmanagedType.IUnknown)] out object pRecordingIUnknown
            );

        [PreserveSig]
        int IsProfileLocked();
    }

    [ComImport,
    Guid("DB94A660-F4FB-4bfa-BCC6-FE159A4EEA93"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStreamBufferSink2 : IStreamBufferSink
    {
        #region IStreamBufferSink Methods

        [PreserveSig]
        new int LockProfile([In, MarshalAs(UnmanagedType.LPWStr)] string pszStreamBufferFilename);

        [PreserveSig]
        new int CreateRecorder(
            [In, MarshalAs(UnmanagedType.LPWStr)] string pszFilename,
            [In] RecordingType dwRecordType,
            [Out, MarshalAs(UnmanagedType.IUnknown)] out object pRecordingIUnknown
            );

        [PreserveSig]
        new int IsProfileLocked();

        #endregion

        [PreserveSig]
        int UnlockProfile();
    }

    [ComImport,
    Guid("974723f2-887a-4452-9366-2cff3057bc8f"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStreamBufferSink3 : IStreamBufferSink2
    {
        #region IStreamBufferSink Methods

        [PreserveSig]
        new int LockProfile([In, MarshalAs(UnmanagedType.LPWStr)] string pszStreamBufferFilename);

        [PreserveSig]
        new int CreateRecorder(
            [In, MarshalAs(UnmanagedType.LPWStr)] string pszFilename,
            [In] RecordingType dwRecordType,
            [Out, MarshalAs(UnmanagedType.IUnknown)] out object pRecordingIUnknown
            );

        [PreserveSig]
        new int IsProfileLocked();

        #endregion

        #region IStreamBufferSink2

        [PreserveSig]
        new int UnlockProfile();

        #endregion

        [PreserveSig]
        int SetAvailableFilter([In, Out] ref long prtMin);
    }

    [ComImport,
    Guid("1c5bd776-6ced-4f44-8164-5eab0e98db12"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStreamBufferSource
    {
        [PreserveSig]
        int SetStreamSink([In] IStreamBufferSink pIStreamBufferSink);
    }

    [ComImport,
    Guid("ba9b6c99-f3c7-4ff2-92db-cfdd4851bf31"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStreamBufferRecordControl
    {
        [PreserveSig]
        int Start([In, Out] ref long prtStart);

        [PreserveSig]
        int Stop([In] long rtStop);

        [PreserveSig]
        int GetRecordingStatus(
            [Out] out int phResult,
            [Out, MarshalAs(UnmanagedType.Bool)] out bool pbStarted,
            [Out, MarshalAs(UnmanagedType.Bool)] out bool pbStopped
            );
    }

    [ComImport,
    Guid("9E259A9B-8815-42ae-B09F-221970B154FD"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IStreamBufferRecComp
    {
        [PreserveSig]
        int Initialize(
            [In, MarshalAs(UnmanagedType.LPWStr)] string pszTargetFilename,
            [In, MarshalAs(UnmanagedType.LPWStr)] string pszSBRecProfileRef
            );

⌨️ 快捷键说明

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