Skip to content

Commit c63b73a

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into MemoryFile_Open
# Conflicts: # libvlc/MemoryFile.rbbas
2 parents 6e6f3ca + ebd0cd4 commit c63b73a

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

App.rbbas

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
#tag Class
22
Protected Class App
33
Inherits Application
4+
#tag Event
5+
Sub Open()
6+
Dim bs As BinaryStream = BinaryStream.Open(GetFolderItem("D:\Music\Soundtracks\Elder Scrolls\Skyrim\Disk 1\The Elder Scrolls V- Skyrim - Night without Stars.flac"))
7+
Dim m As New libvlc.Medium(bs)
8+
Dim p As New VLCPlayer(m)
9+
If Not p.Play() Then Break
10+
Do Until Not p.IsPlaying
11+
DoEvents
12+
Loop
13+
Quit
14+
End Sub
15+
#tag EndEvent
16+
17+
418
#tag Constant, Name = kEditClear, Type = String, Dynamic = False, Default = \"&Delete", Scope = Public
519
#Tag Instance, Platform = Windows, Language = Default, Definition = \"&Delete"
620
#Tag Instance, Platform = Linux, Language = Default, Definition = \"&Delete"

libvlc/MemoryFile.rbbas

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ Private Class MemoryFile
2020
End If
2121

2222
If Streams = Nil Then Streams = New Dictionary
23-
Dim opaque As Ptr = NewOpaque()
23+
Static Opaque As Integer
24+
Do
25+
Opaque = Opaque + 1
26+
Loop Until Not Streams.HasKey(Opaque)
2427
Streams.Value(opaque) = Stream
2528
mHandle = libvlc_media_new_callbacks(Owner.Instance, Nil, AddressOf MediaRead, AddressOf MediaSeek, AddressOf MediaClose, opaque)
2629
End Sub
@@ -33,7 +36,7 @@ Private Class MemoryFile
3336
#tag EndMethod
3437

3538
#tag Method, Flags = &h21
36-
Private Shared Sub MediaClose(Opaque As Ptr)
39+
Private Shared Sub MediaClose(Opaque As Integer)
3740
#pragma X86CallingConvention CDecl
3841
#pragma BoundsChecking Off
3942
#pragma BackgroundTasks Off
@@ -46,14 +49,14 @@ Private Class MemoryFile
4649
#tag EndMethod
4750

4851
#tag Method, Flags = &h21
49-
Private Shared Function MediaOpen(Opaque As Ptr, Buffer As Ptr, ByRef BufferSize As UInt64) As UInt32
52+
Private Shared Function MediaOpen(Opaque As Integer, Buffer As Ptr, ByRef BufferSize As UInt64) As UInt32
5053
#pragma X86CallingConvention CDecl
5154
#pragma BoundsChecking Off
5255
#pragma BackgroundTasks Off
5356
#pragma StackOverflowChecking Off
5457
#pragma NilObjectChecking Off
5558

56-
System.DebugLog(CurrentMethodName + "(0x" + Hex(Integer(Opaque)) + ", " + Hex(Integer(Buffer)) + ", " + Format(BufferSize, "+-##########0") + ")")
59+
System.DebugLog(CurrentMethodName + "(0x" + Hex(Opaque) + ", " + Hex(Integer(Buffer)) + ", " + Format(BufferSize, "+-##########0") + ")")
5760

5861
Dim mb As MemoryBlock = Streams.Lookup(Opaque, Nil)
5962
If mb = Nil Then Return 1 ' invalid Opaque
@@ -67,14 +70,14 @@ Private Class MemoryFile
6770
#tag EndMethod
6871

6972
#tag Method, Flags = &h21
70-
Private Shared Function MediaRead(Opaque As Ptr, Buffer As Ptr, BufferSize As Integer) As UInt32
73+
Private Shared Function MediaRead(Opaque As Integer, Buffer As Ptr, BufferSize As Integer) As UInt32
7174
#pragma X86CallingConvention CDecl
7275
#pragma BoundsChecking Off
7376
#pragma BackgroundTasks Off
7477
#pragma StackOverflowChecking Off
7578
#pragma NilObjectChecking Off
7679

77-
System.DebugLog(CurrentMethodName + "(0x" + Hex(Integer(Opaque)) + ", " + Hex(Integer(Buffer)) + ", " + Format(BufferSize, "+-##########0") + ")")
80+
System.DebugLog(CurrentMethodName + "(0x" + Hex(Opaque) + ", " + Hex(Integer(Buffer)) + ", " + Format(BufferSize, "+-##########0") + ")")
7881

7982
Dim r As Readable = Streams.Lookup(Opaque, Nil)
8083
If r = Nil Then Return 0 ' invalid Opaque
@@ -88,7 +91,7 @@ Private Class MemoryFile
8891
#tag EndMethod
8992

9093
#tag Method, Flags = &h21
91-
Private Shared Function MediaSeek(Opaque As Ptr, Offset As UInt64) As Int32
94+
Private Shared Function MediaSeek(Opaque As Integer, Offset As UInt64) As Int32
9295
#pragma X86CallingConvention CDecl
9396
#pragma BoundsChecking Off
9497
#pragma BackgroundTasks Off
@@ -105,16 +108,6 @@ Private Class MemoryFile
105108
End Function
106109
#tag EndMethod
107110

108-
#tag Method, Flags = &h21
109-
Private Shared Function NewOpaque() As Ptr
110-
Static Opaque As Integer
111-
Do
112-
opaque = opaque + 1
113-
Loop Until Not Streams.HasKey(Ptr(opaque))
114-
Return Ptr(opaque)
115-
End Function
116-
#tag EndMethod
117-
118111

119112
#tag Property, Flags = &h21
120113
Private mHandle As Ptr

libvlc/libvlc.rbbas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ Protected Module libvlc
354354
#tag EndExternalMethod
355355

356356
#tag ExternalMethod, Flags = &h21
357-
Private Soft Declare Function libvlc_media_new_callbacks Lib VLCLib (Instance As Ptr, OpenCB As Ptr, ReadCB As Ptr, SeekCB As Ptr, CloseCB As Ptr, Opaque As Ptr) As Ptr
357+
Private Soft Declare Function libvlc_media_new_callbacks Lib VLCLib (Instance As Ptr, OpenCB As Ptr, ReadCB As Ptr, SeekCB As Ptr, CloseCB As Ptr, Opaque As Integer) As Ptr
358358
#tag EndExternalMethod
359359

360360
#tag ExternalMethod, Flags = &h21

0 commit comments

Comments
 (0)