summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-11-07 12:30:20 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-11-09 19:41:22 +0200
commitbf3fb8d7a735370a8f5353255970bd1d82e3e901 (patch)
treeb927d2ff41d03099c65995b0d45d174621c78300
parent75ab4b1ae4b84629738050a72b08078f34585966 (diff)
downloadgstreamer-plugins-bad-bf3fb8d7a735370a8f5353255970bd1d82e3e901.tar.gz
amc: Allow registering codecs, camera or sensors if any of the others failed
https://bugzilla.gnome.org/show_bug.cgi?id=774048
-rw-r--r--sys/androidmedia/gstamc.c71
1 files changed, 47 insertions, 24 deletions
diff --git a/sys/androidmedia/gstamc.c b/sys/androidmedia/gstamc.c
index b6146d056..643be542e 100644
--- a/sys/androidmedia/gstamc.c
+++ b/sys/androidmedia/gstamc.c
@@ -3331,18 +3331,15 @@ register_codecs (GstPlugin * plugin)
}
static gboolean
-plugin_init (GstPlugin * plugin)
+amc_init (GstPlugin * plugin)
{
const gchar *ignore;
- GST_DEBUG_CATEGORY_INIT (gst_amc_debug, "amc", 0, "android-media-codec");
-
- if (!gst_amc_jni_initialize ())
- return FALSE;
-
gst_plugin_add_dependency_simple (plugin, NULL, "/etc", "media_codecs.xml",
GST_PLUGIN_DEPENDENCY_FLAG_NONE);
+ gst_amc_codec_info_quark = g_quark_from_static_string ("gst-amc-codec-info");
+
if (!get_java_classes ())
return FALSE;
@@ -3357,44 +3354,70 @@ plugin_init (GstPlugin * plugin)
if (!scan_codecs (plugin))
return FALSE;
- gst_amc_codec_info_quark = g_quark_from_static_string ("gst-amc-codec-info");
-
if (!register_codecs (plugin))
return FALSE;
+ return TRUE;
+}
+
+static gboolean
+ahc_init (GstPlugin * plugin)
+{
if (!gst_android_graphics_imageformat_init ()) {
GST_ERROR ("Failed to init android image format");
- goto failed_surfacetexture;
+ return FALSE;
}
if (!gst_android_hardware_camera_init ()) {
- goto failed_graphics_imageformat;
- }
-
- if (!gst_android_hardware_sensor_init ()) {
- goto failed_hardware_camera;
+ gst_android_graphics_imageformat_deinit ();
+ return FALSE;
}
if (!gst_element_register (plugin, "ahcsrc", GST_RANK_NONE, GST_TYPE_AHC_SRC)) {
GST_ERROR ("Failed to register android camera source");
- goto failed_hardware_sensor;
+ gst_android_hardware_camera_deinit ();
+ gst_android_graphics_imageformat_deinit ();
+ return FALSE;
}
+ return TRUE;
+}
+
+static gboolean
+ahs_init (GstPlugin * plugin)
+{
+ if (!gst_android_hardware_sensor_init ())
+ return FALSE;
+
if (!gst_element_register (plugin, "ahssrc", GST_RANK_NONE, GST_TYPE_AHS_SRC)) {
GST_ERROR ("Failed to register android sensor source");
- goto failed_hardware_sensor;
+ gst_android_hardware_sensor_deinit ();
+ return FALSE;
}
return TRUE;
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ gboolean init_ok = FALSE;
+
+ GST_DEBUG_CATEGORY_INIT (gst_amc_debug, "amc", 0, "android-media-codec");
+
+ if (!gst_amc_jni_initialize ())
+ return FALSE;
+
+ if (amc_init (plugin))
+ init_ok = TRUE;
+
+ if (ahc_init (plugin))
+ init_ok = TRUE;
+
+ if (ahs_init (plugin))
+ init_ok = TRUE;
-failed_hardware_sensor:
- gst_android_hardware_sensor_deinit ();
-failed_hardware_camera:
- gst_android_hardware_camera_deinit ();
-failed_graphics_imageformat:
- gst_android_graphics_imageformat_deinit ();
-failed_surfacetexture:
- return FALSE;
+ return init_ok;
}
void