mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 21:42:25 +00:00
Changed all comments to //, because Confluence has problems syntax highlighting Java with /* */ comments. Awesome.
This commit is contained in:
parent
4b608c3ca7
commit
768e602485
2 changed files with 20 additions and 22 deletions
|
@ -10,7 +10,7 @@ import com.gst_sdk.GStreamer;
|
||||||
public class Tutorial1 extends Activity {
|
public class Tutorial1 extends Activity {
|
||||||
private native String nativeGetGStreamerInfo();
|
private native String nativeGetGStreamerInfo();
|
||||||
|
|
||||||
/* Called when the activity is first created. */
|
// Called when the activity is first created.
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,24 +12,24 @@ import android.widget.Toast;
|
||||||
import com.gst_sdk.GStreamer;
|
import com.gst_sdk.GStreamer;
|
||||||
|
|
||||||
public class Tutorial2 extends Activity {
|
public class Tutorial2 extends Activity {
|
||||||
private native void nativeInit(); /* Initialize native code, build pipeline, etc */
|
private native void nativeInit(); // Initialize native code, build pipeline, etc
|
||||||
private native void nativeFinalize(); /* Destroy pipeline and shutdown native code */
|
private native void nativeFinalize(); // Destroy pipeline and shutdown native code
|
||||||
private native void nativePlay(); /* Set pipeline to PLAYING */
|
private native void nativePlay(); // Set pipeline toPLAYING
|
||||||
private native void nativePause(); /* Set pipeline to PAUSED */
|
private native void nativePause(); // Set pipeline toPAUSED
|
||||||
private static native boolean nativeClassInit(); /* Initialize native class: cache Method IDs for callbacks */
|
private static native boolean nativeClassInit(); // Initialize native class: cache Method IDs for callbacks
|
||||||
private long native_custom_data; /* Native code will use this to keep private data */
|
private long native_custom_data; // Native code will use this to keep private data
|
||||||
|
|
||||||
private boolean is_playing_desired; /* Whether the user asked to go to PLAYING */
|
private boolean is_playing_desired; // Whether the user asked to go to PLAYING
|
||||||
|
|
||||||
private Bundle initialization_data; /* onCreate parameters kept for later */
|
private Bundle initialization_data; // onCreate parameters kept for later
|
||||||
|
|
||||||
/* Called when the activity is first created. */
|
// Called when the activity is first created.
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
/* Initialize GStreamer and warn if it fails */
|
// Initialize GStreamer and warn if it fails
|
||||||
try {
|
try {
|
||||||
GStreamer.init(this);
|
GStreamer.init(this);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -56,12 +56,11 @@ public class Tutorial2 extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Keep the instance state for later, since we will not perform our initialization
|
// Keep the instance state for later, since we will not perform ourinitialization
|
||||||
* until the native code reports that it is itself initialized.
|
// until the native code reports that it is itselfinitialized.
|
||||||
*/
|
|
||||||
initialization_data = savedInstanceState;
|
initialization_data = savedInstanceState;
|
||||||
|
|
||||||
/* Start with disabled buttons, until native code is initialized */
|
// Start with disabled buttons, until native code is initialized
|
||||||
this.findViewById(R.id.button_play).setEnabled(false);
|
this.findViewById(R.id.button_play).setEnabled(false);
|
||||||
this.findViewById(R.id.button_stop).setEnabled(false);
|
this.findViewById(R.id.button_stop).setEnabled(false);
|
||||||
is_playing_desired = false;
|
is_playing_desired = false;
|
||||||
|
@ -79,7 +78,7 @@ public class Tutorial2 extends Activity {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from native code. This sets the content of the TextView from the UI thread. */
|
// Called from native code. This sets the content of the TextView from the UI thread.
|
||||||
private void setMessage(final String message) {
|
private void setMessage(final String message) {
|
||||||
final TextView tv = (TextView) this.findViewById(R.id.textview_message);
|
final TextView tv = (TextView) this.findViewById(R.id.textview_message);
|
||||||
runOnUiThread (new Runnable() {
|
runOnUiThread (new Runnable() {
|
||||||
|
@ -89,24 +88,23 @@ public class Tutorial2 extends Activity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from native code. Native code calls this once it has created its pipeline and
|
// Called from native code. Native code calls this once it has created its pipelineand
|
||||||
* the main loop is running, so it is ready to accept commands.
|
// the main loop is running, so it is ready to acceptcommands.
|
||||||
*/
|
|
||||||
private void onGStreamerInitialized () {
|
private void onGStreamerInitialized () {
|
||||||
/* If initialization data is present, retrieve it */
|
// If initialization data is present, retrieve it
|
||||||
if (initialization_data != null) {
|
if (initialization_data != null) {
|
||||||
is_playing_desired = initialization_data.getBoolean("playing");
|
is_playing_desired = initialization_data.getBoolean("playing");
|
||||||
Log.i ("GStreamer", "Restoring state, playing:" + is_playing_desired);
|
Log.i ("GStreamer", "Restoring state, playing:" + is_playing_desired);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore previous playing state */
|
// Restore previous playing state
|
||||||
if (is_playing_desired) {
|
if (is_playing_desired) {
|
||||||
nativePlay();
|
nativePlay();
|
||||||
} else {
|
} else {
|
||||||
nativePause();
|
nativePause();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-enable buttons, now that GStreamer is initialized */
|
// Re-enable buttons, now that GStreamer is initialized
|
||||||
this.findViewById(R.id.button_play).setEnabled(true);
|
this.findViewById(R.id.button_play).setEnabled(true);
|
||||||
this.findViewById(R.id.button_stop).setEnabled(true);
|
this.findViewById(R.id.button_stop).setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue