Watermark participant not fired in WindowRenderer

Feb 21, 2011 at 7:00 PM

Is this project abandoned ?

 

Hello,

 

I have the following participant:

 

 


 

 

public class MyImageParticipant : AbstractWatermarkParticipant  

 {        

private TracksSource _Source;
      

 public MyImageParticipant(short bitCount, int width, int height, bool flipImages,          

 TracksSource source)            : base(bitCount, width, height, flipImages)      

 {          

 _Source = source;      

 }
        public override void UpdateImage(double sampleTime, Bitmap bitmap)      

 {          

 using (Bitmap bmp = (Bitmap)_Source.GetImageFromTimeline(  

             TimeSpan.FromMilliseconds(sampleTime * 1000.0), false))          

 {              

 using (Graphics g = Graphics.FromImage(bitmap))              

 {                    

g.DrawImageUnscaled(bmp, new Point(0, 0));              

 }          

 }      

 } 
}

 


 

The code to use it is as the following:

 


    using (ITimeline timeline = new DefaultTimeline(source.FrameRate))

{

IGroup videoGroup = timeline.AddVideoGroup(bitCount, source.Width, source.Height);

ITrack videoTrack = videoGroup.AddTrack();

... videoTrack.AddImage(imageFileName, 0, 0, source.Bounds.Width / 1000.0);

IGroup audioGroup = timeline.AddAudioGroup();

...

}


            using (var renderer = new WindowRenderer(_Timeline, IntPtr.Zero,              

 new ICallbackParticipant[] {                   

 new MyImageParticipant(bitCount, source.Width, source.Height, true, source),              

 },                

null))          

 {              

 renderer.Render();          

 }

 


What I am doing wrong ?

 

Note: this participant is correctly fired in AviFileRenderer, but not in WindowRenderer.

 

Regards

 

 

Coordinator
Feb 22, 2011 at 2:37 AM

This project is not actively worked on (and hasn't been for a few years) - but there are a few people who watch the forums and answer questions etc.

I would suggest attaching a debugger and watching how the graph is wired up in the AbstractRenderer.RenderHelper method - this should allow you to see if the sample grabber is wired up, and how.  your best bet is to dump the graph to an Xml file once it's wired up, then load into a DES graph viewer to see what's going on.

If I get any spare time in the future I will take a look myself at this issue.

Cheers,

Alex 

Feb 22, 2011 at 6:03 AM

Thank you for your answer. I hope you can take a look at these questions:

 

- WindowRenderer works for you and other people?. I mean...if it works when you add a participant.

- What you mean by"attaching a debugger". Do you mean to debug with Visual Studio ?

- You said "your best bet is to dump the graph to an xml file". I have used the AbstractRenderer.SaveToGraphFile(...) method (but it saves to a binary .GRF file, not xml file) and opened in GraphEdit, but as of my knowledge of DES (very poor by the way) it is connected and looks normal. What other DES graph viewer can I use ? In GrapheEdit I can see: DEXFILT0000017C -> Video sample grabber -> Video Renderer and I can see another DEXFILT000001A4 but it is not connected to any other filter.

 

Regards

Feb 22, 2011 at 6:09 PM

Never mind....it was my mistake...I added a clip image and accidentally was deleting that image in between the call to render...Sorry... The callback is working perfectly..

 

 

Regards