예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalogAudioStream"/> class.
 /// </summary>
 public AnalogAudioStream()
 {
     _language   = "";
     _streamType = AudioStreamType.Mpeg2;
     _audioMode  = TVAudioMode.Stereo;
     _audioPid   = -1;
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalogAudioStream"/> class.
 /// </summary>
 public AnalogAudioStream()
 {
   _language = "";
   _streamType = AudioStreamType.Mpeg2;
   _audioMode = TVAudioMode.Stereo;
   _audioPid = -1;
 }
예제 #3
0
        public override void SubmitTuneRequest(Channel channel)
        {
            if (channel is ChannelAnalogic)
            {
                ChannelAnalogic channelAnalogic = channel as ChannelAnalogic;

                int hr = 0;

                //SetCaptureResolution(this.captureFormat); // channelAnalogic.CaptureResolution);

                if (this.videoCaptureFilter != null)
                {
                    IAMAnalogVideoDecoder analogVideoDecoder = this.videoCaptureFilter as IAMAnalogVideoDecoder;
                    if (analogVideoDecoder != null)
                    {
                        AnalogVideoStandard videoStandard;
                        hr = analogVideoDecoder.get_TVFormat(out videoStandard);
                        if (videoStandard != channelAnalogic.VideoStandard)
                        {
                            hr = analogVideoDecoder.put_TVFormat(channelAnalogic.VideoStandard);
                        }
                    }
                }

                if (this.tuner != null)
                {
                    int tuningSpace = 0;
                    hr = this.tuner.get_TuningSpace(out tuningSpace);
                    if (hr < 0 || channelAnalogic.TuningSpace != tuningSpace)
                    {
                        this.tuner.put_TuningSpace(channelAnalogic.TuningSpace);
                    }

                    int countryCode = 0;
                    hr = this.tuner.get_CountryCode(out countryCode);
                    if (hr < 0 || channelAnalogic.CountryCode != countryCode)
                    {
                        this.tuner.put_CountryCode(channelAnalogic.CountryCode);
                    }

                    int connectInput = 0;
                    hr = this.tuner.get_ConnectInput(out connectInput);
                    if (hr < 0 || channelAnalogic.ConnectInput != connectInput)
                    {
                        this.tuner.put_ConnectInput(channelAnalogic.ConnectInput);
                    }

                    TunerInputType inputType = TunerInputType.Antenna;
                    hr = this.tuner.get_InputType(channelAnalogic.ConnectInput, out inputType);
                    if (hr < 0 || channelAnalogic.InputType != inputType)
                    {
                        this.tuner.put_InputType(channelAnalogic.ConnectInput, channelAnalogic.InputType);
                    }

                    AMTunerModeType mode = AMTunerModeType.Default;
                    hr = this.tuner.get_Mode(out mode);
                    if (hr < 0 || channelAnalogic.Mode != mode)
                    {
                        this.tuner.put_Mode(channelAnalogic.Mode);
                    }

                    if (channelAnalogic.Channel > 0)
                    {
                        hr = this.tuner.put_Channel(channelAnalogic.Channel, AMTunerSubChannel.Default, AMTunerSubChannel.Default);
                        DsError.ThrowExceptionForHR(hr);
                    }

                    //int plChannel;
                    //AMTunerSubChannel plVideoSubChannel;
                    //AMTunerSubChannel plAudioSubChannel;
                    //hr = this.tuner.get_Channel(out plChannel, out plVideoSubChannel, out plAudioSubChannel);

                    //if (plChannel != channelAnalogic.Channel)
                    //{
                    //    DsError.ThrowExceptionForHR(-2147024809);
                    //}
                }

                if (this.amTVAudio != null && channelAnalogic.AudioMode != TVAudioMode.None)
                {
                    TVAudioMode audioMode = TVAudioMode.Stereo;
                    hr = this.amTVAudio.get_TVAudioMode(out audioMode);
                    if (hr < 0 || channelAnalogic.AudioMode != audioMode)
                    {
                        this.amTVAudio.put_TVAudioMode(channelAnalogic.AudioMode);
                    }
                }


                if (WDMCrossbar != null)
                {
                    try
                    {
                        if (channelAnalogic.AudioSource != WDMCrossbar.GetAudioInput())
                        {
                            WDMCrossbar.SetAudioInput(channelAnalogic.AudioSource, false);
                        }
                    }
                    catch { }

                    try
                    {
                        if (channelAnalogic.VideoSource != WDMCrossbar.GetVideoInput())
                        {
                            WDMCrossbar.SetVideoInput(channelAnalogic.VideoSource, false);
                        }
                    }
                    catch { }
                }

                RunGraph();
            }

            if (useWPF)
            {
                WpfUpdateVideoSize();
            }
        }