This project is read-only.

How do I show the progress of a renderer?

Topics: Developer Forum, User Forum
Jun 8, 2011 at 10:02 PM

Hi all,

I am doing a project using the Splicer library to convert a number of bitmaps to a video file.

I use the following:

   ...

   renderer = New WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles

.HighQualityVideo)

 

   renderer.Render()

   renderer = Nothing

   ...

during the "renderer.Render()" call it obviously takes some time - how can I get some feedback as to the progress?

Thanks

James

Jun 9, 2011 at 11:08 AM

In the Splicer source, look for the ConsoleProgressParticipant and the PercentageProgressParticipant.  There's an example, too.

Jun 9, 2011 at 6:35 PM

Hi,

Thanks a lot for the very quick reply...

I have located the two classes and they look like exactly what I am after :-)

I am not sure about the examples thought, I can't see anything that shows me how to use them (I am probably being blind!!)

I have a Forms app and would like the process to kick off an event that I can catch to update a status bar - how do I use the classes for this?

Any help would really be appreciated...

Many thanks,

James

Jun 10, 2011 at 7:26 PM
Edited Jun 10, 2011 at 7:29 PM

Sussed it :-)  Not used to VB Event handling!!!

Dim WithEvents m_Participant As PercentageProgressParticipant

...

m_Participant = New PercentageProgressParticipant(timeline)
renderer = New WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo, New ICallbackParticipant() {m_Participant}, Nothing)
renderer.Render()

...
Private Sub myEvent(sender As Object, e As Splicer.Renderer.ProgressChangedEventArgs) Handles m_Participant.ProgressChanged
    Console.WriteLine(e.Progress.ToString())
End Sub

Jun 10, 2011 at 7:46 PM

First, you subclass from AbstractProgressParticipant or use the supplied PercentageProgressParticipant.

Then you create an instance of a WindowsMediaRenderer and pass an instance of your ProgressParticipant in the array of videoParticipants to the constructor.

The HandleProgress method of your ProgressParticipant will be invoked for each frame rendered.  In case you use the PercentageProgressParticipant, you want to add an EventHandler to the ProgressChanged event.

Jul 25, 2011 at 11:47 AM

How we will call this "myEvent" event handler???

Jul 26, 2011 at 6:30 AM

I am using c sharp can anyone help me

Jul 26, 2011 at 8:12 AM

Hi Saneesh,

With your variable m_Participant in the VB example above, in C# you should be able to type "m_Participant.ProcessChanged +=" <Tab> <Tab>

which should create and bind the event handler for you. Just update the stub it creates to do what you need it to...

James

Jul 26, 2011 at 9:39 AM

Thank you James i got it working