[EXAMPLES]
* NEW: MediaPlayer: Display the name of the device, not just its system path. [INTERPRETER] * BUG: In File.Load(), workaround virtual files (like those located in '/sys') whose official size is not their real size. git-svn-id: svn://localhost/gambas/trunk@5712 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
d6857e2926
commit
74fb91552e
@ -127,6 +127,12 @@ Public Sub Form_KeyPress()
|
||||
|
||||
End
|
||||
|
||||
Private Sub GetDevice(sName As String) As String
|
||||
|
||||
Try Return Scan(sName, "* (*)")[1]
|
||||
|
||||
End
|
||||
|
||||
Private Sub Action(sAction As String)
|
||||
|
||||
Dim fPos As Float
|
||||
@ -160,7 +166,7 @@ Private Sub Action(sAction As String)
|
||||
FControl.SetTitle(("Video device") & " " & sVideo)
|
||||
Action("stop")
|
||||
$hPlayer.Subtitles.Enabled = False
|
||||
$hPlayer.URL = "v4l2://" & sVideo
|
||||
$hPlayer.URL = "v4l2://" & GetDevice(sVideo)
|
||||
FTags.Clear($hPlayer)
|
||||
Action("play")
|
||||
Endif
|
||||
|
@ -103,7 +103,7 @@ Public Sub _new()
|
||||
cmbVideoDevice.Clear
|
||||
If Exist("/sys/class/video4linux") Then
|
||||
For Each sFile In Dir("/sys/class/video4linux")
|
||||
cmbVideoDevice.Add("/dev" &/ sFile)
|
||||
cmbVideoDevice.Add(Trim(File.Load("/sys/class/video4linux" &/ sFile &/ "name")) & " (/dev/" & sFile & ")")
|
||||
Next
|
||||
Else
|
||||
cmbVideoDevice.Add(("No video device"))
|
||||
|
@ -76,7 +76,6 @@
|
||||
MoveScaled(0,0,24,5)
|
||||
Font = Font["Bold,+5"]
|
||||
Foreground = &HBFBFBF&
|
||||
Expand = True
|
||||
AutoResize = True
|
||||
Text = ("Video device")
|
||||
}
|
||||
|
@ -628,9 +628,10 @@ BEGIN_METHOD(File_Load, GB_STRING path)
|
||||
{
|
||||
rlen = len;
|
||||
|
||||
str = STRING_new_temp(NULL, rlen);
|
||||
|
||||
STREAM_read(&stream, str, rlen);
|
||||
str = STRING_new(NULL, rlen);
|
||||
rlen = STREAM_read_max(&stream, str, rlen);
|
||||
str = STRING_extend(str, rlen);
|
||||
STRING_free_later(str);
|
||||
}
|
||||
|
||||
STREAM_close(&stream);
|
||||
|
Loading…
x
Reference in New Issue
Block a user