@@ -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
0 commit comments