SmartPlayerJni.java
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
163
164
165
/*
* SmartPlayerJni.java
* SmartPlayerJni
*
* Github: https://github.com/daniulive/SmarterStreaming
*
* Created by DaniuLive on 2015/09/26.
* Copyright © 2014~2016 DaniuLive. All rights reserved.
*/
package com.daniulive.smartplayer;
import com.eventhandle.SmartEventCallback;
public class SmartPlayerJni {
/**
* Initialize Player.
*
* @param ctx: get by this.getApplicationContext()
*
* <pre>This function must be called firstly.</pre>
*
* @return player handle if successful, if return 0, which means init failed.
*/
public native long SmartPlayerInit(Object ctx);
/**
* Set callback event
*
* @param callback function
*
* @return {0} if successful
*/
public native int SetSmartPlayerEventCallback(long handle, SmartEventCallback callback);
/**
* Set Video HW decoder, if support HW decoder, it will return 0
*
* @param isHWDecoder: 0: software decoder; 1: hardware decoder.
*
* @return {0} if successful
*/
public native int SetSmartPlayerVideoHWDecoder(long handle, int isHWDecoder);
/**
* Set Surface view.
*
* @param handle: return value from SmartPlayerInit()
*
* @param glSurface: surface view
*
* <pre> NOTE: if not set or set surface with null, it will playback audio only. </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerSetSurface(long handle, Object surface);
/**
* Set External Render.
*
* @param handle: return value from SmartPlayerInit()
*
* @param external_render: External Render
*
* @return {0} if successful
*/
public native int SmartPlayerSetExternalRender(long handle, Object external_render);
/**
* Set AudioOutput Type
*
* @param handle: return value from SmartPlayerInit()
*
* @param use_audiotrack:
*
* <pre> NOTE: if use_audiotrack with 0: it will use auto-select output devices; if with 1: will use audiotrack mode. </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerSetAudioOutputType(long handle, int use_audiotrack);
/**
* Set buffer
*
* @param handle: return value from SmartPlayerInit()
*
* @param buffer:
*
* <pre> NOTE: Unit is millisecond, range is 200-5000 ms </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerSetBuffer(long handle, int buffer);
/**
* Set mute or not
*
* @param is_mute: if with 1:mute, if with 0: does not mute
*
* @return {0} if successful
*/
public native int SmartPlayerSetMute(long handle, int is_mute);
/**
* It's only used when playback RTSP stream
*
* Default with UDP mode
*
* @param isUsingTCP: if with 1, it will via TCP mode, while 0 with UDP mode
*
* @return {0} if successful
*/
public native int SmartPlayerSetRTSPTcpMode(long handle, int is_using_tcp);
/**
* Set fast startup
*
* @param is_fast_startup: if with 1, it will second play back, if with 0: does not it
*
* @return {0} if successful
*/
public native int SmartPlayerSetFastStartup(long handle, int is_fast_startup);
/**
* Set playback orientation.
*
* @param handle: return value from SmartPlayerInit()
*
* @param surOrg: current orientation, PORTRAIT 1, LANDSCAPE with 2
*
* @return {0} if successful
*/
public native int SmartPlayerSetOrientation(long handle, int surOrg);
/**
* Start playback stream
*
* @param handle: return value from SmartPlayerInit()
*
* @param uri: playback uri
*
* @return {0} if successful
*/
public native int SmartPlayerStartPlayback(long handle, String uri);
/**
* Close player instance.
*
* @param handle: return value from SmartPlayerInit()
*
* <pre> NOTE: it could not use player handle after call this function. </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerClose(long handle);
}