LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
-ifndef GSTREAMER_SDK_ROOT
-ifndef GSTREAMER_SDK_ROOT_ANDROID
-$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
+ifndef GSTREAMER_ROOT
+ifndef GSTREAMER_ROOT_ANDROID
+$(error GSTREAMER_ROOT_ANDROID is not defined!)
endif
-GSTREAMER_SDK_ROOT := $(GSTREAMER_SDK_ROOT_ANDROID)
+GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)
endif
-GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build/
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
GSTREAMER_PLUGINS := coreelements
-include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk
+include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
-ifndef GSTREAMER_SDK_ROOT
-ifndef GSTREAMER_SDK_ROOT_ANDROID
-$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
+ifndef GSTREAMER_ROOT
+ifndef GSTREAMER_ROOT_ANDROID
+$(error GSTREAMER_ROOT_ANDROID is not defined!)
endif
-GSTREAMER_SDK_ROOT := $(GSTREAMER_SDK_ROOT_ANDROID)
+GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)
endif
-GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build/
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
GSTREAMER_PLUGINS := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_SYS)
-include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk
+include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
LOCAL_LDLIBS := -llog -landroid
include $(BUILD_SHARED_LIBRARY)
-ifndef GSTREAMER_SDK_ROOT
-ifndef GSTREAMER_SDK_ROOT_ANDROID
-$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
+ifndef GSTREAMER_ROOT
+ifndef GSTREAMER_ROOT_ANDROID
+$(error GSTREAMER_ROOT_ANDROID is not defined!)
endif
-GSTREAMER_SDK_ROOT := $(GSTREAMER_SDK_ROOT_ANDROID)
+GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)
endif
-GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build/
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
GSTREAMER_PLUGINS := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_SYS) $(GSTREAMER_PLUGINS_EFFECTS)
-GSTREAMER_EXTRA_DEPS := gstreamer-interfaces-0.10 gstreamer-video-0.10
-include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk
+GSTREAMER_EXTRA_DEPS := gstreamer-video-1.0
+include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
#include <android/native_window.h>
#include <android/native_window_jni.h>
#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
#include <gst/video/video.h>
#include <pthread.h>
GST_DEBUG ("Initialization complete, notifying application. native_window:%p main_loop:%p", data->native_window, data->main_loop);
/* The main loop is running and we received a native window, inform the sink about it */
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->video_sink), (guintptr)data->native_window);
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data->video_sink), (guintptr)data->native_window);
(*env)->CallVoidMethod (env, data->app, on_gstreamer_initialized_method_id);
if ((*env)->ExceptionCheck (env)) {
g_main_context_push_thread_default(data->context);
/* Build pipeline */
- data->pipeline = gst_parse_launch("videotestsrc ! warptv ! ffmpegcolorspace ! autovideosink", &error);
+ data->pipeline = gst_parse_launch("videotestsrc ! warptv ! videoconvert ! autovideosink", &error);
if (error) {
gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
g_clear_error (&error);
/* Set the pipeline to READY, so it can already accept a window handle, if we have one */
gst_element_set_state(data->pipeline, GST_STATE_READY);
- data->video_sink = gst_bin_get_by_interface(GST_BIN(data->pipeline), GST_TYPE_X_OVERLAY);
+ data->video_sink = gst_bin_get_by_interface(GST_BIN(data->pipeline), GST_TYPE_VIDEO_OVERLAY);
if (!data->video_sink) {
GST_ERROR ("Could not retrieve video sink");
return NULL;
if (data->native_window) {
ANativeWindow_release (data->native_window);
if (data->native_window == new_native_window) {
- GST_DEBUG ("New native window is the same as the previous one", data->native_window);
+ GST_DEBUG ("New native window is the same as the previous one %p", data->native_window);
if (data->video_sink) {
- gst_x_overlay_expose(GST_X_OVERLAY (data->video_sink));
- gst_x_overlay_expose(GST_X_OVERLAY (data->video_sink));
+ gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->video_sink));
+ gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->video_sink));
}
return;
} else {
GST_DEBUG ("Releasing Native Window %p", data->native_window);
if (data->video_sink) {
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->video_sink), (guintptr)NULL);
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data->video_sink), (guintptr)NULL);
gst_element_set_state (data->pipeline, GST_STATE_READY);
}
LOCAL_LDLIBS := -llog -landroid
include $(BUILD_SHARED_LIBRARY)
-ifndef GSTREAMER_SDK_ROOT
-ifndef GSTREAMER_SDK_ROOT_ANDROID
-$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
+ifndef GSTREAMER_ROOT
+ifndef GSTREAMER_ROOT_ANDROID
+$(error GSTREAMER_ROOT_ANDROID is not defined!)
endif
-GSTREAMER_SDK_ROOT := $(GSTREAMER_SDK_ROOT_ANDROID)
+GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)
endif
-GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build/
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
GSTREAMER_PLUGINS := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_PLAYBACK) $(GSTREAMER_PLUGINS_CODECS) $(GSTREAMER_PLUGINS_NET) $(GSTREAMER_PLUGINS_SYS)
-GSTREAMER_EXTRA_DEPS := gstreamer-interfaces-0.10 gstreamer-video-0.10
-include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk
+GSTREAMER_EXTRA_DEPS := gstreamer-video-1.0
+include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
#include <android/native_window.h>\r
#include <android/native_window_jni.h>\r
#include <gst/gst.h>\r
-#include <gst/interfaces/xoverlay.h>\r
#include <gst/video/video.h>\r
#include <pthread.h>\r
\r
gboolean is_live; /* Live streams do not use buffering */\r
} CustomData;\r
\r
-/* playbin2 flags */\r
+/* playbin flags */\r
typedef enum {\r
GST_PLAY_FLAG_TEXT = (1 << 2) /* We want subtitle output */\r
} GstPlayFlags;\r
/* If we have pipeline and it is running, query the current position and clip duration and inform\r
* the application */\r
static gboolean refresh_ui (CustomData *data) {\r
- GstFormat fmt = GST_FORMAT_TIME;\r
gint64 current = -1;\r
gint64 position;\r
\r
\r
/* If we didn't know it yet, query the stream duration */\r
if (!GST_CLOCK_TIME_IS_VALID (data->duration)) {\r
- if (!gst_element_query_duration (data->pipeline, &fmt, &data->duration)) {\r
+ if (!gst_element_query_duration (data->pipeline, GST_FORMAT_TIME, &data->duration)) {\r
GST_WARNING ("Could not query current duration");\r
}\r
}\r
\r
- if (gst_element_query_position (data->pipeline, &fmt, &position)) {\r
+ if (gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {\r
/* Java expects these values in milliseconds, and GStreamer provides nanoseconds */\r
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);\r
}\r
GstElement *video_sink;\r
GstPad *video_sink_pad;\r
GstCaps *caps;\r
- GstVideoFormat fmt;\r
- int width;\r
- int height;\r
+ GstVideoInfo info;\r
\r
/* Retrieve the Caps at the entrance of the video sink */\r
g_object_get (data->pipeline, "video-sink", &video_sink, NULL);\r
video_sink_pad = gst_element_get_static_pad (video_sink, "sink");\r
- caps = gst_pad_get_negotiated_caps (video_sink_pad);\r
+ caps = gst_pad_get_current_caps (video_sink_pad);\r
\r
- if (gst_video_format_parse_caps(caps, &fmt, &width, &height)) {\r
- int par_n, par_d;\r
- if (gst_video_parse_caps_pixel_aspect_ratio (caps, &par_n, &par_d)) {\r
- width = width * par_n / par_d;\r
- }\r
- GST_DEBUG ("Media size is %dx%d, notifying application", width, height);\r
+ if (gst_video_info_from_caps (&info, caps)) {\r
+ info.width = info.width * info.par_n / info.par_d;\r
+ GST_DEBUG ("Media size is %dx%d, notifying application", info.width, info.height);\r
\r
- (*env)->CallVoidMethod (env, data->app, on_media_size_changed_method_id, (jint)width, (jint)height);\r
+ (*env)->CallVoidMethod (env, data->app, on_media_size_changed_method_id, (jint)info.width, (jint)info.height);\r
if ((*env)->ExceptionCheck (env)) {\r
GST_ERROR ("Failed to call Java method");\r
(*env)->ExceptionClear (env);\r
GST_DEBUG ("Initialization complete, notifying application. native_window:%p main_loop:%p", data->native_window, data->main_loop);\r
\r
/* The main loop is running and we received a native window, inform the sink about it */\r
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->pipeline), (guintptr)data->native_window);\r
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data->pipeline), (guintptr)data->native_window);\r
\r
(*env)->CallVoidMethod (env, data->app, on_gstreamer_initialized_method_id);\r
if ((*env)->ExceptionCheck (env)) {\r
g_main_context_push_thread_default(data->context);\r
\r
/* Build pipeline */\r
- data->pipeline = gst_parse_launch("playbin2", &error);\r
+ data->pipeline = gst_parse_launch("playbin", &error);\r
if (error) {\r
gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);\r
g_clear_error (&error);\r
GST_DEBUG ("Done finalizing");\r
}\r
\r
-/* Set playbin2's URI */\r
+/* Set playbin's URI */\r
void gst_native_set_uri (JNIEnv* env, jobject thiz, jstring uri) {\r
CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);\r
if (!data || !data->pipeline) return;\r
if (data->native_window) {\r
ANativeWindow_release (data->native_window);\r
if (data->native_window == new_native_window) {\r
- GST_DEBUG ("New native window is the same as the previous one", data->native_window);\r
+ GST_DEBUG ("New native window is the same as the previous one %p", data->native_window);\r
if (data->pipeline) {\r
- gst_x_overlay_expose(GST_X_OVERLAY (data->pipeline));\r
- gst_x_overlay_expose(GST_X_OVERLAY (data->pipeline));\r
+ gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->pipeline));\r
+ gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->pipeline));\r
}\r
return;\r
} else {\r
GST_DEBUG ("Releasing Native Window %p", data->native_window);\r
\r
if (data->pipeline) {\r
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->pipeline), (guintptr)NULL);\r
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data->pipeline), (guintptr)NULL);\r
gst_element_set_state (data->pipeline, GST_STATE_READY);\r
}\r
\r
LOCAL_LDLIBS := -llog -landroid
include $(BUILD_SHARED_LIBRARY)
-ifndef GSTREAMER_SDK_ROOT
-ifndef GSTREAMER_SDK_ROOT_ANDROID
-$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
+ifndef GSTREAMER_ROOT
+ifndef GSTREAMER_ROOT_ANDROID
+$(error GSTREAMER_ROOT_ANDROID is not defined!)
endif
-GSTREAMER_SDK_ROOT := $(GSTREAMER_SDK_ROOT_ANDROID)
+GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)
endif
-GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build/
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
GSTREAMER_PLUGINS := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_PLAYBACK) $(GSTREAMER_PLUGINS_CODECS) $(GSTREAMER_PLUGINS_NET) $(GSTREAMER_PLUGINS_SYS)
G_IO_MODULES := gnutls
-GSTREAMER_EXTRA_DEPS := gstreamer-interfaces-0.10 gstreamer-video-0.10
-include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk
+GSTREAMER_EXTRA_DEPS := gstreamer-video-1.0
+include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
#include <android/native_window.h>
#include <android/native_window_jni.h>
#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
#include <gst/video/video.h>
+#include <gst/video/videooverlay.h>
#include <pthread.h>
GST_DEBUG_CATEGORY_STATIC (debug_category);
/* If we have pipeline and it is running, query the current position and clip duration and inform
* the application */
static gboolean refresh_ui (CustomData *data) {
- GstFormat fmt = GST_FORMAT_TIME;
gint64 current = -1;
gint64 position;
/* If we didn't know it yet, query the stream duration */
if (!GST_CLOCK_TIME_IS_VALID (data->duration)) {
- if (!gst_element_query_duration (data->pipeline, &fmt, &data->duration)) {
+ if (!gst_element_query_duration (data->pipeline, GST_FORMAT_TIME, &data->duration)) {
GST_WARNING ("Could not query current duration (normal for still pictures)");
data->duration = 0;
}
}
- if (!gst_element_query_position (data->pipeline, &fmt, &position)) {
+ if (!gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {
GST_WARNING ("Could not query current position (normal for still pictures)");
position = 0;
}
GstElement *video_sink;
GstPad *video_sink_pad;
GstCaps *caps;
- GstVideoFormat fmt;
- int width;
- int height;
+ GstVideoInfo info;
/* Retrieve the Caps at the entrance of the video sink */
g_object_get (data->pipeline, "video-sink", &video_sink, NULL);
video_sink_pad = gst_element_get_static_pad (video_sink, "sink");
- caps = gst_pad_get_negotiated_caps (video_sink_pad);
+ caps = gst_pad_get_current_caps (video_sink_pad);
- if (gst_video_format_parse_caps(caps, &fmt, &width, &height)) {
- int par_n, par_d;
- if (gst_video_parse_caps_pixel_aspect_ratio (caps, &par_n, &par_d)) {
- width = width * par_n / par_d;
- }
- GST_DEBUG ("Media size is %dx%d, notifying application", width, height);
+ if (gst_video_info_from_caps(&info, caps)) {
+ info.width = info.width * info.par_n / info.par_d;
+ GST_DEBUG ("Media size is %dx%d, notifying application", info.width, info.height);
- (*env)->CallVoidMethod (env, data->app, on_media_size_changed_method_id, (jint)width, (jint)height);
+ (*env)->CallVoidMethod (env, data->app, on_media_size_changed_method_id, (jint)info.width, (jint)info.height);
if ((*env)->ExceptionCheck (env)) {
GST_ERROR ("Failed to call Java method");
(*env)->ExceptionClear (env);
GST_DEBUG ("Initialization complete, notifying application. native_window:%p main_loop:%p", data->native_window, data->main_loop);
/* The main loop is running and we received a native window, inform the sink about it */
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->pipeline), (guintptr)data->native_window);
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data->pipeline), (guintptr)data->native_window);
(*env)->CallVoidMethod (env, data->app, on_gstreamer_initialized_method_id);
if ((*env)->ExceptionCheck (env)) {
g_main_context_push_thread_default(data->context);
/* Build pipeline */
- data->pipeline = gst_parse_launch("playbin2", &error);
+ data->pipeline = gst_parse_launch("playbin", &error);
if (error) {
gchar *message = g_strdup_printf("Unable to build pipeline: %s", error->message);
g_clear_error (&error);
if (data->native_window) {
ANativeWindow_release (data->native_window);
if (data->native_window == new_native_window) {
- GST_DEBUG ("New native window is the same as the previous one", data->native_window);
+ GST_DEBUG ("New native window is the same as the previous one %p", data->native_window);
if (data->pipeline) {
- gst_x_overlay_expose(GST_X_OVERLAY (data->pipeline));
- gst_x_overlay_expose(GST_X_OVERLAY (data->pipeline));
+ gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->pipeline));
+ gst_video_overlay_expose(GST_VIDEO_OVERLAY (data->pipeline));
}
return;
} else {
GST_DEBUG ("Releasing Native Window %p", data->native_window);
if (data->pipeline) {
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->pipeline), (guintptr)NULL);
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data->pipeline), (guintptr)NULL);
gst_element_set_state (data->pipeline, GST_STATE_READY);
}