Viewing and recording with videolan.interop

This forum is about all development around libVLC.
rvs75
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Jul 2010 11:48

Viewing and recording with videolan.interop

Postby rvs75 » 19 Nov 2010 12:00

Hello,

I use videolan.interop from Fritivi (lastest git, merci Xilasz !) and when i try to recording and viewing dvb-t, the file is succesfully create but i haven't the display (and no sound).

the init :

Code: Select all

Public Sub InitVlcPlayer(ByVal HandleVideo As IntPtr) Dim osversion As Integer = System.Environment.OSVersion.Version.Major Dim Render As String = "" If osversion = 5 Then Render = "Directx" ElseIf osversion = 6 Then Render = "Direct3d" End If Dim args() As String = {AppDomain.CurrentDomain.BaseDirectory, "--no-one-instance", "--no-loop", "--no-video-title-show", "--overlay", "--aout=matrix_directx", "--vout=" & Render} vlc = New VideoLanClient(args) vlcplayer = vlc.NewMediaPlayer() Handle = HandleVideo End Sub
And the code with the probleme

Code: Select all

Public Sub Watch() vlcplayer.Stop() Dim Media As VlcMedia = vlc.NewMedia(dtSingleChannel.Rows(0).Item("Location").ToString) 'libvlc_media_new_location If Not (dtSingleChannel.Rows(0).Item("Extension").ToString.Trim.Equals("")) Then Dim SingleOption() As String = dtSingleChannel.Rows(0).Item("Extension").ToString.Split(CChar(":")) For t As Integer = 1 To SingleOption.Count - 1 Media.AddOption(SingleOption(t)) ' libvlc_media_add_option Next End If If desentrelacement <> Deinterlace.Off Then Media.AddOption(String.Concat("deinterlace=", desentrelacement)) 'libvlc_media_add_option Media.AddOption(String.Concat("filter-deinterlace-mode=", desentrelacementmode.ToString)) 'libvlc_media_add_option End If If recording And Not (RecordFileName.Equals("")) Then Media.AddOption(String.Concat("sout=#duplicate{dst=display,dst=std{access=file,mux=ts,dst=""", RecordFileName, """ }}")) 'PROBLEM!!!! End If vlcplayer.Load(Media) 'libvlc_media_player_set_media vlcplayer.Play(Handle) 'libvlc_media_player_set_hwnd , libvlc_media_player_play End Sub
It' a winform program,the code below is in a module, and the variable Handle is the handle of a panel in a form.

I try diferent argument in
Media.AddOption(String.Concat("sout=#duplicate{dst=display,dst=std{access=file,mux=ts,dst=""", RecordFileName, """ }}"))
But i have always the problemand i haven'y no idea to resolve it ! :(

rogerdpack
Big Cone-huna
Big Cone-huna
Posts: 574
Joined: 19 Jul 2008 23:48
Operating System: windows

Re: Viewing and recording with videolan.interop

Postby rogerdpack » 19 Nov 2010 13:08

if you use the same parameters on the command line (vlc xxx) does it work/

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: Viewing and recording with videolan.interop

Postby XilasZ » 19 Nov 2010 13:32

eheh, you are welcome (cocorico :mrgreen: )

i think vlc options are ok, as they are copied from my code in fritivi, which is able to play a stream and record it to a file in the same time.

If i understand correctly, the created file is ok, it contains audio and video, but you want also the stream to be displayed with sound, and you got nothing ?

Try to not set any surface handle, this way vlc will open a window on it's own if the stream is currently playing.

PS: hmm video output based on osversion, hmm, i might reuse this :p

rvs75
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Jul 2010 11:48

Re: Viewing and recording with videolan.interop

Postby rvs75 » 19 Nov 2010 20:30

Salut Xilasz

i try with no handles and with intptr.zero .
Playing ->ok, a windows appear and display the stream.
playing and recording-> no ok, the file is ok, but no windows appear :(

ps: tu devrais changer les <Dllimport("libvlc.dll")> par <Dllimport("libvlc.dll", CallingConvention = CallingConvention.Cdecl)>, ca evite les erreurs PInvokeStackImbalance dans visual studio 2010.

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: Viewing and recording with videolan.interop

Postby XilasZ » 19 Nov 2010 23:08

That's weird,

it's working perfectly in fritivi. Maybe it has something to do with the input stream ?
can you test your media in fritivi, see whether it's working or not ?

i never had any PInvokeStackImbalance error, i'm on visual 2008 with .Net 3.5, and PInvokeStackImbalance is disabled by default on v3.5.
it might explains why i got random crash when i was marshalling char* from c++ directly to c# strings for return values.
Now i marshall it to intptr, and use PtrToStringAnsi to copy and convert to a string. This way, nothing is mapped from .net to the stack/heap, and it doesn't crash.
But I agree it would be better to set Cdecl now that i know :P

rvs75
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Jul 2010 11:48

Re: Viewing and recording with videolan.interop

Postby rvs75 » 20 Nov 2010 07:24

it happen with dvb-t ,http and file mrl in my program :?
i will try with diferend version of libvlc.

Edit: confirmed, it's ok with other version
More details monday


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 14 guests