|
1 | 1 | " |
2 | | -When you use me, I automatically create one VLCInstance.. but you can create other with #createVLCInstance or #createVLCWithArguments: |
| 2 | +When you use me: |
| 3 | +
|
| 4 | +1. create an instance of me with #createVLCInstance or #createVLCWithArguments: |
3 | 5 | " |
4 | 6 | Class { |
5 | 7 | #name : #VLCLibrary, |
6 | 8 | #superclass : #FFILibrary, |
7 | | - #instVars : [ |
8 | | - 'libVLCInstance' |
9 | | - ], |
10 | 9 | #category : #'VLC-Library' |
11 | 10 | } |
12 | 11 |
|
@@ -56,21 +55,11 @@ VLCLibrary >> attachToEventManager: anEventManager forEvent: aTypeOfEvent withCa |
56 | 55 | ) ' |
57 | 56 | ] |
58 | 57 |
|
59 | | -{ #category : #'media list player' } |
60 | | -VLCLibrary >> createListPlayer [ |
61 | | - ^ self createListPlayerForInstance: libVLCInstance |
62 | | -] |
63 | | - |
64 | 58 | { #category : #'media list player' } |
65 | 59 | VLCLibrary >> createListPlayerForInstance: anInstance [ |
66 | 60 | ^ self ffiCall: 'void* libvlc_media_list_player_new(void* anInstance)' |
67 | 61 | ] |
68 | 62 |
|
69 | | -{ #category : #'media list' } |
70 | | -VLCLibrary >> createMediaList [ |
71 | | - ^ self createMediaListFromInstance: libVLCInstance |
72 | | -] |
73 | | - |
74 | 63 | { #category : #'media list' } |
75 | 64 | VLCLibrary >> createMediaListFromInstance: aVLCInstance [ |
76 | 65 | ^ self ffiCall: 'void* libvlc_media_list_new(void* aVLCInstance)' |
@@ -150,24 +139,6 @@ VLCLibrary >> getMediaInsideMediaPlayer: aMediaPlayer [ |
150 | 139 | { #category : #initialization } |
151 | 140 | VLCLibrary >> initialize [ |
152 | 141 | super initialize. |
153 | | - libVLCInstance := self createVLCInstance |
154 | | -] |
155 | | - |
156 | | -{ #category : #initialization } |
157 | | -VLCLibrary >> initializeVLCWithArguments: aCollectionOfString [ |
158 | | - "colArguments := OrderedCollection new. |
159 | | - colArguments add: '--novideo'. |
160 | | - vlc := VLCLibrary uniqueInstance initializeVLCWithArguments: colArguments. |
161 | | - media := vlc mediaFileFromStringLocation: 'https://s6.onlinevideoconverter.com/download?file=d3a0d3e4a0c2f5'. |
162 | | - player := vlc createPlayerForMedia: media. |
163 | | - vlc playMediaPlayer: player. |
164 | | - vlc pauseMediaPlayer: player. |
165 | | - vlc isMediaPlayerPlaying: player" |
166 | | - |
167 | | - | externalArray | |
168 | | - externalArray := (FFIExternalArray externalNewType: 'void*' size: aCollectionOfString size) autoRelease. |
169 | | - aCollectionOfString withIndexDo: [ :string :index | externalArray at: index put: (ExternalAddress fromString: string) autoRelease ]. |
170 | | - libVLCInstance := self initializeVLCWithArguments: externalArray getHandle andNumberOfArgs: aCollectionOfString size. |
171 | 142 | ] |
172 | 143 |
|
173 | 144 | { #category : #initialization } |
@@ -218,23 +189,6 @@ VLCLibrary >> mediaFileForInstance: aVLCInstance fromStringPath: aStringPath [ |
218 | 189 | ^ self ffiCall: 'void* libvlc_media_new_path(void* aVLCInstance, String aStringPath);' |
219 | 190 | ] |
220 | 191 |
|
221 | | -{ #category : #media } |
222 | | -VLCLibrary >> mediaFileFromFileDescriptor: fileDescriptor [ |
223 | | - ^ self mediaFileForInstance: libVLCInstance fromFileDescriptor: fileDescriptor |
224 | | -] |
225 | | - |
226 | | -{ #category : #media } |
227 | | -VLCLibrary >> mediaFileFromStringLocation: aLocation [ |
228 | | - "ex self mediaFileFromStringPath: '/home/badetitou/Musique/Coda.mp3'" |
229 | | - ^ self mediaFileForInstance: libVLCInstance fromStringLocation: aLocation |
230 | | -] |
231 | | - |
232 | | -{ #category : #media } |
233 | | -VLCLibrary >> mediaFileFromStringPath: aStringPath [ |
234 | | - "ex self mediaFileFromStringPath: '/home/badetitou/Musique/Coda.mp3'" |
235 | | - ^ self mediaFileForInstance: libVLCInstance fromStringPath: aStringPath |
236 | | -] |
237 | | - |
238 | 192 | { #category : #'media list player' } |
239 | 193 | VLCLibrary >> nextListPlayer: aListPlayer [ |
240 | 194 | ^ self ffiCall: 'void* libvlc_media_list_player_next (void* aListPlayer)' |
|
0 commit comments