[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:
Benoît Minisini 2013-06-29 16:11:32 +00:00
parent d6857e2926
commit 74fb91552e
4 changed files with 12 additions and 6 deletions

View File

@ -127,6 +127,12 @@ Public Sub Form_KeyPress()
End End
Private Sub GetDevice(sName As String) As String
Try Return Scan(sName, "* (*)")[1]
End
Private Sub Action(sAction As String) Private Sub Action(sAction As String)
Dim fPos As Float Dim fPos As Float
@ -160,7 +166,7 @@ Private Sub Action(sAction As String)
FControl.SetTitle(("Video device") & " " & sVideo) FControl.SetTitle(("Video device") & " " & sVideo)
Action("stop") Action("stop")
$hPlayer.Subtitles.Enabled = False $hPlayer.Subtitles.Enabled = False
$hPlayer.URL = "v4l2://" & sVideo $hPlayer.URL = "v4l2://" & GetDevice(sVideo)
FTags.Clear($hPlayer) FTags.Clear($hPlayer)
Action("play") Action("play")
Endif Endif

View File

@ -103,7 +103,7 @@ Public Sub _new()
cmbVideoDevice.Clear cmbVideoDevice.Clear
If Exist("/sys/class/video4linux") Then If Exist("/sys/class/video4linux") Then
For Each sFile In Dir("/sys/class/video4linux") 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 Next
Else Else
cmbVideoDevice.Add(("No video device")) cmbVideoDevice.Add(("No video device"))

View File

@ -76,7 +76,6 @@
MoveScaled(0,0,24,5) MoveScaled(0,0,24,5)
Font = Font["Bold,+5"] Font = Font["Bold,+5"]
Foreground = &HBFBFBF& Foreground = &HBFBFBF&
Expand = True
AutoResize = True AutoResize = True
Text = ("Video device") Text = ("Video device")
} }

View File

@ -628,9 +628,10 @@ BEGIN_METHOD(File_Load, GB_STRING path)
{ {
rlen = len; rlen = len;
str = STRING_new_temp(NULL, rlen); str = STRING_new(NULL, rlen);
rlen = STREAM_read_max(&stream, str, rlen);
STREAM_read(&stream, str, rlen); str = STRING_extend(str, rlen);
STRING_free_later(str);
} }
STREAM_close(&stream); STREAM_close(&stream);