Check-in [137419d299]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Recreate player for different movies to get correct texture size
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 137419d299030a943741ecf210eae311c6171ba6
User & Date: bernd 2014-01-19 22:49:05
Context
2014-01-20
01:51
Objtain class directly check-in: e4fd5c80fd user: bernd tags: trunk
2014-01-19
22:49
Recreate player for different movies to get correct texture size check-in: 137419d299 user: bernd tags: trunk
13:50
Name conflict solved check-in: 8e7b012cfe user: bernd tags: trunk
Changes

Changes to gles2/android.fs.

280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
...
300
301
302
303
304
305
306




307

308
309
310
Defer android-location ( location -- )
:noname to location ; IS android-location
Defer android-sensor ( sensor -- )
:noname to sensor ; IS android-sensor

\ stubs, "is recurse" assigns to last defined word

Defer android-surface-changed ' drop is recurse
Defer android-surface-redraw ' drop is recurse
Defer android-global-layout ' drop is recurse

: android-surface-created ( surface -- )
    >o  env o ANativeWindow_fromSurface app window !  gref> ;
: android-surface-destroyed ( surface -- )
    >o  app window off  gref> ;
: android-global-layout ( 0 -- ) drop config-changed ;

................................................................................
' android-location ,
' android-sensor ,
' android-surface-created ,
' android-surface-changed ,
' android-surface-redraw ,
' android-surface-destroyed ,
' android-global-layout ,






:noname ( event type -- )  cells aevents + perform ; is akey

previous previous set-current







|
|
|







 







>
>
>
>

>
|


280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
Defer android-location ( location -- )
:noname to location ; IS android-location
Defer android-sensor ( sensor -- )
:noname to sensor ; IS android-sensor

\ stubs, "is recurse" assigns to last defined word

Defer android-surface-changed ' ]gref is recurse
Defer android-surface-redraw ' ]gref is recurse
Defer android-video-size ' ]gref is recurse

: android-surface-created ( surface -- )
    >o  env o ANativeWindow_fromSurface app window !  gref> ;
: android-surface-destroyed ( surface -- )
    >o  app window off  gref> ;
: android-global-layout ( 0 -- ) drop config-changed ;

................................................................................
' android-location ,
' android-sensor ,
' android-surface-created ,
' android-surface-changed ,
' android-surface-redraw ,
' android-surface-destroyed ,
' android-global-layout ,
' android-video-size ,
here aevents - cell/
' drop ,
Constant max-event#

:noname ( event type -- )
    max-event# umin cells aevents + perform ; is akey

previous previous set-current

Changes to gles2/jni-media.fs.

18
19
20
21
22
23
24

25
26
27
28
29
30
31
..
99
100
101
102
103
104
105
106
107
108
109
110
111
jni-class: android/graphics/SurfaceTexture

jni-new: new-SurfaceTexture (I)V
jni-method: updateTexImage updateTexImage ()V
jni-method: getTimestamp getTimestamp ()J
jni-method: setDefaultBufferSize setDefaultBufferSize (II)V
jni-method: getTransformMatrix getTransformMatrix ([F)V


jni-class: android/view/Surface

jni-new: new-Surface (Landroid/graphics/SurfaceTexture;)V
jni-method: release release ()V
jni-method: isValid isValid ()Z

................................................................................
jni-static: cp-get(id) get (II)Landroid/media/CamcorderProfile;

jni-class: android/hardware/Camera$Size

jni-field: height height I
jni-field: width width I

previous

0 Value media-sft

: create-sft ( -- ) media-sft ?EXIT
    media-tex current-tex new-SurfaceTexture to media-sft ;







>







 







|

|

|

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
100
101
102
103
104
105
106
107
108
109
110
111
112
jni-class: android/graphics/SurfaceTexture

jni-new: new-SurfaceTexture (I)V
jni-method: updateTexImage updateTexImage ()V
jni-method: getTimestamp getTimestamp ()J
jni-method: setDefaultBufferSize setDefaultBufferSize (II)V
jni-method: getTransformMatrix getTransformMatrix ([F)V
jni-method: st-release release ()V

jni-class: android/view/Surface

jni-new: new-Surface (Landroid/graphics/SurfaceTexture;)V
jni-method: release release ()V
jni-method: isValid isValid ()Z

................................................................................
jni-static: cp-get(id) get (II)Landroid/media/CamcorderProfile;

jni-class: android/hardware/Camera$Size

jni-field: height height I
jni-field: width width I

JValue media-sft

previous

: create-sft ( -- )
    media-tex current-tex new-SurfaceTexture to media-sft ;

Changes to gles2/omx-example.fs.

1
2
3
4
5







6
7
8
9
10
11
12
..
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
...
132
133
134
135
136
137
138
139



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155



156
157
158
159
160
161
162
...
164
165
166
167
168
169
170
171





172
173
174
175
176
177
178
179
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
\ OpenMAX AL example

require openmax.fs
require mkv-tools.fs
require jni-media.fs








also openmax

0 Value mp-object
0 Value engine
0 Value mix

................................................................................
    mp-object XA_IID_ENGINE ['] engine >body mp-object XAObjectItf-GetInterface()
    ?success ;

: create-mix ( -- )
    engine ['] mix >body  0 0 0 engine XAEngineItf-CreateOutputMix() ?success
    mix realize ;

0 Value mediaplayer0

: create-stuff ( -- )
    create-object create-engine create-mix ;

\ media player

0 Value player

................................................................................
    BQitf XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED
    BQitf XAAndroidBufferQueueItf-SetCallbackEventsMask() ?success
    BQitf c-buffer-queue-cb 0
    BQitf XAAndroidBufferQueueItf-RegisterCallback() ?success
    infoitf c-stream-info-cb 0
    infoitf XAStreamInformationItf-RegisterStreamChangeCallback() ?success ;

0 Value media-sf




: create-media ( -- )
    new-MediaPlayer to mediaplayer0  media-sf ?EXIT
    create-sft  media-sft new-Surface to media-sf ;

also jni also android

: create-player ( -- )
    create-stuff
    env media-sf ANativeWindow_fromSurface loc_nd cell+ !
    mix loc_mix cell+ !
    engine ['] player >body
    data< 0 audio> video> 0 0 NB_MAXAL_INTERFACES iidArray req
    engine XAEngineITF-CreateMediaPlayer() ?success
    player realize ;




previous previous

: init-mediaplayer ( -- )
    mediaplayer0 >o media-sf setSurface  mp-start o> ;

Variable playstate
: pplay? ( -- flag ) playitf playstate playitf XAPlayItf-GetPlayState() ?success
................................................................................
: ppause ( -- )
    playitf XA_PLAYSTATE_PAUSED playitf XAPlayItf-SetPlayState() ?success ;
: pplay ( -- )
    playitf XA_PLAYSTATE_PLAYING playitf XAPlayItf-SetPlayState() ?success ;
: pvol ( n -- )
    volitf swap volitf XAVolumeItf-SetVolumeLevel() ?success ;

: setup-player ( -- )  player IF  mediaplayer0 >o mp-start o> EXIT  THEN





    create-media create-player get-interfaces set-callbacks
    init-mediaplayer  ;
: stop-player ( -- )  mediaplayer0 >o mp-pause o> ;

0 Value pvol#
: start-file ( -- )
    setup-player  true init-enqueue  ppause pvol# pvol ;

................................................................................
0 Value oes-program

: omx-init ( -- ) create-oes-program to oes-program ;

also android

\ vertices


0.005e Fconstant m-lr
FVariable first-timestamp  0e first-timestamp f!
: get-deltat ( -- f )
    media-sft >o getTimestamp o> d>f 1e-9 f*
    first-timestamp f@ f- ;
: set-deltat ( -- f ) get-deltat mkv-time-off f@ f- first-timestamp f! ;
................................................................................
	cues>mts-run? 0= pplay? and  IF  ppause  THEN
    level# @ 0= UNTIL
    ppause screen-keep ;
: play-ts ( addr u -- ) ['] read-ts-file is read-ts
    open-mts start-file play-loop ;
: play-mkv ( addr u -- )
    ['] pull-queue is read-ts
    'm' emit screen-sync
    <event e$, ->open-mkv 0 elit, ->cues cue-task event>
    'k' emit screen-sync
    start-file
    'v' emit screen-sync
    play-loop stop-player ;
: replay% ( r -- )  >pos  true init-enqueue play-loop ;
: replay ( -- )
    cue-task IF
	<event 0 elit, ->cues cue-task event>
    ELSE
	0. ts-fd reposition-file throw
    THEN





>
>
>
>
>
>
>







 







<
<







 







|
>
>
>


|
<




<







>
>
>







 







|
>
>
>
>
>
|







 







<







 







<

<
<
<
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
33
34
35
36
37
38
39


40
41
42
43
44
45
46
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150

151
152
153
154

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
196
197
198
199
200
201
202

203
204
205
206
207
208
209
...
302
303
304
305
306
307
308

309



310
311
312
313
314
315
316
317
\ OpenMAX AL example

require openmax.fs
require mkv-tools.fs
require jni-media.fs

also jni

JValue mediaplayer0
JValue media-sf

previous

also openmax

0 Value mp-object
0 Value engine
0 Value mix

................................................................................
    mp-object XA_IID_ENGINE ['] engine >body mp-object XAObjectItf-GetInterface()
    ?success ;

: create-mix ( -- )
    engine ['] mix >body  0 0 0 engine XAEngineItf-CreateOutputMix() ?success
    mix realize ;



: create-stuff ( -- )
    create-object create-engine create-mix ;

\ media player

0 Value player

................................................................................
    BQitf XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED
    BQitf XAAndroidBufferQueueItf-SetCallbackEventsMask() ?success
    BQitf c-buffer-queue-cb 0
    BQitf XAAndroidBufferQueueItf-RegisterCallback() ?success
    infoitf c-stream-info-cb 0
    infoitf XAStreamInformationItf-RegisterStreamChangeCallback() ?success ;

: create-sf ( -- )
    media-sf  >o o IF  release     THEN o>
    media-sft >o o IF  st-release  THEN o>
    create-sft  media-sft new-Surface to media-sf ;

: create-media ( -- )
    new-MediaPlayer to mediaplayer0  create-sf ;


also jni also android

: create-player ( -- )

    env media-sf ANativeWindow_fromSurface loc_nd cell+ !
    mix loc_mix cell+ !
    engine ['] player >body
    data< 0 audio> video> 0 0 NB_MAXAL_INTERFACES iidArray req
    engine XAEngineITF-CreateMediaPlayer() ?success
    player realize ;

: destroy-player ( -- )
    player dup XAObjectItf-Destroy()  0 to player ;

previous previous

: init-mediaplayer ( -- )
    mediaplayer0 >o media-sf setSurface  mp-start o> ;

Variable playstate
: pplay? ( -- flag ) playitf playstate playitf XAPlayItf-GetPlayState() ?success
................................................................................
: ppause ( -- )
    playitf XA_PLAYSTATE_PAUSED playitf XAPlayItf-SetPlayState() ?success ;
: pplay ( -- )
    playitf XA_PLAYSTATE_PLAYING playitf XAPlayItf-SetPlayState() ?success ;
: pvol ( n -- )
    volitf swap volitf XAVolumeItf-SetVolumeLevel() ?success ;

: setup-player ( -- )  player IF
	destroy-player
    ELSE
	create-stuff
    THEN
    create-media create-player
    get-interfaces set-callbacks
    init-mediaplayer  ;
: stop-player ( -- )  mediaplayer0 >o mp-pause o> ;

0 Value pvol#
: start-file ( -- )
    setup-player  true init-enqueue  ppause pvol# pvol ;

................................................................................
0 Value oes-program

: omx-init ( -- ) create-oes-program to oes-program ;

also android

\ vertices


0.005e Fconstant m-lr
FVariable first-timestamp  0e first-timestamp f!
: get-deltat ( -- f )
    media-sft >o getTimestamp o> d>f 1e-9 f*
    first-timestamp f@ f- ;
: set-deltat ( -- f ) get-deltat mkv-time-off f@ f- first-timestamp f! ;
................................................................................
	cues>mts-run? 0= pplay? and  IF  ppause  THEN
    level# @ 0= UNTIL
    ppause screen-keep ;
: play-ts ( addr u -- ) ['] read-ts-file is read-ts
    open-mts start-file play-loop ;
: play-mkv ( addr u -- )
    ['] pull-queue is read-ts

    <event e$, ->open-mkv 0 elit, ->cues cue-task event>



    start-file play-loop stop-player ;
: replay% ( r -- )  >pos  true init-enqueue play-loop ;
: replay ( -- )
    cue-task IF
	<event 0 elit, ->cues cue-task event>
    ELSE
	0. ts-fd reposition-file throw
    THEN

Changes to gles2/omxal.fs.

1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278

\ --===< function pointers >===---
c-funptr XAObjectItf-Realize() {(*(XAObjectItf)ptr)->Realize} a n -- a
c-funptr XAObjectItf-Resume() {(*(XAObjectItf)ptr)->Resume} a n -- a
c-funptr XAObjectItf-GetState() {(*(XAObjectItf)ptr)->GetState} a a -- a
c-funptr XAObjectItf-GetInterface() {(*(XAObjectItf)ptr)->GetInterface} a a a -- a
c-funptr XAObjectItf-RegisterCallback() {(*(XAObjectItf)ptr)->RegisterCallback} a a a -- a
c-funptr XAObjectItf-AbortAsyncOperation() {(*(XAObjectItf)ptr)->AbortAsyncOperation} a{*(XAObjectItf*)} -- void
c-funptr XAObjectItf-Destroy() {(*(XAObjectItf)ptr)->Destroy} a{*(XAObjectItf*)} -- void
c-funptr XAObjectItf-SetPriority() {(*(XAObjectItf)ptr)->SetPriority} a{*(XAObjectItf*)} n n -- a
c-funptr XAObjectItf-GetPriority() {(*(XAObjectItf)ptr)->GetPriority} a{*(XAObjectItf*)} a a -- a
c-funptr XAObjectItf-SetLossOfControlInterfaces() {(*(XAObjectItf)ptr)->SetLossOfControlInterfaces} a{*(XAObjectItf*)} n a n -- a
c-funptr XAConfigExtensionsItf-SetConfiguration() {(*(XAConfigExtensionsItf)ptr)->SetConfiguration} a a n a -- a
c-funptr XAConfigExtensionsItf-GetConfiguration() {(*(XAConfigExtensionsItf)ptr)->GetConfiguration} a a a a -- a
c-funptr XADynamicInterfaceManagementItf-AddInterface() {(*(XADynamicInterfaceManagementItf)ptr)->AddInterface} a a n -- a
c-funptr XADynamicInterfaceManagementItf-RemoveInterface() {(*(XADynamicInterfaceManagementItf)ptr)->RemoveInterface} a a -- a
c-funptr XADynamicInterfaceManagementItf-ResumeInterface() {(*(XADynamicInterfaceManagementItf)ptr)->ResumeInterface} a a n -- a
c-funptr XADynamicInterfaceManagementItf-RegisterCallback() {(*(XADynamicInterfaceManagementItf)ptr)->RegisterCallback} a a a -- a
c-funptr XAEngineItf-CreateCameraDevice() {(*(XAEngineItf)ptr)->CreateCameraDevice} a a n n a a -- a







|
|
|
|
|







1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278

\ --===< function pointers >===---
c-funptr XAObjectItf-Realize() {(*(XAObjectItf)ptr)->Realize} a n -- a
c-funptr XAObjectItf-Resume() {(*(XAObjectItf)ptr)->Resume} a n -- a
c-funptr XAObjectItf-GetState() {(*(XAObjectItf)ptr)->GetState} a a -- a
c-funptr XAObjectItf-GetInterface() {(*(XAObjectItf)ptr)->GetInterface} a a a -- a
c-funptr XAObjectItf-RegisterCallback() {(*(XAObjectItf)ptr)->RegisterCallback} a a a -- a
c-funptr XAObjectItf-AbortAsyncOperation() {(*(XAObjectItf)ptr)->AbortAsyncOperation} a -- void
c-funptr XAObjectItf-Destroy() {(*(XAObjectItf)ptr)->Destroy} a -- void
c-funptr XAObjectItf-SetPriority() {(*(XAObjectItf)ptr)->SetPriority} a n n -- a
c-funptr XAObjectItf-GetPriority() {(*(XAObjectItf)ptr)->GetPriority} a a a -- a
c-funptr XAObjectItf-SetLossOfControlInterfaces() {(*(XAObjectItf)ptr)->SetLossOfControlInterfaces} a n a n -- a
c-funptr XAConfigExtensionsItf-SetConfiguration() {(*(XAConfigExtensionsItf)ptr)->SetConfiguration} a a n a -- a
c-funptr XAConfigExtensionsItf-GetConfiguration() {(*(XAConfigExtensionsItf)ptr)->GetConfiguration} a a a a -- a
c-funptr XADynamicInterfaceManagementItf-AddInterface() {(*(XADynamicInterfaceManagementItf)ptr)->AddInterface} a a n -- a
c-funptr XADynamicInterfaceManagementItf-RemoveInterface() {(*(XADynamicInterfaceManagementItf)ptr)->RemoveInterface} a a -- a
c-funptr XADynamicInterfaceManagementItf-ResumeInterface() {(*(XADynamicInterfaceManagementItf)ptr)->ResumeInterface} a a n -- a
c-funptr XADynamicInterfaceManagementItf-RegisterCallback() {(*(XADynamicInterfaceManagementItf)ptr)->RegisterCallback} a a a -- a
c-funptr XAEngineItf-CreateCameraDevice() {(*(XAEngineItf)ptr)->CreateCameraDevice} a a n n a a -- a

Changes to jni-media.fs.

18
19
20
21
22
23
24

25
26
27
28
29
30
31
..
99
100
101
102
103
104
105
106
107
108
109
110
111
jni-class: android/graphics/SurfaceTexture

jni-new: new-SurfaceTexture (I)V
jni-method: updateTexImage updateTexImage ()V
jni-method: getTimestamp getTimestamp ()J
jni-method: setDefaultBufferSize setDefaultBufferSize (II)V
jni-method: getTransformMatrix getTransformMatrix ([F)V


jni-class: android/view/Surface

jni-new: new-Surface (Landroid/graphics/SurfaceTexture;)V
jni-method: release release ()V
jni-method: isValid isValid ()Z

................................................................................
jni-static: cp-get(id) get (II)Landroid/media/CamcorderProfile;

jni-class: android/hardware/Camera$Size

jni-field: height height I
jni-field: width width I

previous

0 Value media-sft

: create-sft ( -- ) media-sft ?EXIT
    media-tex current-tex new-SurfaceTexture to media-sft ;







>







 







|

|

|

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
100
101
102
103
104
105
106
107
108
109
110
111
112
jni-class: android/graphics/SurfaceTexture

jni-new: new-SurfaceTexture (I)V
jni-method: updateTexImage updateTexImage ()V
jni-method: getTimestamp getTimestamp ()J
jni-method: setDefaultBufferSize setDefaultBufferSize (II)V
jni-method: getTransformMatrix getTransformMatrix ([F)V
jni-method: st-release release ()V

jni-class: android/view/Surface

jni-new: new-Surface (Landroid/graphics/SurfaceTexture;)V
jni-method: release release ()V
jni-method: isValid isValid ()Z

................................................................................
jni-static: cp-get(id) get (II)Landroid/media/CamcorderProfile;

jni-class: android/hardware/Camera$Size

jni-field: height height I
jni-field: width width I

JValue media-sft

previous

: create-sft ( -- )
    media-tex current-tex new-SurfaceTexture to media-sft ;

Changes to omx-example.fs.

1
2
3
4
5







6
7
8
9
10
11
12
..
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
...
132
133
134
135
136
137
138
139



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155



156
157
158
159
160
161
162
...
164
165
166
167
168
169
170
171





172
173
174
175
176
177
178
179
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
\ OpenMAX AL example

require openmax.fs
require mkv-tools.fs
require jni-media.fs








also openmax

0 Value mp-object
0 Value engine
0 Value mix

................................................................................
    mp-object XA_IID_ENGINE ['] engine >body mp-object XAObjectItf-GetInterface()
    ?success ;

: create-mix ( -- )
    engine ['] mix >body  0 0 0 engine XAEngineItf-CreateOutputMix() ?success
    mix realize ;

0 Value mediaplayer0

: create-stuff ( -- )
    create-object create-engine create-mix ;

\ media player

0 Value player

................................................................................
    BQitf XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED
    BQitf XAAndroidBufferQueueItf-SetCallbackEventsMask() ?success
    BQitf c-buffer-queue-cb 0
    BQitf XAAndroidBufferQueueItf-RegisterCallback() ?success
    infoitf c-stream-info-cb 0
    infoitf XAStreamInformationItf-RegisterStreamChangeCallback() ?success ;

0 Value media-sf




: create-media ( -- )
    new-MediaPlayer to mediaplayer0  media-sf ?EXIT
    create-sft  media-sft new-Surface to media-sf ;

also jni also android

: create-player ( -- )
    create-stuff
    env media-sf ANativeWindow_fromSurface loc_nd cell+ !
    mix loc_mix cell+ !
    engine ['] player >body
    data< 0 audio> video> 0 0 NB_MAXAL_INTERFACES iidArray req
    engine XAEngineITF-CreateMediaPlayer() ?success
    player realize ;




previous previous

: init-mediaplayer ( -- )
    mediaplayer0 >o media-sf setSurface  mp-start o> ;

Variable playstate
: pplay? ( -- flag ) playitf playstate playitf XAPlayItf-GetPlayState() ?success
................................................................................
: ppause ( -- )
    playitf XA_PLAYSTATE_PAUSED playitf XAPlayItf-SetPlayState() ?success ;
: pplay ( -- )
    playitf XA_PLAYSTATE_PLAYING playitf XAPlayItf-SetPlayState() ?success ;
: pvol ( n -- )
    volitf swap volitf XAVolumeItf-SetVolumeLevel() ?success ;

: setup-player ( -- )  player IF  mediaplayer0 >o mp-start o> EXIT  THEN





    create-media create-player get-interfaces set-callbacks
    init-mediaplayer  ;
: stop-player ( -- )  mediaplayer0 >o mp-pause o> ;

0 Value pvol#
: start-file ( -- )
    setup-player  true init-enqueue  ppause pvol# pvol ;

................................................................................
0 Value oes-program

: omx-init ( -- ) create-oes-program to oes-program ;

also android

\ vertices


0.005e Fconstant m-lr
FVariable first-timestamp  0e first-timestamp f!
: get-deltat ( -- f )
    media-sft >o getTimestamp o> d>f 1e-9 f*
    first-timestamp f@ f- ;
: set-deltat ( -- f ) get-deltat mkv-time-off f@ f- first-timestamp f! ;
................................................................................
	cues>mts-run? 0= pplay? and  IF  ppause  THEN
    level# @ 0= UNTIL
    ppause screen-keep ;
: play-ts ( addr u -- ) ['] read-ts-file is read-ts
    open-mts start-file play-loop ;
: play-mkv ( addr u -- )
    ['] pull-queue is read-ts
    'm' emit screen-sync
    <event e$, ->open-mkv 0 elit, ->cues cue-task event>
    'k' emit screen-sync
    start-file
    'v' emit screen-sync
    play-loop stop-player ;
: replay% ( r -- )  >pos  true init-enqueue play-loop ;
: replay ( -- )
    cue-task IF
	<event 0 elit, ->cues cue-task event>
    ELSE
	0. ts-fd reposition-file throw
    THEN





>
>
>
>
>
>
>







 







<
<







 







|
>
>
>


|
<




<







>
>
>







 







|
>
>
>
>
>
|







 







<







 







<

<
<
<
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
33
34
35
36
37
38
39


40
41
42
43
44
45
46
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150

151
152
153
154

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
196
197
198
199
200
201
202

203
204
205
206
207
208
209
...
302
303
304
305
306
307
308

309



310
311
312
313
314
315
316
317
\ OpenMAX AL example

require openmax.fs
require mkv-tools.fs
require jni-media.fs

also jni

JValue mediaplayer0
JValue media-sf

previous

also openmax

0 Value mp-object
0 Value engine
0 Value mix

................................................................................
    mp-object XA_IID_ENGINE ['] engine >body mp-object XAObjectItf-GetInterface()
    ?success ;

: create-mix ( -- )
    engine ['] mix >body  0 0 0 engine XAEngineItf-CreateOutputMix() ?success
    mix realize ;



: create-stuff ( -- )
    create-object create-engine create-mix ;

\ media player

0 Value player

................................................................................
    BQitf XA_ANDROIDBUFFERQUEUEEVENT_PROCESSED
    BQitf XAAndroidBufferQueueItf-SetCallbackEventsMask() ?success
    BQitf c-buffer-queue-cb 0
    BQitf XAAndroidBufferQueueItf-RegisterCallback() ?success
    infoitf c-stream-info-cb 0
    infoitf XAStreamInformationItf-RegisterStreamChangeCallback() ?success ;

: create-sf ( -- )
    media-sf  >o o IF  release     THEN o>
    media-sft >o o IF  st-release  THEN o>
    create-sft  media-sft new-Surface to media-sf ;

: create-media ( -- )
    new-MediaPlayer to mediaplayer0  create-sf ;


also jni also android

: create-player ( -- )

    env media-sf ANativeWindow_fromSurface loc_nd cell+ !
    mix loc_mix cell+ !
    engine ['] player >body
    data< 0 audio> video> 0 0 NB_MAXAL_INTERFACES iidArray req
    engine XAEngineITF-CreateMediaPlayer() ?success
    player realize ;

: destroy-player ( -- )
    player dup XAObjectItf-Destroy()  0 to player ;

previous previous

: init-mediaplayer ( -- )
    mediaplayer0 >o media-sf setSurface  mp-start o> ;

Variable playstate
: pplay? ( -- flag ) playitf playstate playitf XAPlayItf-GetPlayState() ?success
................................................................................
: ppause ( -- )
    playitf XA_PLAYSTATE_PAUSED playitf XAPlayItf-SetPlayState() ?success ;
: pplay ( -- )
    playitf XA_PLAYSTATE_PLAYING playitf XAPlayItf-SetPlayState() ?success ;
: pvol ( n -- )
    volitf swap volitf XAVolumeItf-SetVolumeLevel() ?success ;

: setup-player ( -- )  player IF
	destroy-player
    ELSE
	create-stuff
    THEN
    create-media create-player
    get-interfaces set-callbacks
    init-mediaplayer  ;
: stop-player ( -- )  mediaplayer0 >o mp-pause o> ;

0 Value pvol#
: start-file ( -- )
    setup-player  true init-enqueue  ppause pvol# pvol ;

................................................................................
0 Value oes-program

: omx-init ( -- ) create-oes-program to oes-program ;

also android

\ vertices


0.005e Fconstant m-lr
FVariable first-timestamp  0e first-timestamp f!
: get-deltat ( -- f )
    media-sft >o getTimestamp o> d>f 1e-9 f*
    first-timestamp f@ f- ;
: set-deltat ( -- f ) get-deltat mkv-time-off f@ f- first-timestamp f! ;
................................................................................
	cues>mts-run? 0= pplay? and  IF  ppause  THEN
    level# @ 0= UNTIL
    ppause screen-keep ;
: play-ts ( addr u -- ) ['] read-ts-file is read-ts
    open-mts start-file play-loop ;
: play-mkv ( addr u -- )
    ['] pull-queue is read-ts

    <event e$, ->open-mkv 0 elit, ->cues cue-task event>



    start-file play-loop stop-player ;
: replay% ( r -- )  >pos  true init-enqueue play-loop ;
: replay ( -- )
    cue-task IF
	<event 0 elit, ->cues cue-task event>
    ELSE
	0. ts-fd reposition-file throw
    THEN