In my C#.net 2008 project, I am using WM ASF Writer (only) to record input in WME format. I have some queries regarding that,
How to remove file sink from WM ASF Writer filter (programmatically) ?
How can I use WME classes & interfaces in C#, like IWMProfileManager, IWMProfileManager2, IWMProfile, IWMWriterAdvanced2, IWMWriterNetworkSink, etc if I want to stream recording content ? Is there any standard library or I can create custom C# library using C++ classes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I uncomment the line, to set the file name & then call to RemoveSink; WM ASF Writer continues to write that file. But I don't want to write that file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using RemoveSink() function call it creates an empty file which is not a major issue for me as it is not going to eat memory space. & I got a suggestion from a link (from Windows Media .Net forum) to delete that file when graph is stopped.
Thanks to you both for your suggestions & comments.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In my C#.net 2008 project, I am using WM ASF Writer (only) to record input in WME format. I have some queries regarding that,
Hi,
whats happen when you uncomment line when file name is setting?
Unfortunately you must set file name in correct patch. But this file will be empty.
I do this that:
IFileSinkFilter2 fileSinkFilter = (IFileSinkFilter2)FilterAsfWriter;
hr = fileSinkFilter.SetFileName(settings.WMAStreamFile, null);
...
and RemoveSink...
When I uncomment the line, to set the file name & then call to RemoveSink; WM ASF Writer continues to write that file. But I don't want to write that file.
Using RemoveSink() function call it creates an empty file which is not a major issue for me as it is not going to eat memory space. & I got a suggestion from a link (from Windows Media .Net forum) to delete that file when graph is stopped.
Thanks to you both for your suggestions & comments.
I'm not sure I understand what you are looking for, but perhaps this will help: http://WindowsMediaNet.SourceForge.Net
snarfle & andrzej_barcis
Thanks you very much for your help.
Thank you snarfle, I got the library.
Thank you andrzej_barcis, I will use those functions
Hello.
Ad. 1
This code remove file sink. As you see I using DirectShow.NET and WindowsMediaLib (http://WindowsMediaNet.SourceForge.Net ).
IBaseFilter FilterAsfWriter; //it's WM ASF Writter
WindowsMediaLib.IWMWriterAdvanced2 AsfWriterAdvanced;
DirectShowLib.IServiceProvider serviceProvider;
WindowsMediaLib.IWMWriterSink ws;
serviceProvider = (DirectShowLib.IServiceProvider) FilterAsfWriter;
serviceProvider.QueryService(writterAdvanced2, writterAdvanced2, out asfWritterAdvancedObject);
AsfWriterAdvanced = (WindowsMediaLib.IWMWriterAdvanced2) asfWritterAdvancedObject;
AsfWriterAdvanced.GetSink(0, out ws);
AsfWriterAdvanced.RemoveSink(ws);
regards
I tried writting code as,
IBaseFilter m_fltWmAsfWriter;
IFileSinkFilter m_FileSink;
WindowsMediaLib.IConfigAsfWriter m_AsfConfig;
IServiceProvider m_ServiceProvider;
object m_AsfWriterAdvancedObject;
IWMWriterAdvanced2 m_WMWA2;
IWMWriterSink m_WmWriterSink;
m_fltWmAsfWriter = ExtraFunctions.AddFilterByName(m_GraphBuilder, FilterCategory.LegacyAmFilterCategory, cAsfWriter);
if (m_fltWmAsfWriter == null) throw new Exception("Failed to add " + cAsfWriter);
m_FileSink = (IFileSinkFilter)m_fltWmAsfWriter;
m_AsfConfig = (WindowsMediaLib.IConfigAsfWriter)m_fltWmAsfWriter;
m_ServiceProvider = (IServiceProvider)m_fltWmAsfWriter;
m_hResult = m_ServiceProvider.QueryService(m_GuidIWMWriterAdvanced2, m_GuidIWMWriterAdvanced2, out m_AsfWriterAdvancedObject);
DsError.ThrowExceptionForHR(m_hResult);
m_WMWA2 = m_AsfWriterAdvancedObject as IWMWriterAdvanced2;
m_WMWA2.GetSink(0, out m_WmWriterSink);
//m_hResult = m_FileSink.SetFileName(m_rsRecordTempFile, null);
m_WMWA2.RemoveSink(m_WmWriterSink);
But I am getting exception "The filename, directory name, or volume label syntax is incorrect.
" at,
m_hResult = m_MediaControl.Run();
DsError.ThrowExceptionForHR(m_hResult);
I forgot declare this:
object asfWritterAdvancedObject;
Last edit: derek w keys 2019-10-21