Beispiel #1
0
        /// <summary>
        /// Set the Mediatype from a bitmap
        /// </summary>
        override public void SetMediaType(IGenericSampleConfig psc)
        {
            BitmapInfoHeader bmi = new BitmapInfoHeader();

            // Make sure we have an image to get the data from
            if (m_bmp == null)
            {
                int    i;
                IntPtr ip = IntPtr.Zero;
                GetImage(0, ip, 0, out i);
            }

            // Build a BitmapInfo struct using the parms from the file
            bmi.Size          = Marshal.SizeOf(typeof(BitmapInfoHeader));
            bmi.Width         = m_bmd.Width;
            bmi.Height        = m_bmd.Height * -1;
            bmi.Planes        = 1;
            bmi.BitCount      = 32;
            bmi.Compression   = 0;
            bmi.ImageSize     = (bmi.BitCount / 8) * bmi.Width * bmi.Height;
            bmi.XPelsPerMeter = 0;
            bmi.YPelsPerMeter = 0;
            bmi.ClrUsed       = 0;
            bmi.ClrImportant  = 0;

            int hr = psc.SetMediaTypeFromBitmap(bmi, m_FPS);

            DsError.ThrowExceptionForHR(hr);
        }
Beispiel #2
0
    private void ConfigurePusher(IGenericSampleConfig ips)
    {
        int hr;

        source.SetMediaType(ips);
        // Specify the callback routine to call with each sample
        hr = ips.SetBitmapCB(source);
        DsError.ThrowExceptionForHR(hr);
    }
Beispiel #3
0
        /// <summary>
        /// Populate the media type
        /// </summary>
        /// <param name="psc">IGenericSampleConfig onto which we set the media type</param>
        override public void SetMediaType(IGenericSampleConfig psc)
        {
            AMMediaType amt = new AMMediaType();

            amt.majorType  = MediaType.Stream;
            amt.subType    = MediaSubType.Mpeg2Program;
            amt.formatType = Guid.Empty;

            int hr = psc.SetMediaTypeEx(amt, BUFSIZE);

            DsError.ThrowExceptionForHR(hr);

            DsUtils.FreeAMMediaType(amt);
        }
Beispiel #4
0
        /// <summary>
        /// Set the media type based on values from BASS.DLL
        /// </summary>
        /// <param name="psc">The IGenericSampleConfig onto which we set the mediatype</param>
        override public void SetMediaType(IGenericSampleConfig psc)
        {
            int lFrequency = 0;
            int lVolume    = 0;
            int lPan       = 0;

            WaveFormatEx     w     = new WaveFormatEx();
            BASS_CHANNELINFO lInfo = new BASS_CHANNELINFO();

            Bass.BASS_ChannelGetInfo(m_fChan, lInfo);
            if ((lInfo.flags & (int)BASSStream.BASS_SAMPLE_8BITS) == (int)BASSStream.BASS_SAMPLE_8BITS)
            {
                w.wBitsPerSample = 8;
            }
            else
            {
                w.wBitsPerSample = 16;
            }
            Bass.BASS_ChannelGetAttributes(m_fChan, ref lFrequency, ref lVolume, ref lPan);

            w.cbSize          = (short)Marshal.SizeOf(typeof(WaveFormatEx));
            w.nChannels       = (short)lInfo.chans;
            w.nSamplesPerSec  = lFrequency;
            w.wFormatTag      = 1;
            w.nAvgBytesPerSec = w.nSamplesPerSec * w.nBlockAlign;
            m_BytesPerSample  = (short)(w.nChannels * (w.wBitsPerSample / 8));
            m_Frequency       = lFrequency;
            m_Channels        = lInfo.chans;
            w.nBlockAlign     = (short)m_BytesPerSample;
            w.nAvgBytesPerSec = w.nSamplesPerSec * w.nBlockAlign;

            AMMediaType amt = new AMMediaType();

            amt.majorType  = MediaType.Audio;
            amt.subType    = MediaSubType.PCM;
            amt.formatType = FormatType.WaveEx;
            amt.formatPtr  = Marshal.AllocCoTaskMem(w.cbSize);
            amt.formatSize = w.cbSize;
            Marshal.StructureToPtr(w, amt.formatPtr, false);

            int hr = psc.SetMediaTypeEx(amt, BUFSIZE);

            DsError.ThrowExceptionForHR(hr);

            DsUtils.FreeAMMediaType(amt);
        }
Beispiel #5
0
        /// <summary>
        /// Set the media type on the IGenericSampleConfig
        /// </summary>
        override public void SetMediaType(IGenericSampleConfig psc)
        {
            BitmapInfoHeader bmi = new BitmapInfoHeader();

            // Build a BitmapInfo struct using the parms from the file
            bmi.Size          = Marshal.SizeOf(typeof(BitmapInfoHeader));
            bmi.Width         = WIDTH;
            bmi.Height        = HEIGHT * -1;
            bmi.Planes        = 1;
            bmi.BitCount      = BPP;
            bmi.Compression   = 0;
            bmi.ImageSize     = (bmi.BitCount / 8) * bmi.Width * bmi.Height;
            bmi.XPelsPerMeter = 0;
            bmi.YPelsPerMeter = 0;
            bmi.ClrUsed       = 0;
            bmi.ClrImportant  = 0;

            int hr = psc.SetMediaTypeFromBitmap(bmi, m_FPS);

            DsError.ThrowExceptionForHR(hr);
        }
Beispiel #6
0
    override public void SetMediaType(IGenericSampleConfig psc)
    {
        BitmapInfoHeader bmi = new BitmapInfoHeader();

        bmi.Size          = Marshal.SizeOf(typeof(BitmapInfoHeader));
        bmi.Width         = reader.Header.VideoSize.Width;
        bmi.Height        = reader.Header.VideoSize.Height;
        bmi.Planes        = 1;
        bmi.BitCount      = 24;
        bmi.Compression   = 0;
        bmi.ImageSize     = (bmi.BitCount / 8) * bmi.Width * bmi.Height;
        bmi.XPelsPerMeter = 0;
        bmi.YPelsPerMeter = 0;
        bmi.ClrUsed       = 0;
        bmi.ClrImportant  = 0;
        int hr = psc.SetMediaTypeFromBitmap(bmi, 0);

        buffer         = new byte[reader.Header.FrameSize];
        demosaicBuffer = new byte[reader.Header.FrameSize * 3];
        DsError.ThrowExceptionForHR(hr);
    }
Beispiel #7
0
 abstract public void SetMediaType(IGenericSampleConfig psc);
 public abstract void SetMediaType(IGenericSampleConfig psc);
        /// <summary>
        /// Set the media type on the IGenericSampleConfig
        /// </summary>
        public override void SetMediaType(IGenericSampleConfig psc)
        {
            BitmapInfoHeader bmi = new BitmapInfoHeader();

            // Build a BitmapInfo struct using the parms from the file
            bmi.Size = Marshal.SizeOf(typeof(BitmapInfoHeader));
            bmi.Width = WIDTH;
            bmi.Height = HEIGHT * -1;
            bmi.Planes = 1;
            bmi.BitCount = BPP;
            bmi.Compression = 0;
            bmi.ImageSize = (bmi.BitCount / 8) * bmi.Width * bmi.Height;
            bmi.XPelsPerMeter = 0;
            bmi.YPelsPerMeter = 0;
            bmi.ClrUsed = 0;
            bmi.ClrImportant = 0;

            int hr = psc.SetMediaTypeFromBitmap(bmi, m_FPS);
            DsError.ThrowExceptionForHR(hr);
        }
        /// <summary>
        /// Populate the media type
        /// </summary>
        /// <param name="psc">IGenericSampleConfig onto which we set the media type</param>
        public override void SetMediaType(IGenericSampleConfig psc)
        {
            AMMediaType amt = new AMMediaType();
            amt.majorType = MediaType.Stream;
            amt.subType = MediaSubType.Mpeg2Program;
            amt.formatType = Guid.Empty;

            int hr = psc.SetMediaTypeEx(amt, BUFSIZE);
            DsError.ThrowExceptionForHR(hr);

            DsUtils.FreeAMMediaType(amt);
        }
        /// <summary>
        /// Set the Mediatype from a bitmap
        /// </summary>
        public override void SetMediaType(IGenericSampleConfig psc)
        {
            BitmapInfoHeader bmi = new BitmapInfoHeader();

            // Make sure we have an image to get the data from
            if (m_bmp == null)
            {
                int i;
                IntPtr ip = IntPtr.Zero;
                GetImage(0, ip, 0, out i);
            }

            // Build a BitmapInfo struct using the parms from the file
            bmi.Size = Marshal.SizeOf(typeof(BitmapInfoHeader));
            bmi.Width = m_bmd.Width;
            bmi.Height = m_bmd.Height * -1;
            bmi.Planes = 1;
            bmi.BitCount = 32;
            bmi.Compression = 0;
            bmi.ImageSize = (bmi.BitCount / 8) * bmi.Width * bmi.Height;
            bmi.XPelsPerMeter = 0;
            bmi.YPelsPerMeter = 0;
            bmi.ClrUsed = 0;
            bmi.ClrImportant = 0;

            int hr = psc.SetMediaTypeFromBitmap(bmi, m_FPS);
            DsError.ThrowExceptionForHR(hr);
        }
        /// <summary>
        /// Set the media type based on values from BASS.DLL
        /// </summary>
        /// <param name="psc">The IGenericSampleConfig onto which we set the mediatype</param>
        public override void SetMediaType(IGenericSampleConfig psc)
        {
            int lFrequency = 0;
            int lVolume = 0;
            int lPan = 0;

            WaveFormatEx w = new WaveFormatEx();
            BASS_CHANNELINFO lInfo = new BASS_CHANNELINFO();

            Bass.BASS_ChannelGetInfo(m_fChan, lInfo);
            if ((lInfo.flags & (int)BASSStream.BASS_SAMPLE_8BITS) == (int)BASSStream.BASS_SAMPLE_8BITS)
            {
                w.wBitsPerSample = 8;
            }
            else
            {
                w.wBitsPerSample = 16;
            }
            Bass.BASS_ChannelGetAttributes(m_fChan, ref lFrequency, ref lVolume, ref lPan);

            w.cbSize = (short)Marshal.SizeOf(typeof(WaveFormatEx));
            w.nChannels = (short)lInfo.chans;
            w.nSamplesPerSec = lFrequency;
            w.wFormatTag = 1;
            w.nAvgBytesPerSec = w.nSamplesPerSec * w.nBlockAlign;
            m_BytesPerSample = (short)(w.nChannels * (w.wBitsPerSample / 8));
            m_Frequency = lFrequency;
            m_Channels = lInfo.chans;
            w.nBlockAlign = (short)m_BytesPerSample;
            w.nAvgBytesPerSec = w.nSamplesPerSec * w.nBlockAlign;

            AMMediaType amt = new AMMediaType();
            amt.majorType = MediaType.Audio;
            amt.subType = MediaSubType.PCM;
            amt.formatType = FormatType.WaveEx;
            amt.formatPtr = Marshal.AllocCoTaskMem(w.cbSize);
            amt.formatSize = w.cbSize;
            Marshal.StructureToPtr(w, amt.formatPtr, false);

            int hr = psc.SetMediaTypeEx(amt, BUFSIZE);
            DsError.ThrowExceptionForHR(hr);

            DsUtils.FreeAMMediaType(amt);
        }
Beispiel #13
0
    /// <summary>
    /// Configure the GenericSampleSourceFilter
    /// </summary>
    /// <param name="ips">The interface to the GenericSampleSourceFilter</param>
    private void ConfigurePusher(IGenericSampleConfig ips)
    {
      int hr;

      this.imageHandler.SetMediaType(ips);

      // Specify the callback routine to call with each sample
      hr = ips.SetBitmapCB(this.imageHandler);
      DsError.ThrowExceptionForHR(hr);
    }