Problems in your streams detection code (1 Viewer)

chanblard

Portal Member
June 22, 2005
24
0
i make a new post because yamp don't seem to listen what i say :

recently i offer you the possibility to choose between streams into media portal , i am disappointed because nobody tried to contact me about this.
yamp recently add some parts of my code but he didn't made a good code , my code was working well and he don't paste it , i can't understand that. He had a point a view of the problem which is not mine but his solution don't works, can you please send to him the following part of code
This code is his function modified by me and if he just replace his function by my function , all will be fully working.



part of VideoPlayerVRM7.cs
Code:
 public bool AnalyseStreams()
	  {
		  try
		  {
			//INITIALIZE
			sStreams_Sub_No_Subtitle.Id=0;
			sStreams_Sub_No_Subtitle.Filter="";
			cStreams_Audio=0;
			cStreams_Video=0;
			cStreams_Sub=0;
			sStreams_Audio=new FilterStreamInfos[MAX_AUDIOSTREAMS];
			sStreams_Video=new FilterStreamInfos[MAX_VIDEOSTREAMS];
			sStreams_Sub=new FilterStreamInfos[MAX_SUBSTREAMS];	

			//RETRIEVING THE CURRENT SPLITTER
			string filter;
			IBaseFilter foundfilter=null;

			uint fetched=0;
			IEnumFilters enumFilters;
			graphBuilder.EnumFilters(out enumFilters);
			if (enumFilters!=null)
			{
				enumFilters.Reset();
				while (enumFilters.Next(1,out foundfilter,out fetched)==0)
				{
					if (foundfilter!=null && fetched==1)
					{
						IAMStreamSelect pStrm = foundfilter as IAMStreamSelect;
						if (pStrm!=null)
						{
							FilterInfo foundfilterinfos=new FilterInfo();
							foundfilter.QueryFilterInfo(foundfilterinfos);
							filter=foundfilterinfos.achName;
							int cStreams=0;
							pStrm.Count(out cStreams);
								//GET STREAMS
							for (int istream=0;istream<cStreams;istream++)
							{
								AMMediaType sType;AMStreamSelectInfoFlags sFlag;
								int sPDWGroup,sPLCid;string sName;
								object pppunk,ppobject;
								//STREAM INFO
								pStrm.Info(istream,out sType,out sFlag,out sPLCid,
									out sPDWGroup,out sName,out pppunk,out ppobject);

								//VIDEO
								if (sPDWGroup==0 && cStreams_Video<MAX_VIDEOSTREAMS)
								{
									sStreams_Video[cStreams_Video].Name=sName;
									sStreams_Video[cStreams_Video].Id=istream;
									sStreams_Video[cStreams_Video].Filter=filter;
									sStreams_Video[cStreams_Video].Current=false;
									if (cStreams_Video==0)
									{
										sStreams_Video[cStreams_Video].Current=true;
										pStrm.Enable(istream,0);
										pStrm.Enable(istream,AMStreamSelectEnableFlags.Enable);
									}
									cStreams_Video++;
								}
								else
									//AUDIO
									if (sPDWGroup==1 && cStreams_Audio<MAX_AUDIOSTREAMS)
								{
									sStreams_Audio[cStreams_Audio].Name=sName;
									sStreams_Audio[cStreams_Audio].Id=istream;
									sStreams_Audio[cStreams_Audio].Filter=filter;
									sStreams_Audio[cStreams_Audio].Current=false;
									if (cStreams_Audio==0)
									{
										sStreams_Audio[cStreams_Audio].Current=true;
										pStrm.Enable(istream,0);
										pStrm.Enable(istream,AMStreamSelectEnableFlags.Enable);
									}
									cStreams_Audio++;
								}
								else
									//SUBTITLE
									if (sPDWGroup==2 && cStreams_Sub<MAX_SUBSTREAMS && sName.LastIndexOf("off")==-1  && sName.LastIndexOf("No ")==-1&& sName.LastIndexOf("Miscellaneous ")==-1)
								{
									sStreams_Sub[cStreams_Sub].Name=sName;
									sStreams_Sub[cStreams_Sub].Id=istream;
									sStreams_Sub[cStreams_Sub].Filter=filter;
									sStreams_Sub[cStreams_Sub].Current=false;
									if (cStreams_Sub==0)
									{
										sStreams_Sub[cStreams_Sub].Current=true;
										pStrm.Enable(istream,0);
										pStrm.Enable(istream,AMStreamSelectEnableFlags.Enable);
									}
									cStreams_Sub++;
								}
								else 
									//NO SUBTITILE TAG
								if (sPDWGroup==2 && cStreams_Sub<MAX_SUBSTREAMS && (sName.LastIndexOf("off")!=-1 || sName.LastIndexOf("No ")!=-1))
								{
									sStreams_Sub_No_Subtitle.Id=istream;
									sStreams_Sub_No_Subtitle.Current=false;
									sStreams_Sub_No_Subtitle.Filter=filter;
									sStreams_Sub_No_Subtitle.Name=sName;
								}
							}
						}
						Marshal.ReleaseComObject(foundfilter);
					}
				}
				Marshal.ReleaseComObject(enumFilters);
			}
		  }
		  catch
		  {
		  }
		  return true;
	  }

Thanks .
 

mPod

Portal Pro
January 26, 2005
2,084
3
Berlin
Home Country
Germany Germany
I already told you, if you want to submit fixes, use the Sourceforge patch section. There you simply upload the whole .cs file you have changed. If you had done so, there wouldn't be that problem you're complaining about, I guess.
 

chanblard

Portal Member
June 22, 2005
24
0
i already try to do it but sourceforge hasn't keep my file , it delete it..... i don't know why it may be because an account is necessary .....
please contact yamp for me.....
 

mPod

Portal Pro
January 26, 2005
2,084
3
Berlin
Home Country
Germany Germany
chanblard said:
please contact yamp for me.....
That's Frodo.... Come to IRC and chat to him directly in the future, please.
And yes, you need an account at SourceForge. But that shouldn't be a big problem... :wink:

For now, I'm putting the code above into CVS for you.
 

SiLenTYL

Retired Team Member
  • Premium Supporter
  • April 23, 2004
    1,144
    159
    Melbourne
    Home Country
    Australia Australia
    its in CVS and its working a charm for AVI's MP4's and MKV's !!!
    its works for Overlay and VMR9

    ..also those codecs u mentioned in the other thread MUST be installed for it to work properly

    this is awesome dude...been waiting for some1 with the skills and the time to help put this together

    THANK YOU!
     

    chanblard

    Portal Member
    June 22, 2005
    24
    0
    thanks for having paste my code ;-)

    but i can't find where is your irc channel????

    so i post here a last suggestion

    in VideoPlayerVMR7.cs replace the actual EnableStream function:
    Code:
    		public bool EnableStream(int Id,AMStreamSelectEnableFlags dwFlags,string Filter)
    		{
    			try
    			{
    				IBaseFilter foundfilter=DirectShowUtil.GetFilterByName(graphBuilder,Filter);
    				if (foundfilter!=null)
    				{
    					IAMStreamSelect pStrm = foundfilter as IAMStreamSelect;
    					if (pStrm!=null)pStrm.Enable(Id,dwFlags);
    					pStrm=null;
    					Marshal.ReleaseComObject(foundfilter);
    				}
    			}
    			catch
    			{
    			}
    			return true;
    		}

    this will prevent any crash from the stream selection......
    thanks for all
     

    mPod

    Portal Pro
    January 26, 2005
    2,084
    3
    Berlin
    Home Country
    Germany Germany
    Also in CVS now and already available in latest version on myshare.de (07-31-2005--14-13 h).
     

    Users who are viewing this thread

    Top Bottom