本文整理汇总了C#中IBasicAudio类的典型用法代码示例。如果您正苦于以下问题:C# IBasicAudio类的具体用法?C# IBasicAudio怎么用?C# IBasicAudio使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBasicAudio类属于命名空间,在下文中一共展示了IBasicAudio类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PlayerCore
public PlayerCore(string file)
{
graphBuilder = (new FilterGraph()) as IFilterGraph2;
if (graphBuilder == null) return;
mediaControl = graphBuilder as IMediaControl;
mediaSeeking = graphBuilder as IMediaSeeking;
audioControl = graphBuilder as IBasicAudio;
if (mediaControl == null || mediaSeeking == null || audioControl == null) return;
//int hr = mediaControl.RenderFile(file);
FileInfo info = new FileInfo(file);
ISupport support = Supports.Instance[info.Extension];
int hr = -1;
if (support != null)
hr = support.RenderGraph(graphBuilder, file);
else
hr = mediaControl.RenderFile(file);
fileName = file;
if (hr != 0) errorStack.Push(hr);
if (hr != 0) return;
mediaSeeking.SetTimeFormat(TimeFormat.MediaTime);
isValidate = true;
window = graphBuilder as IVideoWindow;
if (window != null)
{
int width = 0;
int height = 0;
window.get_Width(out width);
window.get_Height(out height);
nativeSize = new Size(width, height);
}
}
开发者ID:crazyender,项目名称:Console-Player,代码行数:32,代码来源:core.cs
示例2: Play
//TODO Fichier déjà utilisé.... surement par Quartz. Essayer de libérer les ressources de la librairie
public void Play(Guid id, byte[] file)
{
objFilterGraph = new FilgraphManager();
audio = (IBasicAudio) objFilterGraph;
//pb d'accès concurrenciel
string path = ConfigurationManager.AppSettings["MediaCache"] + id + ".mp3";
File.WriteAllBytes(path, file);
objFilterGraph.RenderFile(path);
objMediaPosition = objFilterGraph as IMediaPosition;
objFilterGraph.Run();
tmProgressionFlux = new Timer(1000) { Enabled = true };
tmProgressionFlux.Elapsed += TmProgressionFluxTick;
TimerResume();
}
开发者ID:naturalevolution,项目名称:MonkeyMusicCloud,代码行数:18,代码来源:DirectPlayer.cs
示例3: ShowMedia
/// <summary>
/// Plays the given mediafile in the internal mediaplayer
/// </summary>
/// <param name="FilePath">File to play</param>
public void ShowMedia(string FilePath)
{
StopMedia();
Lbl_CurrentMedia.Text = Path.GetFileName(FilePath);
m_objFilterGraph = new FilgraphManager();
m_objFilterGraph.RenderFile(FilePath);
m_objBasicAudio = m_objFilterGraph as IBasicAudio;
try
{
m_objVideoWindow = m_objFilterGraph as IVideoWindow;
m_objVideoWindow.Owner = (int)panel2.Handle;
//m_objVideoWindow.Owner = (int)panel1.Handle;
m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
m_objVideoWindow.SetWindowPosition(panel2.ClientRectangle.Left,
panel2.ClientRectangle.Top,
panel2.ClientRectangle.Width,
panel2.ClientRectangle.Height);
}
catch (Exception ex)
{
Console.WriteLine(ex);
m_objVideoWindow = null;
}
m_objMediaEvent = m_objFilterGraph as IMediaEvent;
m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);
m_objMediaPosition = m_objFilterGraph as IMediaPosition;
m_objMediaControl = m_objFilterGraph as IMediaControl;
m_objMediaControl.Run();
m_CurrentStatus = MediaStatus.Running;
UpdateMediaButtons();
//UpdateStatusBar();
//UpdateToolBar();
}
开发者ID:szopenfx,项目名称:code,代码行数:47,代码来源:GraphicalInterface2.cs
示例4: InitGraph
private void InitGraph(string filename)
{
int hr = 0;
//IntPtr hEvent;
if (filename == string.Empty)
return;
this.filterGraph = new FilterGraph() as IFilterGraph2;
#if DEBUG
//rot = new DsROTEntry(this.filterGraph);
#endif
// Have the graph builder construct its the appropriate graph automatically
hr = this.filterGraph.RenderFile(filename, null);
DsError.ThrowExceptionForHR(hr);
// QueryInterface for DirectShow interfaces
this.mediaControl = this.filterGraph as IMediaControl;
this.mediaSeeking = this.filterGraph as IMediaSeeking;
//this.mediaEvent = this.graphBuilder as IMediaEvent;
// Query for audio interfaces, which may not be relevant for video-only files
this.basicAudio = this.filterGraph as IBasicAudio;
// Complete window initialization
this.currentPlaybackRate = 1.0;
}
开发者ID:DeSciL,项目名称:Ogama,代码行数:29,代码来源:AudioPlayer.cs
示例5: SyncAudioRenderer
protected void SyncAudioRenderer()
{
if (_audioRendererFilter != null)
{
//Log.Info("BDPlayer:set reference clock");
IMediaFilter mp = (IMediaFilter)_graphBuilder;
IReferenceClock clock = (IReferenceClock)_audioRendererFilter;
int hr = mp.SetSyncSource(null);
hr = mp.SetSyncSource(clock);
//Log.Info("BDPlayer:set reference clock:{0:X}", hr);
_basicAudio = (IBasicAudio)_graphBuilder;
}
}
开发者ID:Erls-Corporation,项目名称:MediaPortal-1,代码行数:13,代码来源:BDPlayer.cs
示例6: PlayMovieInWindow
//.........这里部分代码省略.........
if (EVRControl == null)
{
//Ищем рендерер и ВКЛЮЧАЕМ соблюдение аспекта (рендерер сам подгонит картинку под размер окна, с учетом аспекта)
IsRendererARFixed = false;
IBaseFilter filter = null;
graphBuilder.FindFilterByName("Video Renderer", out filter);
if (filter != null)
{
IVMRAspectRatioControl vmr = filter as IVMRAspectRatioControl;
if (vmr != null)
{
DsError.ThrowExceptionForHR(vmr.SetAspectRatioMode(VMRAspectRatioMode.LetterBox));
IsRendererARFixed = true;
}
}
else
{
graphBuilder.FindFilterByName("Video Mixing Renderer 9", out filter);
if (filter != null)
{
IVMRAspectRatioControl9 vmr9 = filter as IVMRAspectRatioControl9;
if (vmr9 != null)
{
DsError.ThrowExceptionForHR(vmr9.SetAspectRatioMode(VMRAspectRatioMode.LetterBox));
IsRendererARFixed = true;
}
}
}
}
else
IsRendererARFixed = true;
this.mediaControl = (IMediaControl)this.graphBuilder;
this.mediaEventEx = (IMediaEventEx)this.graphBuilder;
this.mediaSeeking = (IMediaSeeking)this.graphBuilder;
this.mediaPosition = (IMediaPosition)this.graphBuilder;
this.videoWindow = (EVRControl == null) ? this.graphBuilder as IVideoWindow : null;
this.basicVideo = (EVRControl == null) ? this.graphBuilder as IBasicVideo : null;
this.basicAudio = this.graphBuilder as IBasicAudio;
this.basicAudio.put_Volume(VolumeSet);
this.CheckIsAudioOnly();
if (!this.isAudioOnly)
{
if (videoWindow != null)
{
hr = this.videoWindow.put_Owner(this.source.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_MessageDrain(this.source.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_WindowStyle(DirectShowLib.WindowStyle.Child | DirectShowLib.WindowStyle.ClipSiblings | DirectShowLib.WindowStyle.ClipChildren);
DsError.ThrowExceptionForHR(hr);
}
this.MoveVideoWindow();
}
else
{
if (VHost != null)
{
VHost.Dispose();
VHost = null;
VHandle = IntPtr.Zero;
VHostElement.Child = null;
VHostElement.Visibility = Visibility.Collapsed;
}
}
hr = this.mediaEventEx.SetNotifyWindow(this.source.Handle, WMGraphNotify, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
//Восстанавливаем старую позицию
if (mediaload == MediaLoad.Update && oldpos != TimeSpan.Zero)
{
if (NaturalDuration >= oldpos)
{
hr = mediaPosition.put_CurrentPosition(oldpos.TotalSeconds);
DsError.ThrowExceptionForHR(hr);
}
}
//Восстанавливаем старый PlayState
if (mediaload == MediaLoad.Update && (oldplaystate == PlayState.Paused || oldplaystate == PlayState.Stopped))
{
hr = this.mediaControl.Pause();
DsError.ThrowExceptionForHR(hr);
this.currentState = PlayState.Paused;
this.SetPlayIcon();
}
else
{
hr = this.mediaControl.Run();
DsError.ThrowExceptionForHR(hr);
this.currentState = PlayState.Running;
this.SetPauseIcon();
}
AddFiltersToMenu();
}
开发者ID:MaksHDR,项目名称:xvid4psp,代码行数:101,代码来源:MainWindow.xaml.cs
示例7: GetInterfaces
//.........这里部分代码省略.........
graphBuilder.Render(pins[0]);
}
}
#endregion
// Connect DVB subtitle filter pins in the graph
if (_mpegDemux != null && enableDvbSubtitles == true)
{
IMpeg2Demultiplexer demuxer = _mpegDemux as IMpeg2Demultiplexer;
hr = demuxer.CreateOutputPin(GetTSMedia(), "Pcr", out _pinPcr);
if (hr == 0)
{
Log.Info("RTSPPlayer:_pinPcr OK");
IPin pDemuxerPcr = DsFindPin.ByName(_mpegDemux, "Pcr");
IPin pSubtitlePcr = DsFindPin.ByName(_subtitleFilter, "Pcr");
hr = graphBuilder.Connect(pDemuxerPcr, pSubtitlePcr);
}
else
{
Log.Info("RTSPPlayer:Failed to create _pinPcr in demuxer:{0:X}", hr);
}
hr = demuxer.CreateOutputPin(GetTSMedia(), "Subtitle", out _pinSubtitle);
if (hr == 0)
{
Log.Info("RTSPPlayer:_pinSubtitle OK");
IPin pDemuxerSubtitle = DsFindPin.ByName(_mpegDemux, "Subtitle");
IPin pSubtitle = DsFindPin.ByName(_subtitleFilter, "In");
hr = graphBuilder.Connect(pDemuxerSubtitle, pSubtitle);
}
else
{
Log.Info("RTSPPlayer:Failed to create _pinSubtitle in demuxer:{0:X}", hr);
}
hr = demuxer.CreateOutputPin(GetTSMedia(), "PMT", out _pinPMT);
if (hr == 0)
{
Log.Info("RTSPPlayer:_pinPMT OK");
IPin pDemuxerSubtitle = DsFindPin.ByName(_mpegDemux, "PMT");
IPin pSubtitle = DsFindPin.ByName(_subtitleFilter, "PMT");
hr = graphBuilder.Connect(pDemuxerSubtitle, pSubtitle);
}
else
{
Log.Info("RTSPPlayer:Failed to create _pinPMT in demuxer:{0:X}", hr);
}
}
if (IsRadio == false)
{
if (!VMR9Util.g_vmr9.IsVMR9Connected)
{
//VMR9 is not supported, switch to overlay
Log.Info("RTSPPlayer: vmr9 not connected");
_mediaCtrl = null;
Cleanup();
return false;
}
VMR9Util.g_vmr9.SetDeinterlaceMode();
}
_mediaCtrl = (IMediaControl)graphBuilder;
mediaEvt = (IMediaEventEx)graphBuilder;
_mediaSeeking = (IMediaSeeking)graphBuilder;
mediaPos = (IMediaPosition)graphBuilder;
basicAudio = graphBuilder as IBasicAudio;
//DirectShowUtil.SetARMode(graphBuilder,AspectRatioMode.Stretched);
DirectShowUtil.EnableDeInterlace(graphBuilder);
if (VMR9Util.g_vmr9 != null)
{
m_iVideoWidth = VMR9Util.g_vmr9.VideoWidth;
m_iVideoHeight = VMR9Util.g_vmr9.VideoHeight;
}
if (audioRendererFilter != null)
{
Log.Info("RTSPPlayer9:set reference clock");
IMediaFilter mp = graphBuilder as IMediaFilter;
IReferenceClock clock = audioRendererFilter as IReferenceClock;
hr = mp.SetSyncSource(null);
hr = mp.SetSyncSource(clock);
Log.Info("RTSPPlayer9:set reference clock:{0:X}", hr);
}
Log.Info("RTSPPlayer: graph build successfull");
return true;
}
catch (Exception ex)
{
Error.SetError("Unable to play movie", "Unable build graph for VMR9");
Log.Error("RTSPPlayer:exception while creating DShow graph {0} {1}", ex.Message, ex.StackTrace);
CloseInterfaces();
return false;
}
}
开发者ID:MediaPortal,项目名称:MediaPortal-1,代码行数:101,代码来源:RTSPPlayer.cs
示例8: Init
public override void Init()
{
if (!isPlaying)
{
string Filename = "";
float size = 0;
double Max = 0;
int volume = 0;
graph = new FilterGraph() as IFilterGraph;
media = graph as IMediaControl;
eventEx = media as IMediaEventEx;
igb = media as IGraphBuilder;
imp = igb as IMediaPosition;
master.form.Invoke((MethodInvoker)delegate()
{
Filename = master.form.M_Filename.Text;
media.RenderFile(Filename);
size = (float)master.form.M_PrevSize.Value;
master.form.M_PrevSize.Enabled = false;
imp.get_Duration(out Max);
master.form.M_Seek.Maximum = (int)(Max);
master.form.M_Seek.Value = 0;
volume = master.form.M_Volume.Value;
span = (uint)(1000000.0f / master.form.M_CollectFPS);
});
graph.FindFilterByName("Video Renderer", out render);
if (render != null)
{
window = render as IVideoWindow;
window.put_WindowStyle(
WindowStyle.Caption | WindowStyle.Child
);
window.put_WindowStyleEx(
WindowStyleEx.ToolWindow
);
window.put_Caption("ElectronicBoard - VideoPrev -");
int Width, Height, Left, Top;
window.get_Width(out Width);
window.get_Height(out Height);
window.get_Left(out Left);
window.get_Top(out Top);
renderSize.Width = (int)(Width * size);
renderSize.Height = (int)(Height * size);
Aspect = (float)renderSize.Height / (float)renderSize.Width;
window.SetWindowPosition(Left, Top, renderSize.Width, renderSize.Height);
eventEx = media as IMediaEventEx;
eventEx.SetNotifyWindow(master.form.Handle, WM_DirectShow, IntPtr.Zero);
media.Run();
foreach (Process p in Process.GetProcesses())
{
if (p.MainWindowTitle == "ElectronicBoard - VideoPrev -")
{
renderwindow = p.MainWindowHandle;
break;
}
}
isPlaying = true;
iba = media as IBasicAudio;
iba.put_Volume(volume);
//master.form.checkBox3_CheckedChanged(null, null);
master.Start();
}
}
}
开发者ID:Surigoma,项目名称:Electronicboard,代码行数:68,代码来源:Movie.cs
示例9: OpenStream
//
// Starts playback for the selected stream at the specified time
//
int OpenStream(string videopath, double videotime)
{
double td; // store stream duration;
int hr = 0;
// animate bt logo
// logo_webbrowser.Refresh();
// cover overlay options with video or not
// if overlay is active
////////if (OverlayButton.Checked) // Overlay button config - Melek
////////{
//////// VideoPanel.Width = VideoPlayerPanel.Width - OverlayPanel.Width;
//////// OverlayBar.Location = new System.Drawing.Point(-1, -1); ;
//////// OverlayBar.Text = ">";
////////}
////////else
////////// if overlay is not active
////////{
//////// VideoPanel.Width = VideoPlayerPanel.Width - OverlayBar.Width;
//////// OverlayBar.Location = new System.Drawing.Point(OverlayPanel.Width - OverlayBar.Width - 1, -1); ;
//////// OverlayBar.Text = "<";
////////}
filename = videopath;
try//Melek
{
if (filename == string.Empty)
return -1;
// this.graphBuilder = (IGraphBuilder)new FilterGraph();
this.graphBuilder = (IFilterGraph2)new FilterGraph();
// We manually add the VMR (video mixer/renderer) filter so that we can set it into "mixing" mode.
// That is needed so that the VMR will deinterlace before playing back
VideoMixingRenderer vmr = new VideoMixingRenderer(); //Tom's deinterlace changes
graphBuilder.AddFilter((IBaseFilter)vmr, "vmr");//Tom's deinterlace changes
IVMRFilterConfig vmrConfig = vmr as IVMRFilterConfig;//Tom's deinterlace changes
int nRet = vmrConfig.SetNumberOfStreams(1);//Tom's deinterlace changes
// BuildVideoGraph(videopath); //No more overlay - Melek
hr = this.graphBuilder.RenderFile(filename, null);//MELek - instead of calling BuildVideoGraph function call RenderFile function directly
DsError.ThrowExceptionForHR(hr);//Melek
// QueryInterface for DirectShow interfaces
this.mediaControl = (IMediaControl)this.graphBuilder;
this.mediaEventEx = (IMediaEventEx)this.graphBuilder;
this.mediaSeeking = (IMediaSeeking)this.graphBuilder;
this.mediaPosition = (IMediaPosition)this.graphBuilder;
// Query for video interfaces, which may not be relevant for audio files
this.videoWindow = this.graphBuilder as IVideoWindow;
this.basicVideo = this.graphBuilder as IBasicVideo;
// Query for audio interfaces, which may not be relevant for video-only files
this.basicAudio = this.graphBuilder as IBasicAudio;
// Is this an audio-only file (no video component)?
CheckVisibility();
// Have the graph signal event via window callbacks for performance
hr = this.mediaEventEx.SetNotifyWindow(this.Handle, WMGraphNotify, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
//if (!this.isAudioOnly)
//{
// Setup the video window
hr = this.videoWindow.put_Owner(this.VideoPanel.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
DsError.ThrowExceptionForHR(hr);
hr = InitVideoWindow(1, 1);
DsError.ThrowExceptionForHR(hr);
GetFrameStepInterface();
//}
//else
//{
// Initialize the default player size
// hr = InitPlayerWindow();
// DsError.ThrowExceptionForHR(hr);
//EnablePlaybackMenu(true, MediaType.Audio);
//}
// Complete window initialization
//CheckSizeMenu(menuFileSizeNormal);
//this.isFullScreen = false;
this.currentPlaybackRate = 1.0;
#if DEBUG
rot = new DsROTEntry(this.graphBuilder);
#endif
//.........这里部分代码省略.........
开发者ID:mguthrie777,项目名称:demo-newstuff,代码行数:101,代码来源:GUI.cs
示例10: GetDVDInterfaces
//.........这里部分代码省略.........
catch (Exception ex)
{
string strEx = ex.Message;
}
Guid riid;
if (_dvdInfo == null)
{
riid = typeof(IDvdInfo2).GUID;
hr = _dvdGraph.GetDvdInterface(riid, out comobj);
if (hr < 0)
{
Marshal.ThrowExceptionForHR(hr);
}
_dvdInfo = (IDvdInfo2)comobj;
comobj = null;
}
if (_dvdCtrl == null)
{
riid = typeof(IDvdControl2).GUID;
hr = _dvdGraph.GetDvdInterface(riid, out comobj);
if (hr < 0)
{
Marshal.ThrowExceptionForHR(hr);
}
_dvdCtrl = (IDvdControl2)comobj;
comobj = null;
}
_mediaCtrl = (IMediaControl)_graphBuilder;
_mediaEvt = (IMediaEventEx)_graphBuilder;
_basicAudio = _graphBuilder as IBasicAudio;
_mediaPos = (IMediaPosition)_graphBuilder;
_mediaSeek = (IMediaSeeking)_graphBuilder;
_mediaStep = (IVideoFrameStep)_graphBuilder;
_basicVideo = _graphBuilder as IBasicVideo2;
_videoWin = _graphBuilder as IVideoWindow;
// disable Closed Captions!
IBaseFilter baseFilter;
_graphBuilder.FindFilterByName("Line 21 Decoder", out baseFilter);
if (baseFilter == null)
{
_graphBuilder.FindFilterByName("Line21 Decoder", out baseFilter);
}
if (baseFilter != null)
{
_line21Decoder = (IAMLine21Decoder)baseFilter;
if (_line21Decoder != null)
{
AMLine21CCState state = AMLine21CCState.Off;
hr = _line21Decoder.SetServiceState(state);
if (hr == 0)
{
logger.Info("DVDPlayer:Closed Captions disabled");
}
else
{
logger.Info("DVDPlayer:failed 2 disable Closed Captions");
}
}
}
/*
// get video window
开发者ID:andrewjswan,项目名称:mvcentral,代码行数:67,代码来源:Grabber.cs
示例11: ResumePlayingAudio
public void ResumePlayingAudio()
{
lock(fgmLock)
{
if(fgmState != FilterGraph.State.Running)
{
fgmState = FilterGraph.State.Running;
if (fgm != null)
{
iBA = (IBasicAudio)fgm;
// Note: We use the currentVolume member to set the volume.
// This member is actually initialized in SetVolume
// in case SetVolume was called before the fgm (and iBA)
// was created (before stream added is called)
SetVolume(currentVolume);
// MethodInvoke the PositionVolumeSlider to set the position of the slider in the AV form
// Note: There is no parameter. The AV from reads the volume parameter using the
// volume accessor in AudioCapability.
((FAudioVideo)form).PositionVolumeSlider();
// We need to manually block the stream to reset its state in case it
// became inconsistent during shutdown
if(rtpStream != null)
{
rtpStream.BlockNextFrame();
}
fgm.Run();
}
uiState &= ~(int)FAudioVideo.UIState.LocalAudioPlayStopped;
((FAudioVideo)form).UpdateAudioUI(uiState);
}
}
}
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:37,代码来源:AudioCapability.cs
示例12: _RtpStream_FirstFrameReceived
/// <summary>
/// Creation of the fgm and the adding / removing of filters needs to happen on the
/// same thread. So make sure it all happens on the UI thread.
/// </summary>
private void _RtpStream_FirstFrameReceived()
{
lock(fgmLock)
{
DisposeFgm();
Debug.Assert(fgm == null);
fgm = new FilgraphManagerClass();
IGraphBuilder iGB = (IGraphBuilder)fgm;
rotID = FilterGraph.AddToRot(iGB);
IBaseFilter rtpSource = RtpSourceClass.CreateInstance();
((MSR.LST.MDShow.Filters.IRtpSource)rtpSource).Initialize(rtpStream);
iGB.AddFilter(rtpSource, "RtpSource");
// Add the chosen audio renderer
FilterInfo fi = SelectedSpeaker();
iGB.AddFilter(Filter.CreateBaseFilter(fi), fi.Name);
iGB.Render(Filter.GetPin(rtpSource, _PinDirection.PINDIR_OUTPUT, Guid.Empty,
Guid.Empty, false, 0));
iBA = (IBasicAudio)fgm;
currentVolume = (int)Math.Round(Math.Pow(10.0, (2.0*(double)(iBA.Volume+10000))/10000.0));
iBA = null;
uiState &= ~(int)FAudioVideo.UIState.RemoteAudioStopped;
if(form != null)
{
((FAudioVideo)form).UpdateAudioUI(uiState);
}
// FirstFrameReceived interprets fgmState as the *desired* state for the fgm
// Because ResumePlayingAudio won't actually start if the state is already
// Running, we change it to Stopped so that it will start
if(IsPlaying && fgmState == FilterGraph.State.Running)
{
fgmState = FilterGraph.State.Stopped;
ResumePlayingAudio();
}
}
}
开发者ID:psyCHOder,项目名称:conferencexp,代码行数:48,代码来源:AudioCapability.cs
示例13: SetBasicAudioInterface
/// <summary>
/// Sets the basic audio interface for controlling
/// volume and balance
/// </summary>
protected void SetBasicAudioInterface(IBasicAudio basicAudio)
{
m_basicAudio = basicAudio;
}
开发者ID:fivesixty,项目名称:StandaloneMB,代码行数:8,代码来源:BaseClasses.cs
示例14: openMedia
private void openMedia()
{
openFileDialog1.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*";
if (DialogResult.OK == openFileDialog1.ShowDialog()) {
CleanUp();
m_objFilterGraph = new FilgraphManager();
m_objFilterGraph.RenderFile(openFileDialog1.FileName);
m_objBasicAudio = m_objFilterGraph as IBasicAudio;
try
{
m_objVideoWindow = m_objFilterGraph as IVideoWindow;
m_objVideoWindow.Owner = (int)panel1.Handle;
m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
panel1.ClientRectangle.Top,
panel1.ClientRectangle.Width,
panel1.ClientRectangle.Height);
}
catch(Exception) {
m_objVideoWindow = null;
}
m_objMediaEvent = m_objFilterGraph as IMediaEvent;
m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
m_objMediaEventEx.SetNotifyWindow((int) this.Handle, WM_GRAPHNOTIFY, 0);
m_objMediaPosition = m_objFilterGraph as IMediaPosition;
m_objMediaControl = m_objFilterGraph as IMediaControl;
this.Text = "Whistle- " + openFileDialog1.FileName + "]";
m_objMediaControl.Run();
m_CurrentStatus = MediaStatus.Running;
}
}
开发者ID:RoseySoft,项目名称:Whistle,代码行数:34,代码来源:Form1.cs
示例15: PlayMovieInWindow
private void PlayMovieInWindow(string filename)
{
int hr = 0;
if (filename == string.Empty)
return;
this.graphBuilder = (IGraphBuilder) new FilterGraph();
// Have the graph builder construct its the appropriate graph automatically
hr = this.graphBuilder.RenderFile(filename, null);
DsError.ThrowExceptionForHR(hr);
// QueryInterface for DirectShow interfaces
this.mediaControl = (IMediaControl) this.graphBuilder;
this.mediaEventEx = (IMediaEventEx) this.graphBuilder;
this.mediaSeeking = (IMediaSeeking) this.graphBuilder;
this.mediaPosition = (IMediaPosition) this.graphBuilder;
// Query for video interfaces, which may not be relevant for audio files
this.videoWindow = this.graphBuilder as IVideoWindow;
this.basicVideo = this.graphBuilder as IBasicVideo;
// Query for audio interfaces, which may not be relevant for video-only files
this.basicAudio = this.graphBuilder as IBasicAudio;
// Is this an audio-only file (no video component)?
CheckVisibility();
// Have the graph signal event via window callbacks for performance
hr = this.mediaEventEx.SetNotifyWindow(this.Handle, WMGraphNotify, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
if (!this.isAudioOnly)
{
// Setup the video window
hr = this.videoWindow.put_Owner(this.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
DsError.ThrowExceptionForHR(hr);
hr = InitVideoWindow(1, 1);
DsError.ThrowExceptionForHR(hr);
GetFrameStepInterface();
}
else
{
// Initialize the default player size and enable playback menu items
hr = InitPlayerWindow();
DsError.ThrowExceptionForHR(hr);
EnablePlaybackMenu(true, MediaType.Audio);
}
// Complete window initialization
CheckSizeMenu(menuFileSizeNormal);
this.isFullScreen = false;
this.currentPlaybackRate = 1.0;
UpdateMainTitle();
#if DEBUG
rot = new DsROTEntry(this.graphBuilder);
#endif
this.Focus();
// Run the graph to play the media file
hr = this.mediaControl.Run();
DsError.ThrowExceptionForHR(hr);
this.currentState=PlayState.Running;
}
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:74,代码来源:MainForm.cs
示例16: AudioAnimate
// Methods
internal AudioAnimate(string prefix, string localname, string ns, SvgDocument doc)
: base(prefix, localname, ns, doc)
{
this.m_objFilterGraph = null;
this.m_objBasicAudio = null;
this.m_objMediaEvent = null;
this.m_objMediaEventEx = null;
this.m_objMediaPosition = null;
this.m_objMediaControl = null;
this.fillColor = Color.Khaki;
this.fileName = string.Empty;
this.m_CurrentStatus = MediaStatus.None;
this.timer = new Timer();
this.oldtime = 0f;
this.timertime = 0f;
this.timer.Interval = 100;
this.timer.Tick += new EventHandler(this.TimerTick);
}
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:19,代码来源:AudioAnimate.cs
示例17: CleanUp
//Метод CleanUp (Зачистка графов)
public void CleanUp()
{
if (mediaControl != null) mediaControl.Stop();
CurrentStatus = mStatus.Stop;
if (videoWindow != null)
{
videoWindow.put_Visible(0);
videoWindow.put_Owner(new IntPtr(0));
}
if (mediaControl != null) mediaControl = null;
if (mediaPosition != null) mediaPosition = null;
if (mediaEventEx != null) mediaEventEx = null;
if (mediaEvent != null) mediaEvent = null;
if (videoWindow != null) videoWindow = null;
if (basicAudio != null) basicAudio = null;
if (graphBuilder != null) graphBuilder = null;
}
开发者ID:NVZver,项目名称:DirectShow,代码行数:19,代码来源:Media.cs
示例18: CleanUp
/**
* To clean up the FilterGraph and other Objects
* */
public void CleanUp()
{
if (m_objMediaControl != null)
m_objMediaControl.Stop();
if (m_objMediaEventEx != null)
m_objMediaEventEx.SetNotifyWindow(0, 0, 0);
if (m_objVideoWindow != null)
{
m_objVideoWindow.Visible = 0;
m_objVideoWindow.Owner = 0;
}
if (m_objMediaControl != null) m_objMediaControl = null;
if (m_objMediaPosition != null) m_objMediaPosition = null;
if (m_objMediaEventEx != null) m_objMediaEventEx = null;
if (m_objMediaEvent != null) m_objMediaEvent = null;
if (m_objVideoWindow != null) m_objVideoWindow = null;
if (m_objBasicAudio != null) m_objBasicAudio = null;
if (m_objFilterGraph != null) m_objFilterGraph = null;
}
开发者ID:krgaurav,项目名称:GRSMediaPLayer,代码行数:25,代码来源:functions.cs
示例19: CloseInterfaces
private void CloseInterfaces()
{
int hr = 0;
try
{
lock(this)
{
// Relinquish ownership (IMPORTANT!) after hiding video window
if (!this.isAudioOnly)
{
hr = this.videoWindow.put_Visible(OABool.False);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_Owner(IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
}
if (this.mediaEventEx != null)
{
hr = this.mediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
}
#if DEBUG
if (rot != null)
{
rot.Dispose();
rot = null;
}
#endif
// Release and zero DirectShow interfaces
if (this.mediaEventEx != null)
this.mediaEventEx = null;
if (this.mediaSeeking != null)
this.mediaSeeking = null;
if (this.mediaPosition != null)
this.mediaPosition = null;
if (this.mediaControl != null)
this.mediaControl = null;
if (this.basicAudio != null)
this.basicAudio = null;
if (this.basicVideo != null)
this.basicVideo = null;
if (this.videoWindow != null)
this.videoWindow = null;
if (this.frameStep != null)
this.frameStep = null;
if (this.graphBuilder != null)
Marshal.ReleaseComObject(this.graphBuilder); this.graphBuilder = null;
GC.Collect();
}
}
catch
{
}
}
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:57,代码来源:MainForm.cs
示例20: ResetLocalGraphResources
/// <summary>
/// Resets the local graph resources to their
/// default settings
/// </summary>
private void ResetLocalGraphResources()
{
m_basicAudio = null;
m_mediaControl = null;
m_mediaEvent = null;
}
开发者ID:fivesixty,项目名称:StandaloneMB,代码行数:10,代码来源:BaseClasses.cs
注:本文中的IBasicAudio类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License |
请发表评论