本文整理汇总了C#中DsROTEntry类的典型用法代码示例。如果您正苦于以下问题:C# DsROTEntry类的具体用法?C# DsROTEntry怎么用?C# DsROTEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DsROTEntry类属于命名空间,在下文中一共展示了DsROTEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildGraph
/// <summary>
/// Builds the graph.
/// </summary>
public override void BuildGraph()
{
try
{
if (_graphState != GraphState.Idle)
{
Log.Log.Error("dvbt:Graph already built");
throw new TvException("Graph already build");
}
Log.Log.WriteFile("dvbt:BuildGraph");
_graphBuilder = (IFilterGraph2)new FilterGraph();
_capBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
_capBuilder.SetFiltergraph(_graphBuilder);
_rotEntry = new DsROTEntry(_graphBuilder);
AddNetworkProviderFilter(typeof (DVBTNetworkProvider).GUID);
AddTsWriterFilterToGraph();
if (!useInternalNetworkProvider)
{
CreateTuningSpace();
AddMpeg2DemuxerToGraph();
}
AddAndConnectBDABoardFilters(_device);
string graphName = _device.Name + " - DVBT Graph.grf";
FilterGraphTools.SaveGraphFile(_graphBuilder, graphName);
GetTunerSignalStatistics();
_graphState = GraphState.Created;
}
catch (Exception ex)
{
Log.Log.Write(ex);
Dispose();
_graphState = GraphState.Idle;
throw new TvExceptionGraphBuildingFailed("Graph building failed", ex);
}
}
示例2: SimplePlayer
/// <summary>
/// This constructor internally build a DirectShow graph using the given file name parameter.
/// </summary>
/// <param name="filename">A media file.</param>
/// <remarks>This constructor use the BlackListManager class to bane the use of the ffdshow Audio and Video decoders during the Intelligent Connect graph building.</remarks>
public SimplePlayer(string filename)
{
if (string.IsNullOrEmpty(filename))
throw new ArgumentNullException("filename");
if (!File.Exists(filename))
throw new FileNotFoundException();
this.graphBuilder = (IFilterGraph2)new FilterGraph();
#if DEBUG
this.rot = new DsROTEntry(this.graphBuilder);
#endif
this.blackListManager = new BlackListManager(this.graphBuilder);
// blacklist the ffdshow Audio Decoder filter
this.blackListManager.AddBlackListedFilter(new Guid("0F40E1E5-4F79-4988-B1A9-CC98794E6B55"));
// blacklist the ffdshow Video Decoder filter
this.blackListManager.AddBlackListedFilter(new Guid("04FE9017-F873-410E-871E-AB91661A4EF7"));
int hr = this.graphBuilder.RenderFile(filename, null);
DsError.ThrowExceptionForHR(hr);
this.mediaControl = (IMediaControl)this.graphBuilder;
this.mediaEvent = (IMediaEvent)this.graphBuilder;
}
示例3: BuildGraph
private void BuildGraph(string filename)
{
int hr = 0;
try
{
graphBuilder = (IFilterGraph2)new FilterGraph();
mediaControl = (IMediaControl)graphBuilder;
rot = new DsROTEntry(graphBuilder);
vmr9 = (IBaseFilter)new VideoMixingRenderer9();
ConfigureVMR9InWindowlessMode();
hr = graphBuilder.AddFilter(vmr9, "Video Mixing Renderer 9");
DsError.ThrowExceptionForHR(hr);
hr = graphBuilder.RenderFile(filename, null);
DsError.ThrowExceptionForHR(hr);
RunGraph();
}
catch (Exception e)
{
CloseInterfaces();
MessageBox.Show("An error occured during the graph building : \r\n\r\n" + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例4: BuildGraph
//public override void BuildGraphWithNoRenderer()
//{
// this.graphBuilder = (IFilterGraph2)new FilterGraph();
// rot = new DsROTEntry(this.graphBuilder);
// OnGraphStarted();
//}
public override void BuildGraph()
{
this.graphBuilder = (IFilterGraph2)new FilterGraph();
rot = new DsROTEntry(this.graphBuilder);
AddRenderers();
ConfigureVMR9InWindowlessMode();
this.hostingControl.CurrentGraphBuilder = this;
OnGraphStarted();
}
示例5: BuildGraph
public void BuildGraph(ITuningSpace tuningSpace)
{
this.graphBuilder = (IFilterGraph2) new FilterGraph();
rot = new DsROTEntry(this.graphBuilder);
// Method names should be self explanatory
AddNetworkProviderFilter(tuningSpace);
AddMPEG2DemuxFilter();
AddAndConnectBDABoardFilters();
AddTransportStreamFiltersToGraph();
AddRenderers();
ConfigureVMR9InWindowlessMode();
ConnectFilters();
}
示例6: BuildGraph
/// <summary>
/// Build graph
/// </summary>
public override void BuildGraph()
{
try
{
if (_graphState != GraphState.Idle)
{
throw new TvException("Graph already build");
}
Log.Log.WriteFile("BuildGraph");
_graphBuilder = (IFilterGraph2)new FilterGraph();
_capBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
_capBuilder.SetFiltergraph(_graphBuilder);
_rotEntry = new DsROTEntry(_graphBuilder);
_infTeeMain = (IBaseFilter)new InfTee();
int hr = _graphBuilder.AddFilter(_infTeeMain, "Inf Tee");
if (hr != 0)
{
Log.Log.Error("dvbip:Add main InfTee returns:0x{0:X}", hr);
throw new TvException("Unable to add mainInfTee");
}
AddTsWriterFilterToGraph();
AddStreamSourceFilter(_defaultUrl);
IBaseFilter lastFilter = _filterStreamSource;
AddMdPlugs(ref lastFilter);
if (!ConnectTsWriter(lastFilter))
{
throw new TvExceptionGraphBuildingFailed("Graph building failed");
}
_conditionalAccess = new ConditionalAccess(_filterStreamSource, _filterTsWriter, null, this);
_graphState = GraphState.Created;
}
catch (Exception ex)
{
Log.Log.Write(ex);
Dispose();
_graphState = GraphState.Idle;
throw ex;
}
}
示例7: BuildGraph
/// <summary>
/// Build the graph.
/// </summary>
public override void BuildGraph()
{
try
{
if (_graphState != GraphState.Idle)
{
Log.Log.Info("PBDA CC: device already initialised");
return;
}
Log.Log.Info("PBDA CC: build graph");
_graphBuilder = (IFilterGraph2)new FilterGraph();
_capBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
_capBuilder.SetFiltergraph(_graphBuilder);
_rotEntry = new DsROTEntry(_graphBuilder);
AddNetworkProviderFilter(typeof (ATSCNetworkProvider).GUID);
AddTsWriterFilterToGraph();
if (!useInternalNetworkProvider)
{
AddMpeg2DemuxerToGraph();
}
IBaseFilter lastFilter;
AddAndConnectBDABoardFilters(_device, out lastFilter);
_bdaCa = _filterTuner as IBDA_ConditionalAccess;
if (_bdaCa == null)
{
throw new TvExceptionGraphBuildingFailed("PBDA CC: tuner filter does not implement required interface");
}
AddPbdaFilter(ref lastFilter);
CompleteGraph(ref lastFilter);
bool connected = ConnectTsWriter(_filterTuner);
Log.Log.Debug("PBDA CC: connect OOB pin result = {0}", connected);
CheckCableCardInfo();
string graphName = _device.Name + " - NA Cable Graph.grf";
FilterGraphTools.SaveGraphFile(_graphBuilder, graphName);
GetTunerSignalStatistics();
_graphState = GraphState.Created;
}
catch (Exception)
{
Dispose();
throw;
}
}
示例8: 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;
}
示例9: PrepareGraph
/// <summary>
/// If the url to be played can be buffered before starting playback, this function
/// starts building a graph by adding the preferred video and audio render to it.
/// This needs to be called on the MpMain Thread.
/// </summary>
/// <returns>true, if the url can be buffered (a graph was started), false if it can't be and null if an error occured building the graph</returns>
public bool? PrepareGraph()
{
string sourceFilterName = GetSourceFilterName(m_strCurrentFile);
if (!string.IsNullOrEmpty(sourceFilterName))
{
graphBuilder = (IGraphBuilder)new FilterGraph();
_rotEntry = new DsROTEntry((IFilterGraph)graphBuilder);
basicVideo = graphBuilder as IBasicVideo2;
Vmr9 = new VMR9Util();
Vmr9.AddVMR9(graphBuilder);
Vmr9.Enable(false);
// set VMR9 back to NOT Active -> otherwise GUI is not refreshed while graph is building
GUIGraphicsContext.Vmr9Active = false;
// add the audio renderer
using (Settings settings = new MPSettings())
{
string audiorenderer = settings.GetValueAsString("movieplayer", "audiorenderer", "Default DirectSound Device");
DirectShowUtil.AddAudioRendererToGraph(graphBuilder, audiorenderer, false);
}
// set fields for playback
mediaCtrl = (IMediaControl)graphBuilder;
mediaEvt = (IMediaEventEx)graphBuilder;
mediaSeek = (IMediaSeeking)graphBuilder;
mediaPos = (IMediaPosition)graphBuilder;
basicAudio = (IBasicAudio)graphBuilder;
videoWin = (IVideoWindow)graphBuilder;
// add the source filter
IBaseFilter sourceFilter = null;
try
{
if (sourceFilterName == OnlineVideos.MPUrlSourceFilter.Downloader.FilterName)
{
sourceFilter = FilterFromFile.LoadFilterFromDll("MPUrlSourceSplitter\\MPUrlSourceSplitter.ax", new Guid(OnlineVideos.MPUrlSourceFilter.Downloader.FilterCLSID), true);
if (sourceFilter != null)
Marshal.ThrowExceptionForHR(graphBuilder.AddFilter(sourceFilter, OnlineVideos.MPUrlSourceFilter.Downloader.FilterName));
}
if (sourceFilter == null)
{
sourceFilter = DirectShowUtil.AddFilterToGraph(graphBuilder, sourceFilterName);
}
}
catch (Exception ex)
{
Log.Instance.Warn("Error adding '{0}' filter to graph: {1}", sourceFilterName, ex.Message);
return null;
}
finally
{
if (sourceFilter != null) DirectShowUtil.ReleaseComObject(sourceFilter, 2000);
}
return true;
}
else
{
return false;
}
}
示例10: InitGraph
/// <summary>
/// Initialize the graph
/// </summary>
public void InitGraph()
{
if (theDevice == null)
return;
//Create the Graph
graphBuilder = (IGraphBuilder) new FilterGraph();
//Create the Capture Graph Builder
ICaptureGraphBuilder2 captureGraphBuilder = null;
captureGraphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
//Create the media control for controlling the graph
mediaControl = (IMediaControl) this.graphBuilder;
// Attach the filter graph to the capture graph
int hr = captureGraphBuilder.SetFiltergraph(this.graphBuilder);
DsError.ThrowExceptionForHR(hr);
//Add the Video input device to the graph
hr = graphBuilder.AddFilter(theDevice, "source filter");
DsError.ThrowExceptionForHR(hr);
//Add the Video compressor filter to the graph
hr = graphBuilder.AddFilter(theCompressor, "compressor filter");
DsError.ThrowExceptionForHR(hr);
//Create the file writer part of the graph. SetOutputFileName does this for us, and returns the mux and sink
IBaseFilter mux;
IFileSinkFilter sink;
hr = captureGraphBuilder.SetOutputFileName(MediaSubType.Avi, textBox1.Text, out mux, out sink);
DsError.ThrowExceptionForHR(hr);
//Render any preview pin of the device
hr = captureGraphBuilder.RenderStream(PinCategory.Preview, MediaType.Video, theDevice, null, null);
DsError.ThrowExceptionForHR(hr);
//Connect the device and compressor to the mux to render the capture part of the graph
hr = captureGraphBuilder.RenderStream(PinCategory.Capture, MediaType.Video, theDevice, theCompressor, mux);
DsError.ThrowExceptionForHR(hr);
#if DEBUG
m_rot = new DsROTEntry(graphBuilder);
#endif
//get the video window from the graph
IVideoWindow videoWindow = null;
videoWindow = (IVideoWindow) graphBuilder;
//Set the owener of the videoWindow to an IntPtr of some sort (the Handle of any control - could be a form / button etc.)
hr = videoWindow.put_Owner(panel1.Handle);
DsError.ThrowExceptionForHR(hr);
//Set the style of the video window
hr = videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren);
DsError.ThrowExceptionForHR(hr);
// Position video window in client rect of main application window
hr = videoWindow.SetWindowPosition(0,0, panel1.Width, panel1.Height);
DsError.ThrowExceptionForHR(hr);
// Make the video window visible
hr = videoWindow.put_Visible(OABool.True);
DsError.ThrowExceptionForHR(hr);
Marshal.ReleaseComObject(mux);
Marshal.ReleaseComObject(sink);
Marshal.ReleaseComObject(captureGraphBuilder);
}
示例11: SetupGraph
// Build the capture graph for grabber and renderer.</summary>
// (Control to show video in, Filename to play)
private void SetupGraph(Control hWin, string FileName)
{
int hr;
// Get the graphbuilder object
m_FilterGraph = new FilterGraph() as IFilterGraph2;
// Get a ICaptureGraphBuilder2 to help build the graph
ICaptureGraphBuilder2 icgb2 = new CaptureGraphBuilder2() as ICaptureGraphBuilder2;
try
{
// Link the ICaptureGraphBuilder2 to the IFilterGraph2
hr = icgb2.SetFiltergraph(m_FilterGraph);
DsError.ThrowExceptionForHR(hr);
#if DEBUG
// Allows you to view the graph with GraphEdit File/Connect
m_DsRot = new DsROTEntry(m_FilterGraph);
#endif
// Add the filters necessary to render the file. This function will
// work with a number of different file types.
IBaseFilter sourceFilter = null;
hr = m_FilterGraph.AddSourceFilter(FileName, FileName, out sourceFilter);
DsError.ThrowExceptionForHR(hr);
// Get the SampleGrabber interface
m_sampGrabber = (ISampleGrabber)new SampleGrabber();
IBaseFilter baseGrabFlt = (IBaseFilter)m_sampGrabber;
// Configure the Sample Grabber
ConfigureSampleGrabber(m_sampGrabber);
// Add it to the filter
hr = m_FilterGraph.AddFilter(baseGrabFlt, "Ds.NET Grabber");
DsError.ThrowExceptionForHR(hr);
// Connect the pieces together, use the default renderer
hr = icgb2.RenderStream(null, null, sourceFilter, baseGrabFlt, null);
DsError.ThrowExceptionForHR(hr);
// Now that the graph is built, read the dimensions of the bitmaps we'll be getting
SaveSizeInfo(m_sampGrabber);
// Configure the Video Window
IVideoWindow videoWindow = m_FilterGraph as IVideoWindow;
ConfigureVideoWindow(videoWindow, hWin);
// Grab some other interfaces
m_mediaEvent = m_FilterGraph as IMediaEvent;
m_mediaCtrl = m_FilterGraph as IMediaControl;
}
finally
{
if (icgb2 != null)
{
Marshal.ReleaseComObject(icgb2);
icgb2 = null;
}
}
#if DEBUG
// Double check to make sure we aren't releasing something
// important.
GC.Collect();
GC.WaitForPendingFinalizers();
#endif
}
示例12: SetupGraph
/// <summary> build the capture graph for grabber. </summary>
private void SetupGraph(string FileName, Control hWin)
{
int hr;
IBaseFilter ibfRenderer = null;
ISampleGrabber sampGrabber = null;
IBaseFilter capFilter = null;
IPin iPinInFilter = null;
IPin iPinOutFilter = null;
IPin iPinInDest = null;
IBasicAudio basicAudio = null;
// Get the graphbuilder object
m_FilterGraph = new FilterGraph() as IFilterGraph2;
#if DEBUG
m_rot = new DsROTEntry(m_FilterGraph);
#endif
try
{
// Get the SampleGrabber interface
sampGrabber = new SampleGrabber() as ISampleGrabber;
// Add the video source
hr = m_FilterGraph.AddSourceFilter(FileName, "Ds.NET FileFilter", out capFilter);
DsError.ThrowExceptionForHR(hr);
// Hopefully this will be the video pin
IPin iPinOutSource = DsFindPin.ByDirection(capFilter, PinDirection.Output, 0);
IBaseFilter baseGrabFlt = sampGrabber as IBaseFilter;
ConfigureSampleGrabber(sampGrabber);
iPinInFilter = DsFindPin.ByDirection(baseGrabFlt, PinDirection.Input, 0);
iPinOutFilter = DsFindPin.ByDirection(baseGrabFlt, PinDirection.Output, 0);
// Add the frame grabber to the graph
hr = m_FilterGraph.AddFilter(baseGrabFlt, "Ds.NET Grabber");
DsError.ThrowExceptionForHR(hr);
hr = m_FilterGraph.Connect(iPinOutSource, iPinInFilter);
DsError.ThrowExceptionForHR(hr);
// Get the default video renderer
ibfRenderer = (IBaseFilter)new VideoRendererDefault();
// Add it to the graph
hr = m_FilterGraph.AddFilter(ibfRenderer, "Ds.NET VideoRendererDefault");
DsError.ThrowExceptionForHR(hr);
iPinInDest = DsFindPin.ByDirection(ibfRenderer, PinDirection.Input, 0);
// Connect the graph. Many other filters automatically get added here
hr = m_FilterGraph.Connect(iPinOutFilter, iPinInDest);
DsError.ThrowExceptionForHR(hr);
SaveSizeInfo(sampGrabber);
// Set the output window
IVideoWindow videoWindow = m_FilterGraph as IVideoWindow;
hr = videoWindow.put_Owner(hWin.Handle);
DsError.ThrowExceptionForHR(hr);
hr = videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren | WindowStyle.ClipSiblings);
DsError.ThrowExceptionForHR(hr);
hr = videoWindow.put_Visible(OABool.True);
DsError.ThrowExceptionForHR(hr);
//TODO : Need a better way to hide the video in the parent Window
Rectangle rc = hWin.ClientRectangle;
if (mParentWindowDisplay)
hr = videoWindow.SetWindowPosition(0, 0, rc.Right, rc.Bottom);
else
hr = videoWindow.SetWindowPosition(0, 0, 0, 0);
DsError.ThrowExceptionForHR(hr);
IGraphBuilder graphBuilder = m_FilterGraph as IGraphBuilder;
ICaptureGraphBuilder2 captureGraphBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
// Attach the filter graph to the capture graph
hr = captureGraphBuilder.SetFiltergraph(graphBuilder);
DsError.ThrowExceptionForHR(hr);
hr = captureGraphBuilder.RenderStream(null, MediaType.Audio, capFilter, null, null);
}
finally
{
if (capFilter != null)
{
Marshal.ReleaseComObject(capFilter);
capFilter = null;
}
if (sampGrabber != null)
{
Marshal.ReleaseComObject(sampGrabber);
sampGrabber = null;
}
//.........这里部分代码省略.........
示例13: InitializeGraph
private void InitializeGraph(bool isDvd)
{
int hr = 0;
_isDvd = isDvd;
m_filterGraph = new FilterGraphNoThread();
m_graph = (m_filterGraph as DirectShowLib.IGraphBuilder);
// QueryInterface for DirectShow interfaces
_mediaControl = (DirectShowLib.IMediaControl)m_graph;
_mediaEventEx = (DirectShowLib.IMediaEventEx)m_graph;
_mediaSeeking = (DirectShowLib.IMediaSeeking)m_graph;
_mediaPosition = (DirectShowLib.IMediaPosition)m_graph;
// Query for video interfaces, which may not be relevant for audio files
_videoWindow = m_graph as DirectShowLib.IVideoWindow;
_basicVideo = m_graph as DirectShowLib.IBasicVideo;
// Query for audio interfaces, which may not be relevant for video-only files
_basicAudio = m_graph as DirectShowLib.IBasicAudio;
// Set up event notification.
if (isDvd)
hr = _mediaEventEx.SetNotifyWindow(VideoWindowHandle, DirectShowPlayerConfiguration.WM_DVD_EVENT, IntPtr.Zero);
else
hr = _mediaEventEx.SetNotifyWindow(VideoWindowHandle, DirectShowPlayerConfiguration.WM_GRAPH_NOTIFY, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
if (_config.PublishGraph)
m_dsRot = new DsROTEntry(m_graph as IFilterGraph);
}
示例14: GetInterfaces
protected bool GetInterfaces(string filename, int titleBD)
{
try
{
Log.Debug("BDPlayer: GetInterfaces()");
_graphBuilder = (IGraphBuilder)new FilterGraph();
_rotEntry = new DsROTEntry(_graphBuilder as IFilterGraph);
filterConfig = GetFilterConfiguration();
if (filterConfig.AudioRenderer.Length > 0)
{
_audioRendererFilter = DirectShowUtil.AddAudioRendererToGraph(_graphBuilder, filterConfig.AudioRenderer, true);
}
BDReader reader = new BDReader();
_interfaceBDReader = reader as IBaseFilter;
_ireader = reader as IBDReader;
if (_interfaceBDReader == null || _ireader == null)
{
// todo: add exception
return false;
}
// add the BD reader
int hr = _graphBuilder.AddFilter(_interfaceBDReader, BD_READER_GRAPH_NAME);
DsError.ThrowExceptionForHR(hr);
Log.Debug("BDPlayer: Add BDReader to graph");
IFileSourceFilter interfaceFile = (IFileSourceFilter)_interfaceBDReader;
LoadSettings(_ireader);
_ireader.SetD3DDevice(DirectShowUtil.GetUnmanagedDevice(GUIGraphicsContext.DX9Device));
_ireader.SetBDReaderCallback(this);
hr = interfaceFile.Load(filename, null);
DsError.ThrowExceptionForHR(hr);
Log.Debug("BDPlayer: BDReader loaded: {0}", filename);
List<TitleInfo> titles = GetTitleInfoCollection(_ireader);
while (true)
{
if (g_Player.ForcePlay && g_Player.SetResumeBDTitleState < g_Player.BdDefaultTitle)
{
if (titles.Count == 1)
{
_titleToPlay = 0;
g_Player.SetResumeBDTitleState = g_Player.BdRemuxTitle;
}
else
{
_titleToPlay = g_Player.SetResumeBDTitleState;
}
_forceTitle = true;
g_Player.ForcePlay = false;
}
else
{
if (titles.Count == 1)
{
// BD has only one title (remux one)
_forceTitle = true;
_titleToPlay = 0;
g_Player.SetResumeBDTitleState = g_Player.BdRemuxTitle;
if (g_Player.SetResumeBDTitleState == -1)
{
// user cancelled dialog
titles.Dispose();
g_Player.Stop();
return false;
}
}
else
{
_titleToPlay = SelectTitle(titles);
g_Player.SetResumeBDTitleState = _titleToPlay;
Log.Info("BDPlayer: BDReader _titleToPlay : {0}", _titleToPlay);
if (_titleToPlay > -1)
{
// a specific title was selected
_forceTitle = true;
if (g_Player.SetResumeBDTitleState == -1)
{
// user cancelled dialog
titles.Dispose();
g_Player.Stop();
return false;
}
}
else
{
if (_titleToPlay == -1)
//.........这里部分代码省略.........
示例15: CaptureVideo
public void CaptureVideo()
{
int hr = 0;
IBaseFilter sourceFilter = null;
try
{
// Get DirectShow interfaces
GetInterfaces();
// Attach the filter graph to the capture graph
hr = this.captureGraphBuilder.SetFiltergraph(this.graphBuilder);
DsError.ThrowExceptionForHR(hr);
// Use the system device enumerator and class enumerator to find
// a video capture/preview device, such as a desktop USB video camera.
sourceFilter = FindCaptureDevice();
// Add Capture filter to our graph.
hr = this.graphBuilder.AddFilter(sourceFilter, "Video Capture");
DsError.ThrowExceptionForHR(hr);
// Render the preview pin on the video capture filter
// Use this instead of this.graphBuilder.RenderFile
hr = this.captureGraphBuilder.RenderStream(PinCategory.Preview, MediaType.Video, sourceFilter, null, null);
DsError.ThrowExceptionForHR(hr);
// Now that the filter has been added to the graph and we have
// rendered its stream, we can release this reference to the filter.
Marshal.ReleaseComObject(sourceFilter);
// Set video window style and position
SetupVideoWindow();
// Add our graph to the running object table, which will allow
// the GraphEdit application to "spy" on our graph
rot = new DsROTEntry(this.graphBuilder);
// Start previewing video data
hr = this.mediaControl.Run();
DsError.ThrowExceptionForHR(hr);
// Remember current state
this.currentState = PlayState.Running;
}
catch
{
MessageBox.Show("An unrecoverable error has occurred.");
}
}