Video from Class feeds a DrawingArea problem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Video from Class feeds a DrawingArea problem

ingo
This post has NOT been accepted by the mailing list yet.
I have a problem to link the video from the class 'Video' to a DrawingArea wich is at Form FMain (see attached pic).

FMain:
Public Sub _new()
 
  Scanner.drwArea = drwVideo
 
End

Public Sub drwVideo_Draw()
 
 drwVideo = Scanner.drwArea
 
End

VideoClass:
Create Static

Public hPipe As MediaPipeline
Public hSource As MediaControl
Public hSink As MediaControl
Public hdrwVideo As DrawingArea

Property {drwArea} As DrawingArea


Public Sub _new()
 
  hPipe = New MediaPipeline As "hPipe"
 
  hSource = New MediaControl(hPipe, "v4l2src")
  hSink = New MediaControl(hPipe, "xvimagesink")
  hSource.LinkTo(hSink)
 
 ' hSink.SetWindow(hdrwVideo)
  hPipe.Play()
 
End

Private Function drwArea_Read() As DrawingArea

  Return hdrwVideo
 
End

Private Sub drwArea_Write(Value As DrawingArea)
 
  hdrwVideo = Value
 
  hSink.SetWindow(hdrwVideo)

End

If I comment 'hSink.SetWindow(hdrwVideo)' in the drwArea_Write() then the video is shown in a separate window (xvimagesink).
So the videstream is recieved and the code works generally.

Any ideas how to get the stream into the DrawingArea?

Thanks
Ingo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Video from Class feeds a DrawingArea problem

Charlie
This post has NOT been accepted by the mailing list yet.
ingo wrote
I have a problem to link the video from the class 'Video' to a DrawingArea
Have a look at the attached program, it works for me.



WebCamViewer.tar

Check out www.gambas.one

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Video from Class feeds a DrawingArea problem

ingo
This post has NOT been accepted by the mailing list yet.
Hi Charlie,
thanks for your program.

I know this solution. But my approach is to have a separate class with the gb.media stuff. If I use MediaPlayer or a Pipe is secondary at the  moment.
So I need the videostream in class e.g. VideoClass and then the display in a DrawingArea placed at FMain.
The videostream is arlready within the VideoClass.What I do not succeed is how I get the stream to the DrawingArea.

Any further ideas about that?
Regards
Ingo

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Video from Class feeds a DrawingArea problem

Charlie
This post has NOT been accepted by the mailing list yet.
ingo wrote
Hi Charlie,
thanks for your program.

I know this solution. But my approach is to have a separate class with the gb.media stuff. If I use MediaPlayer or a Pipe is secondary at the  moment.
So I need the videostream in class e.g. VideoClass and then the display in a DrawingArea placed at FMain.
The videostream is arlready within the VideoClass.What I do not succeed is how I get the stream to the DrawingArea.

Any further ideas about that?
Regards
Ingo
Hi Ingo,

Here is another attempt. Let me know if this is what you want.

Charlie

WebCamViewer2.tar

Check out www.gambas.one

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Video from Class feeds a DrawingArea problem

ingo
This post has NOT been accepted by the mailing list yet.
Hi Charlie,
that's great! Thanks a lot for your solution.
As I saw you refer the DrawingArea to an Object. Nice hint
And inspired by your approach I did a try with MediaPipeline. See attached file.

Best regards and thank you again.
Ingo
VideoClass.gz
Loading...