androidmedia: allow multiple implementations of codec and format

When implementing NDK media support, it would be useful to also have JNI
implementation in the same binary as NDK media compatibility is lower.
As such, implement a rudimentary vtable system for gstamc-codec and
gstamc-format, and allow choosing the implementation at static_init()
time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4115>
This commit is contained in:
Ratchanan Srirattanamet 2023-11-12 02:32:21 +07:00 committed by GStreamer Marge Bot
parent d0ffcb46df
commit a50ce9c6b0
13 changed files with 716 additions and 153 deletions

View file

@ -0,0 +1,179 @@
/*
* Copyright (C) 2012,2018 Collabora Ltd.
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (C) 2022 Ratchanan Srirattanamet <peathot@hotmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include "gstamc-codec.h"
GstAmcCodecVTable *gst_amc_codec_vtable = NULL;
void
gst_amc_buffer_free (GstAmcBuffer * buffer)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->buffer_free (buffer);
}
gboolean
gst_amc_buffer_set_position_and_limit (GstAmcBuffer * buffer, GError ** err,
gint position, gint limit)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->buffer_set_position_and_limit (buffer, err,
position, limit);
}
GstAmcCodec *
gst_amc_codec_new (const gchar * name, gboolean is_encoder, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->create (name, is_encoder, err);
}
void
gst_amc_codec_free (GstAmcCodec * codec)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->free (codec);
}
gboolean
gst_amc_codec_configure (GstAmcCodec * codec, GstAmcFormat * format,
GstAmcSurfaceTexture * surface_texture, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->configure (codec, format, surface_texture, err);
}
GstAmcFormat *
gst_amc_codec_get_output_format (GstAmcCodec * codec, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->get_output_format (codec, err);
}
gboolean
gst_amc_codec_start (GstAmcCodec * codec, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->start (codec, err);
}
gboolean
gst_amc_codec_stop (GstAmcCodec * codec, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->stop (codec, err);
}
gboolean
gst_amc_codec_flush (GstAmcCodec * codec, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->flush (codec, err);
}
gboolean
gst_amc_codec_release (GstAmcCodec * codec, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->release (codec, err);
}
gboolean
gst_amc_codec_request_key_frame (GstAmcCodec * codec, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->request_key_frame (codec, err);
}
gboolean
gst_amc_codec_have_dynamic_bitrate (void)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->have_dynamic_bitrate ();
}
gboolean
gst_amc_codec_set_dynamic_bitrate (GstAmcCodec * codec, GError ** err,
gint bitrate)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->set_dynamic_bitrate (codec, err, bitrate);
}
GstAmcBuffer *
gst_amc_codec_get_output_buffer (GstAmcCodec * codec, gint index, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->get_output_buffer (codec, index, err);
}
GstAmcBuffer *
gst_amc_codec_get_input_buffer (GstAmcCodec * codec, gint index, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->get_input_buffer (codec, index, err);
}
gint
gst_amc_codec_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs,
GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->dequeue_input_buffer (codec, timeoutUs, err);
}
gint
gst_amc_codec_dequeue_output_buffer (GstAmcCodec * codec,
GstAmcBufferInfo * info, gint64 timeoutUs, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->dequeue_output_buffer (codec, info, timeoutUs,
err);
}
gboolean
gst_amc_codec_queue_input_buffer (GstAmcCodec * codec, gint index,
const GstAmcBufferInfo * info, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->queue_input_buffer (codec, index, info, err);
}
gboolean
gst_amc_codec_release_output_buffer (GstAmcCodec * codec, gint index,
gboolean render, GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->release_output_buffer (codec, index, render,
err);
}
GstAmcSurfaceTexture *
gst_amc_codec_new_surface_texture (GError ** err)
{
g_assert (gst_amc_codec_vtable != NULL);
return gst_amc_codec_vtable->new_surface_texture (err);
}

View file

@ -30,6 +30,7 @@ G_BEGIN_DECLS
typedef struct _GstAmcBuffer GstAmcBuffer;
typedef struct _GstAmcBufferInfo GstAmcBufferInfo;
typedef struct _GstAmcCodecVTable GstAmcCodecVTable;
typedef struct _GstAmcCodec GstAmcCodec;
struct _GstAmcBuffer {
@ -44,6 +45,82 @@ struct _GstAmcBufferInfo {
gint size;
};
struct _GstAmcCodecVTable
{
void (* buffer_free) (GstAmcBuffer * buffer);
gboolean (* buffer_set_position_and_limit) (GstAmcBuffer * buffer,
GError ** err,
gint position,
gint limit);
GstAmcCodec * (* create) (const gchar * name,
gboolean is_encoder,
GError ** err);
void (* free) (GstAmcCodec * codec);
gboolean (* configure) (GstAmcCodec * codec,
GstAmcFormat * format,
GstAmcSurfaceTexture * surface_texture,
GError **err);
GstAmcFormat * (* get_output_format) (GstAmcCodec * codec,
GError **err);
gboolean (* start) (GstAmcCodec * codec,
GError **err);
gboolean (* stop) (GstAmcCodec * codec,
GError **err);
gboolean (* flush) (GstAmcCodec * codec,
GError **err);
gboolean (* release) (GstAmcCodec * codec,
GError **err);
gboolean (* request_key_frame) (GstAmcCodec * codec,
GError **err);
gboolean (* have_dynamic_bitrate) (void);
gboolean (* set_dynamic_bitrate) (GstAmcCodec * codec,
GError **err,
gint bitrate);
GstAmcBuffer * (* get_output_buffer) (GstAmcCodec * codec,
gint index,
GError **err);
GstAmcBuffer * (* get_input_buffer) (GstAmcCodec * codec,
gint index,
GError **err);
gint (* dequeue_input_buffer) (GstAmcCodec * codec,
gint64 timeoutUs,
GError **err);
gint (* dequeue_output_buffer) (GstAmcCodec * codec,
GstAmcBufferInfo *info,
gint64 timeoutUs,
GError **err);
gboolean (* queue_input_buffer) (GstAmcCodec * codec,
gint index,
const GstAmcBufferInfo *info,
GError **err);
gboolean (* release_output_buffer) (GstAmcCodec * codec,
gint index,
gboolean render,
GError **err);
GstAmcSurfaceTexture * (* new_surface_texture) (GError ** err);
};
extern GstAmcCodecVTable *gst_amc_codec_vtable;
void gst_amc_buffer_free (GstAmcBuffer * buffer);
gboolean gst_amc_buffer_set_position_and_limit (GstAmcBuffer * buffer, GError ** err,
gint position, gint limit);

View file

@ -0,0 +1,122 @@
/*
* Copyright (C) 2012,2018 Collabora Ltd.
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (C) 2023 Ratchanan Srirattanamet <peathot@hotmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include "gstamc-format.h"
GstAmcFormatVTable *gst_amc_format_vtable = NULL;
GstAmcFormat *
gst_amc_format_new_audio (const gchar * mime, gint sample_rate, gint channels,
GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->new_audio (mime, sample_rate, channels, err);
}
GstAmcFormat *
gst_amc_format_new_video (const gchar * mime, gint width, gint height,
GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->new_video (mime, width, height, err);
}
void
gst_amc_format_free (GstAmcFormat * format)
{
g_assert (gst_amc_format_vtable != NULL);
gst_amc_format_vtable->free (format);
}
gchar *
gst_amc_format_to_string (GstAmcFormat * format, GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->to_string (format, err);
}
gboolean
gst_amc_format_get_float (GstAmcFormat * format, const gchar * key,
gfloat * value, GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->get_float (format, key, value, err);
}
gboolean
gst_amc_format_set_float (GstAmcFormat * format, const gchar * key,
gfloat value, GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->set_float (format, key, value, err);
}
gboolean
gst_amc_format_get_int (GstAmcFormat * format, const gchar * key, gint * value,
GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->get_int (format, key, value, err);
}
gboolean
gst_amc_format_set_int (GstAmcFormat * format, const gchar * key, gint value,
GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->set_int (format, key, value, err);
}
gboolean
gst_amc_format_get_string (GstAmcFormat * format, const gchar * key,
gchar ** value, GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->get_string (format, key, value, err);
}
gboolean
gst_amc_format_set_string (GstAmcFormat * format, const gchar * key,
const gchar * value, GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->set_string (format, key, value, err);
}
gboolean
gst_amc_format_get_buffer (GstAmcFormat * format, const gchar * key,
guint8 ** data, gsize * size, GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->get_buffer (format, key, data, size, err);
}
gboolean
gst_amc_format_set_buffer (GstAmcFormat * format, const gchar * key,
guint8 * data, gsize size, GError ** err)
{
g_assert (gst_amc_format_vtable != NULL);
return gst_amc_format_vtable->set_buffer (format, key, data, size, err);
}

View file

@ -25,9 +25,71 @@
G_BEGIN_DECLS
typedef struct _GstAmcFormatVTable GstAmcFormatVTable;
typedef struct _GstAmcFormat GstAmcFormat;
typedef struct _GstAmcColorFormatInfo GstAmcColorFormatInfo;
struct _GstAmcFormatVTable {
GstAmcFormat * (* new_audio) (const gchar *mime,
gint sample_rate,
gint channels,
GError **err);
GstAmcFormat * (* new_video) (const gchar *mime,
gint width,
gint height,
GError **err);
void (* free) (GstAmcFormat * format);
gchar * (* to_string) (GstAmcFormat * format,
GError **err);
gboolean (* get_float) (GstAmcFormat *format,
const gchar *key,
gfloat *value,
GError **err);
gboolean (* set_float) (GstAmcFormat *format,
const gchar *key,
gfloat value,
GError **err);
gboolean (* get_int) (GstAmcFormat *format,
const gchar *key,
gint *value,
GError **err);
gboolean (* set_int) (GstAmcFormat *format,
const gchar *key,
gint value,
GError **err);
gboolean (* get_string) (GstAmcFormat *format,
const gchar *key,
gchar **value,
GError **err);
gboolean (* set_string) (GstAmcFormat *format,
const gchar *key,
const gchar *value,
GError **err);
gboolean (* get_buffer) (GstAmcFormat *format,
const gchar *key,
guint8 **data,
gsize *size,
GError **err);
gboolean (* set_buffer) (GstAmcFormat *format,
const gchar *key,
guint8 *data,
gsize size,
GError **err);
};
extern GstAmcFormatVTable *gst_amc_format_vtable;
GstAmcFormat * gst_amc_format_new_audio (const gchar *mime, gint sample_rate, gint channels, GError **err);
GstAmcFormat * gst_amc_format_new_video (const gchar *mime, gint width, gint height, GError **err);
void gst_amc_format_free (GstAmcFormat * format);

View file

@ -413,8 +413,8 @@ error:
return FALSE;
}
void
gst_amc_buffer_free (GstAmcBuffer * buffer_)
static void
gst_amc_buffer_jni_free (GstAmcBuffer * buffer_)
{
RealBuffer *buffer = (RealBuffer *) buffer_;
JNIEnv *env;
@ -470,9 +470,9 @@ gst_amc_buffer_get_position_and_limit (RealBuffer * buffer_, GError ** err,
return TRUE;
}
gboolean
gst_amc_buffer_set_position_and_limit (GstAmcBuffer * buffer_, GError ** err,
gint position, gint limit)
static gboolean
gst_amc_buffer_jni_set_position_and_limit (GstAmcBuffer * buffer_,
GError ** err, gint position, gint limit)
{
RealBuffer *buffer = (RealBuffer *) buffer_;
JNIEnv *env;
@ -498,8 +498,8 @@ gst_amc_buffer_set_position_and_limit (GstAmcBuffer * buffer_, GError ** err,
return TRUE;
}
GstAmcCodec *
gst_amc_codec_new (const gchar * name, gboolean is_encoder, GError ** err)
static GstAmcCodec *
gst_amc_codec_jni_new (const gchar * name, gboolean is_encoder, GError ** err)
{
JNIEnv *env;
GstAmcCodec *codec = NULL;
@ -545,8 +545,8 @@ error:
goto done;
}
void
gst_amc_codec_free (GstAmcCodec * codec)
static void
gst_amc_codec_jni_free (GstAmcCodec * codec)
{
JNIEnv *env;
@ -572,8 +572,8 @@ gst_amc_codec_free (GstAmcCodec * codec)
g_slice_free (GstAmcCodec, codec);
}
gboolean
gst_amc_codec_configure (GstAmcCodec * codec, GstAmcFormat * format,
static gboolean
gst_amc_codec_jni_configure (GstAmcCodec * codec, GstAmcFormat * format,
GstAmcSurfaceTexture * surface, GError ** err)
{
JNIEnv *env;
@ -602,8 +602,8 @@ gst_amc_codec_configure (GstAmcCodec * codec, GstAmcFormat * format,
codec->surface ? codec->surface->jobject : NULL, NULL, flags);
}
GstAmcFormat *
gst_amc_codec_get_output_format (GstAmcCodec * codec, GError ** err)
static GstAmcFormat *
gst_amc_codec_jni_get_output_format (GstAmcCodec * codec, GError ** err)
{
JNIEnv *env;
GstAmcFormat *ret = NULL;
@ -633,8 +633,8 @@ done:
}
static RealBuffer *
gst_amc_codec_get_input_buffers (GstAmcCodec * codec, gsize * n_buffers,
GError ** err)
gst_amc_codec_jni_get_input_buffers (GstAmcCodec * codec,
gsize * n_buffers, GError ** err)
{
JNIEnv *env;
jobject input_buffers = NULL;
@ -660,8 +660,8 @@ done:
}
static RealBuffer *
gst_amc_codec_get_output_buffers (GstAmcCodec * codec, gsize * n_buffers,
GError ** err)
gst_amc_codec_jni_get_output_buffers (GstAmcCodec * codec,
gsize * n_buffers, GError ** err)
{
JNIEnv *env;
jobject output_buffers = NULL;
@ -686,8 +686,8 @@ done:
return ret;
}
gboolean
gst_amc_codec_start (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_jni_start (GstAmcCodec * codec, GError ** err)
{
JNIEnv *env;
gboolean ret;
@ -705,7 +705,8 @@ gst_amc_codec_start (GstAmcCodec * codec, GError ** err)
gst_amc_jni_free_buffer_array (env, codec->input_buffers,
codec->n_input_buffers);
codec->input_buffers =
gst_amc_codec_get_input_buffers (codec, &codec->n_input_buffers, err);
gst_amc_codec_jni_get_input_buffers (codec, &codec->n_input_buffers,
err);
if (!codec->input_buffers) {
gst_amc_codec_stop (codec, NULL);
return FALSE;
@ -715,8 +716,8 @@ gst_amc_codec_start (GstAmcCodec * codec, GError ** err)
return ret;
}
gboolean
gst_amc_codec_stop (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_jni_stop (GstAmcCodec * codec, GError ** err)
{
JNIEnv *env;
@ -740,8 +741,8 @@ gst_amc_codec_stop (GstAmcCodec * codec, GError ** err)
media_codec.stop);
}
gboolean
gst_amc_codec_flush (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_jni_flush (GstAmcCodec * codec, GError ** err)
{
JNIEnv *env;
@ -753,7 +754,7 @@ gst_amc_codec_flush (GstAmcCodec * codec, GError ** err)
}
static gboolean
gst_amc_codec_set_parameter (GstAmcCodec * codec, JNIEnv * env,
gst_amc_codec_jni_set_parameter (GstAmcCodec * codec, JNIEnv * env,
GError ** err, const gchar * key, int value)
{
gboolean ret = FALSE;
@ -786,28 +787,28 @@ done:
return ret;
}
gboolean
gst_amc_codec_request_key_frame (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_jni_request_key_frame (GstAmcCodec * codec, GError ** err)
{
JNIEnv *env;
g_return_val_if_fail (codec != NULL, FALSE);
env = gst_amc_jni_get_env ();
return gst_amc_codec_set_parameter (codec, env, err,
return gst_amc_codec_jni_set_parameter (codec, env, err,
PARAMETER_KEY_REQUEST_SYNC_FRAME, 0);
}
gboolean
gst_amc_codec_have_dynamic_bitrate ()
static gboolean
gst_amc_codec_jni_have_dynamic_bitrate ()
{
/* Dynamic bitrate scaling is supported on Android >= 19,
* where the setParameters() call is available */
return (media_codec.setParameters != NULL);
}
gboolean
gst_amc_codec_set_dynamic_bitrate (GstAmcCodec * codec, GError ** err,
static gboolean
gst_amc_codec_jni_set_dynamic_bitrate (GstAmcCodec * codec, GError ** err,
gint bitrate)
{
JNIEnv *env;
@ -815,12 +816,12 @@ gst_amc_codec_set_dynamic_bitrate (GstAmcCodec * codec, GError ** err,
g_return_val_if_fail (codec != NULL, FALSE);
env = gst_amc_jni_get_env ();
return gst_amc_codec_set_parameter (codec, env, err,
return gst_amc_codec_jni_set_parameter (codec, env, err,
PARAMETER_KEY_VIDEO_BITRATE, bitrate);
}
gboolean
gst_amc_codec_release (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_jni_release (GstAmcCodec * codec, GError ** err)
{
JNIEnv *env;
@ -844,8 +845,9 @@ gst_amc_codec_release (GstAmcCodec * codec, GError ** err)
media_codec.release);
}
GstAmcBuffer *
gst_amc_codec_get_output_buffer (GstAmcCodec * codec, gint index, GError ** err)
static GstAmcBuffer *
gst_amc_codec_jni_get_output_buffer (GstAmcCodec * codec, gint index,
GError ** err)
{
JNIEnv *env;
jobject buffer = NULL;
@ -898,8 +900,9 @@ error:
return NULL;
}
GstAmcBuffer *
gst_amc_codec_get_input_buffer (GstAmcCodec * codec, gint index, GError ** err)
static GstAmcBuffer *
gst_amc_codec_jni_get_input_buffer (GstAmcCodec * codec, gint index,
GError ** err)
{
JNIEnv *env;
jobject buffer = NULL;
@ -952,8 +955,8 @@ error:
return NULL;
}
gint
gst_amc_codec_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs,
static gint
gst_amc_codec_jni_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs,
GError ** err)
{
JNIEnv *env;
@ -970,8 +973,8 @@ gst_amc_codec_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs,
}
static gboolean
gst_amc_codec_fill_buffer_info (JNIEnv * env, jobject buffer_info,
GstAmcBufferInfo * info, GError ** err)
gst_amc_codec_jni_fill_buffer_info (JNIEnv * env,
jobject buffer_info, GstAmcBufferInfo * info, GError ** err)
{
g_return_val_if_fail (buffer_info != NULL, FALSE);
@ -995,8 +998,8 @@ gst_amc_codec_fill_buffer_info (JNIEnv * env, jobject buffer_info,
return TRUE;
}
gint
gst_amc_codec_dequeue_output_buffer (GstAmcCodec * codec,
static gint
gst_amc_codec_jni_dequeue_output_buffer (GstAmcCodec * codec,
GstAmcBufferInfo * info, gint64 timeoutUs, GError ** err)
{
JNIEnv *env;
@ -1027,8 +1030,8 @@ gst_amc_codec_dequeue_output_buffer (GstAmcCodec * codec,
gst_amc_jni_free_buffer_array (env, codec->output_buffers,
codec->n_output_buffers);
codec->output_buffers =
gst_amc_codec_get_output_buffers (codec,
&codec->n_output_buffers, err);
gst_amc_codec_jni_get_output_buffers (codec, &codec->n_output_buffers,
err);
if (!codec->output_buffers) {
ret = G_MININT;
goto done;
@ -1042,7 +1045,7 @@ gst_amc_codec_dequeue_output_buffer (GstAmcCodec * codec,
goto done;
}
if (ret >= 0 && !gst_amc_codec_fill_buffer_info (env, info_o, info, err)) {
if (ret >= 0 && !gst_amc_codec_jni_fill_buffer_info (env, info_o, info, err)) {
ret = G_MININT;
goto done;
}
@ -1055,8 +1058,8 @@ done:
return ret;
}
gboolean
gst_amc_codec_queue_input_buffer (GstAmcCodec * codec, gint index,
static gboolean
gst_amc_codec_jni_queue_input_buffer (GstAmcCodec * codec, gint index,
const GstAmcBufferInfo * info, GError ** err)
{
JNIEnv *env;
@ -1070,8 +1073,8 @@ gst_amc_codec_queue_input_buffer (GstAmcCodec * codec, gint index,
info->presentation_time_us, info->flags);
}
gboolean
gst_amc_codec_release_output_buffer (GstAmcCodec * codec, gint index,
static gboolean
gst_amc_codec_jni_release_output_buffer (GstAmcCodec * codec, gint index,
gboolean render, GError ** err)
{
JNIEnv *env;
@ -1083,8 +1086,40 @@ gst_amc_codec_release_output_buffer (GstAmcCodec * codec, gint index,
media_codec.release_output_buffer, index, render);
}
GstAmcSurfaceTexture *
gst_amc_codec_new_surface_texture (GError ** err)
static GstAmcSurfaceTexture *
gst_amc_codec_jni_new_surface_texture (GError ** err)
{
return (GstAmcSurfaceTexture *) gst_amc_surface_texture_jni_new (err);
}
GstAmcCodecVTable gst_amc_codec_jni_vtable = {
.buffer_free = gst_amc_buffer_jni_free,
.buffer_set_position_and_limit = gst_amc_buffer_jni_set_position_and_limit,
.create = gst_amc_codec_jni_new,
.free = gst_amc_codec_jni_free,
.configure = gst_amc_codec_jni_configure,
.get_output_format = gst_amc_codec_jni_get_output_format,
.start = gst_amc_codec_jni_start,
.stop = gst_amc_codec_jni_stop,
.flush = gst_amc_codec_jni_flush,
.request_key_frame = gst_amc_codec_jni_request_key_frame,
.have_dynamic_bitrate = gst_amc_codec_jni_have_dynamic_bitrate,
.set_dynamic_bitrate = gst_amc_codec_jni_set_dynamic_bitrate,
.release = gst_amc_codec_jni_release,
.get_output_buffer = gst_amc_codec_jni_get_output_buffer,
.get_input_buffer = gst_amc_codec_jni_get_input_buffer,
.dequeue_input_buffer = gst_amc_codec_jni_dequeue_input_buffer,
.dequeue_output_buffer = gst_amc_codec_jni_dequeue_output_buffer,
.queue_input_buffer = gst_amc_codec_jni_queue_input_buffer,
.release_output_buffer = gst_amc_codec_jni_release_output_buffer,
.new_surface_texture = gst_amc_codec_jni_new_surface_texture,
};

View file

@ -131,9 +131,9 @@ done:
return ret;
}
GstAmcFormat *
gst_amc_format_new_audio (const gchar * mime, gint sample_rate, gint channels,
GError ** err)
static GstAmcFormat *
gst_amc_format_jni_new_audio (const gchar * mime, gint sample_rate,
gint channels, GError ** err)
{
JNIEnv *env;
GstAmcFormat *format = NULL;
@ -168,8 +168,8 @@ error:
goto done;
}
GstAmcFormat *
gst_amc_format_new_video (const gchar * mime, gint width, gint height,
static GstAmcFormat *
gst_amc_format_jni_new_video (const gchar * mime, gint width, gint height,
GError ** err)
{
JNIEnv *env;
@ -205,8 +205,8 @@ error:
goto done;
}
void
gst_amc_format_free (GstAmcFormat * format)
static void
gst_amc_format_jni_free (GstAmcFormat * format)
{
JNIEnv *env;
@ -217,8 +217,8 @@ gst_amc_format_free (GstAmcFormat * format)
g_slice_free (GstAmcFormat, format);
}
gchar *
gst_amc_format_to_string (GstAmcFormat * format, GError ** err)
static gchar *
gst_amc_format_jni_to_string (GstAmcFormat * format, GError ** err)
{
JNIEnv *env;
jstring v_str = NULL;
@ -238,8 +238,8 @@ done:
return ret;
}
gboolean
gst_amc_format_get_float (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_jni_get_float (GstAmcFormat * format, const gchar * key,
gfloat * value, GError ** err)
{
JNIEnv *env;
@ -269,8 +269,8 @@ done:
return ret;
}
gboolean
gst_amc_format_set_float (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_jni_set_float (GstAmcFormat * format, const gchar * key,
gfloat value, GError ** err)
{
JNIEnv *env;
@ -299,9 +299,9 @@ done:
return ret;
}
gboolean
gst_amc_format_get_int (GstAmcFormat * format, const gchar * key, gint * value,
GError ** err)
static gboolean
gst_amc_format_jni_get_int (GstAmcFormat * format, const gchar * key,
gint * value, GError ** err)
{
JNIEnv *env;
gboolean ret = FALSE;
@ -331,9 +331,9 @@ done:
}
gboolean
gst_amc_format_set_int (GstAmcFormat * format, const gchar * key, gint value,
GError ** err)
static gboolean
gst_amc_format_jni_set_int (GstAmcFormat * format, const gchar * key,
gint value, GError ** err)
{
JNIEnv *env;
jstring key_str = NULL;
@ -361,8 +361,8 @@ done:
return ret;
}
gboolean
gst_amc_format_get_string (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_jni_get_string (GstAmcFormat * format, const gchar * key,
gchar ** value, GError ** err)
{
JNIEnv *env;
@ -396,8 +396,8 @@ done:
return ret;
}
gboolean
gst_amc_format_set_string (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_jni_set_string (GstAmcFormat * format, const gchar * key,
const gchar * value, GError ** err)
{
JNIEnv *env;
@ -434,8 +434,8 @@ done:
return ret;
}
gboolean
gst_amc_format_get_buffer (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_jni_get_buffer (GstAmcFormat * format, const gchar * key,
guint8 ** data, gsize * size, GError ** err)
{
JNIEnv *env;
@ -489,8 +489,8 @@ done:
return ret;
}
gboolean
gst_amc_format_set_buffer (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_jni_set_buffer (GstAmcFormat * format, const gchar * key,
guint8 * data, gsize size, GError ** err)
{
JNIEnv *env;
@ -537,3 +537,20 @@ done:
return ret;
}
GstAmcFormatVTable gst_amc_format_jni_vtable = {
.new_audio = gst_amc_format_jni_new_audio,
.new_video = gst_amc_format_jni_new_video,
.free = gst_amc_format_jni_free,
.to_string = gst_amc_format_jni_to_string,
.get_float = gst_amc_format_jni_get_float,
.set_float = gst_amc_format_jni_set_float,
.get_int = gst_amc_format_jni_get_int,
.set_int = gst_amc_format_jni_set_int,
.get_string = gst_amc_format_jni_get_string,
.set_string = gst_amc_format_jni_set_string,
.get_buffer = gst_amc_format_jni_get_buffer,
.set_buffer = gst_amc_format_jni_set_buffer,
};

View file

@ -35,5 +35,8 @@ gst_amc_static_init (void)
if (!gst_amc_surface_texture_jni_static_init ())
return FALSE;
gst_amc_format_vtable = &gst_amc_format_jni_vtable;
gst_amc_codec_vtable = &gst_amc_codec_jni_vtable;
return TRUE;
}

View file

@ -19,6 +19,12 @@
#include <glib.h>
#include "../gstamc-format.h"
#include "../gstamc-codec.h"
extern GstAmcFormatVTable gst_amc_format_jni_vtable;
extern GstAmcCodecVTable gst_amc_codec_jni_vtable;
gboolean gst_amc_codeclist_jni_static_init (void);
gboolean gst_amc_format_jni_static_init (void);
gboolean gst_amc_codec_jni_static_init (void);

View file

@ -35,14 +35,14 @@ struct _GstAmcCodec
GstAmcSurfaceTexture *surface_texture;
};
void
gst_amc_buffer_free (GstAmcBuffer * buffer)
static void
gst_amc_buffer_ml_free (GstAmcBuffer * buffer)
{
g_free (buffer);
}
gboolean
gst_amc_buffer_set_position_and_limit (GstAmcBuffer * buffer, GError ** err,
static gboolean
gst_amc_buffer_ml_set_position_and_limit (GstAmcBuffer * buffer, GError ** err,
gint position, gint limit)
{
/* FIXME: Do we need to do something?
@ -52,8 +52,8 @@ gst_amc_buffer_set_position_and_limit (GstAmcBuffer * buffer, GError ** err,
return TRUE;
}
GstAmcCodec *
gst_amc_codec_new (const gchar * name, gboolean is_encoder, GError ** err)
static GstAmcCodec *
gst_amc_codec_ml_new (const gchar * name, gboolean is_encoder, GError ** err)
{
GstAmcCodec *codec = NULL;
MLResult result;
@ -77,8 +77,8 @@ gst_amc_codec_new (const gchar * name, gboolean is_encoder, GError ** err)
return codec;
}
void
gst_amc_codec_free (GstAmcCodec * codec)
static void
gst_amc_codec_ml_free (GstAmcCodec * codec)
{
g_return_if_fail (codec != NULL);
@ -88,8 +88,8 @@ gst_amc_codec_free (GstAmcCodec * codec)
g_slice_free (GstAmcCodec, codec);
}
gboolean
gst_amc_codec_configure (GstAmcCodec * codec, GstAmcFormat * format,
static gboolean
gst_amc_codec_ml_configure (GstAmcCodec * codec, GstAmcFormat * format,
GstAmcSurfaceTexture * surface_texture, GError ** err)
{
MLResult result;
@ -107,7 +107,7 @@ gst_amc_codec_configure (GstAmcCodec * codec, GstAmcFormat * format,
surface_texture);
result = MLMediaCodecConfigureWithSurface (codec->handle,
gst_amc_format_get_handle (format), surface_handle, 0);
gst_amc_format_ml_get_handle (format), surface_handle, 0);
if (result != MLResult_Ok) {
g_set_error (err, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
"Failed to configure codec %d", result);
@ -117,8 +117,8 @@ gst_amc_codec_configure (GstAmcCodec * codec, GstAmcFormat * format,
return TRUE;
}
GstAmcFormat *
gst_amc_codec_get_output_format (GstAmcCodec * codec, GError ** err)
static GstAmcFormat *
gst_amc_codec_ml_get_output_format (GstAmcCodec * codec, GError ** err)
{
MLHandle format_handle;
MLResult result;
@ -132,11 +132,11 @@ gst_amc_codec_get_output_format (GstAmcCodec * codec, GError ** err)
return NULL;
}
return gst_amc_format_new_handle (format_handle);
return gst_amc_format_ml_new_handle (format_handle);
}
gboolean
gst_amc_codec_start (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_ml_start (GstAmcCodec * codec, GError ** err)
{
MLResult result;
@ -152,8 +152,8 @@ gst_amc_codec_start (GstAmcCodec * codec, GError ** err)
return TRUE;
}
gboolean
gst_amc_codec_stop (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_ml_stop (GstAmcCodec * codec, GError ** err)
{
MLResult result;
@ -169,8 +169,8 @@ gst_amc_codec_stop (GstAmcCodec * codec, GError ** err)
return TRUE;
}
gboolean
gst_amc_codec_flush (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_ml_flush (GstAmcCodec * codec, GError ** err)
{
MLResult result;
@ -186,8 +186,8 @@ gst_amc_codec_flush (GstAmcCodec * codec, GError ** err)
return TRUE;
}
gboolean
gst_amc_codec_request_key_frame (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_ml_request_key_frame (GstAmcCodec * codec, GError ** err)
{
/* If MagicLeap adds an API for requesting a keyframe, call it here */
g_set_error (err, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
@ -195,8 +195,8 @@ gst_amc_codec_request_key_frame (GstAmcCodec * codec, GError ** err)
return FALSE;
}
gboolean
gst_amc_codec_set_dynamic_bitrate (GstAmcCodec * codec, GError ** err,
static gboolean
gst_amc_codec_ml_set_dynamic_bitrate (GstAmcCodec * codec, GError ** err,
gint bitrate)
{
g_set_error (err, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
@ -204,22 +204,23 @@ gst_amc_codec_set_dynamic_bitrate (GstAmcCodec * codec, GError ** err,
return FALSE;
}
gboolean
gst_amc_codec_have_dynamic_bitrate ()
static gboolean
gst_amc_codec_ml_have_dynamic_bitrate ()
{
/* If MagicLeap ever provides an API for scaling bitrate, change this to TRUE */
return FALSE;
}
gboolean
gst_amc_codec_release (GstAmcCodec * codec, GError ** err)
static gboolean
gst_amc_codec_ml_release (GstAmcCodec * codec, GError ** err)
{
g_return_val_if_fail (codec != NULL, FALSE);
return TRUE;
}
GstAmcBuffer *
gst_amc_codec_get_output_buffer (GstAmcCodec * codec, gint index, GError ** err)
static GstAmcBuffer *
gst_amc_codec_ml_get_output_buffer (GstAmcCodec * codec, gint index,
GError ** err)
{
MLResult result;
GstAmcBuffer *ret;
@ -249,8 +250,9 @@ gst_amc_codec_get_output_buffer (GstAmcCodec * codec, gint index, GError ** err)
return ret;
}
GstAmcBuffer *
gst_amc_codec_get_input_buffer (GstAmcCodec * codec, gint index, GError ** err)
static GstAmcBuffer *
gst_amc_codec_ml_get_input_buffer (GstAmcCodec * codec, gint index,
GError ** err)
{
MLResult result;
GstAmcBuffer *ret;
@ -273,8 +275,8 @@ gst_amc_codec_get_input_buffer (GstAmcCodec * codec, gint index, GError ** err)
return ret;
}
gint
gst_amc_codec_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs,
static gint
gst_amc_codec_ml_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs,
GError ** err)
{
MLResult result;
@ -295,8 +297,8 @@ gst_amc_codec_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs,
return index;
}
gint
gst_amc_codec_dequeue_output_buffer (GstAmcCodec * codec,
static gint
gst_amc_codec_ml_dequeue_output_buffer (GstAmcCodec * codec,
GstAmcBufferInfo * info, gint64 timeoutUs, GError ** err)
{
MLMediaCodecBufferInfo info_;
@ -331,8 +333,8 @@ gst_amc_codec_dequeue_output_buffer (GstAmcCodec * codec,
return index;
}
gboolean
gst_amc_codec_queue_input_buffer (GstAmcCodec * codec, gint index,
static gboolean
gst_amc_codec_ml_queue_input_buffer (GstAmcCodec * codec, gint index,
const GstAmcBufferInfo * info, GError ** err)
{
MLResult result;
@ -351,8 +353,8 @@ gst_amc_codec_queue_input_buffer (GstAmcCodec * codec, gint index,
return TRUE;
}
gboolean
gst_amc_codec_release_output_buffer (GstAmcCodec * codec, gint index,
static gboolean
gst_amc_codec_ml_release_output_buffer (GstAmcCodec * codec, gint index,
gboolean render, GError ** err)
{
MLResult result;
@ -369,8 +371,40 @@ gst_amc_codec_release_output_buffer (GstAmcCodec * codec, gint index,
return TRUE;
}
GstAmcSurfaceTexture *
gst_amc_codec_new_surface_texture (GError ** err)
static GstAmcSurfaceTexture *
gst_amc_codec_ml_new_surface_texture (GError ** err)
{
return (GstAmcSurfaceTexture *) gst_amc_surface_texture_ml_new (err);
}
GstAmcCodecVTable gst_amc_codec_ml_vtable = {
.buffer_free = gst_amc_buffer_ml_free,
.buffer_set_position_and_limit = gst_amc_buffer_ml_set_position_and_limit,
.create = gst_amc_codec_ml_new,
.free = gst_amc_codec_ml_free,
.configure = gst_amc_codec_ml_configure,
.get_output_format = gst_amc_codec_ml_get_output_format,
.start = gst_amc_codec_ml_start,
.stop = gst_amc_codec_ml_stop,
.flush = gst_amc_codec_ml_flush,
.request_key_frame = gst_amc_codec_ml_request_key_frame,
.have_dynamic_bitrate = gst_amc_codec_ml_have_dynamic_bitrate,
.set_dynamic_bitrate = gst_amc_codec_ml_set_dynamic_bitrate,
.release = gst_amc_codec_ml_release,
.get_output_buffer = gst_amc_codec_ml_get_output_buffer,
.get_input_buffer = gst_amc_codec_ml_get_input_buffer,
.dequeue_input_buffer = gst_amc_codec_ml_dequeue_input_buffer,
.dequeue_output_buffer = gst_amc_codec_ml_dequeue_output_buffer,
.queue_input_buffer = gst_amc_codec_ml_queue_input_buffer,
.release_output_buffer = gst_amc_codec_ml_release_output_buffer,
.new_surface_texture = gst_amc_codec_ml_new_surface_texture,
};

View file

@ -32,9 +32,9 @@ struct _GstAmcFormat
MLHandle handle;
};
GstAmcFormat *
gst_amc_format_new_audio (const gchar * mime, gint sample_rate, gint channels,
GError ** err)
static GstAmcFormat *
gst_amc_format_ml_new_audio (const gchar * mime, gint sample_rate,
gint channels, GError ** err)
{
GstAmcFormat *format = g_slice_new0 (GstAmcFormat);
MLResult result;
@ -51,8 +51,8 @@ gst_amc_format_new_audio (const gchar * mime, gint sample_rate, gint channels,
return format;
}
GstAmcFormat *
gst_amc_format_new_video (const gchar * mime, gint width, gint height,
static GstAmcFormat *
gst_amc_format_ml_new_video (const gchar * mime, gint width, gint height,
GError ** err)
{
GstAmcFormat *format = g_slice_new0 (GstAmcFormat);
@ -70,7 +70,7 @@ gst_amc_format_new_video (const gchar * mime, gint width, gint height,
}
GstAmcFormat *
gst_amc_format_new_handle (MLHandle handle)
gst_amc_format_ml_new_handle (MLHandle handle)
{
GstAmcFormat *format = g_slice_new0 (GstAmcFormat);
format->handle = handle;
@ -78,20 +78,20 @@ gst_amc_format_new_handle (MLHandle handle)
}
MLHandle
gst_amc_format_get_handle (GstAmcFormat * format)
gst_amc_format_ml_get_handle (GstAmcFormat * format)
{
return format->handle;
}
void
gst_amc_format_free (GstAmcFormat * format)
static void
gst_amc_format_ml_free (GstAmcFormat * format)
{
g_return_if_fail (format != NULL);
g_slice_free (GstAmcFormat, format);
}
gchar *
gst_amc_format_to_string (GstAmcFormat * format, GError ** err)
static gchar *
gst_amc_format_ml_to_string (GstAmcFormat * format, GError ** err)
{
MLResult result;
gchar *str;
@ -108,8 +108,8 @@ gst_amc_format_to_string (GstAmcFormat * format, GError ** err)
return str;
}
gboolean
gst_amc_format_get_float (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_ml_get_float (GstAmcFormat * format, const gchar * key,
gfloat * value, GError ** err)
{
MLResult result;
@ -128,8 +128,8 @@ gst_amc_format_get_float (GstAmcFormat * format, const gchar * key,
return TRUE;
}
gboolean
gst_amc_format_set_float (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_ml_set_float (GstAmcFormat * format, const gchar * key,
gfloat value, GError ** err)
{
MLResult result;
@ -147,9 +147,9 @@ gst_amc_format_set_float (GstAmcFormat * format, const gchar * key,
return TRUE;
}
gboolean
gst_amc_format_get_int (GstAmcFormat * format, const gchar * key, gint * value,
GError ** err)
static gboolean
gst_amc_format_ml_get_int (GstAmcFormat * format, const gchar * key,
gint * value, GError ** err)
{
MLResult result;
@ -167,8 +167,8 @@ gst_amc_format_get_int (GstAmcFormat * format, const gchar * key, gint * value,
return TRUE;
}
gboolean
gst_amc_format_set_int (GstAmcFormat * format, const gchar * key, gint value,
static gboolean
gst_amc_format_ml_set_int (GstAmcFormat * format, const gchar * key, gint value,
GError ** err)
{
MLResult result;
@ -185,8 +185,8 @@ gst_amc_format_set_int (GstAmcFormat * format, const gchar * key, gint value,
return TRUE;
}
gboolean
gst_amc_format_get_string (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_ml_get_string (GstAmcFormat * format, const gchar * key,
gchar ** value, GError ** err)
{
MLResult result;
@ -207,8 +207,8 @@ gst_amc_format_get_string (GstAmcFormat * format, const gchar * key,
return TRUE;
}
gboolean
gst_amc_format_set_string (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_ml_set_string (GstAmcFormat * format, const gchar * key,
const gchar * value, GError ** err)
{
MLResult result;
@ -225,8 +225,8 @@ gst_amc_format_set_string (GstAmcFormat * format, const gchar * key,
return TRUE;
}
gboolean
gst_amc_format_get_buffer (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_ml_get_buffer (GstAmcFormat * format, const gchar * key,
guint8 ** data, gsize * size, GError ** err)
{
MLResult result;
@ -251,8 +251,8 @@ gst_amc_format_get_buffer (GstAmcFormat * format, const gchar * key,
return TRUE;
}
gboolean
gst_amc_format_set_buffer (GstAmcFormat * format, const gchar * key,
static gboolean
gst_amc_format_ml_set_buffer (GstAmcFormat * format, const gchar * key,
guint8 * data, gsize size, GError ** err)
{
MLResult result;
@ -272,3 +272,20 @@ gst_amc_format_set_buffer (GstAmcFormat * format, const gchar * key,
}
return TRUE;
}
GstAmcFormatVTable gst_amc_format_ml_vtable = {
.new_audio = gst_amc_format_ml_new_audio,
.new_video = gst_amc_format_ml_new_video,
.free = gst_amc_format_ml_free,
.to_string = gst_amc_format_ml_to_string,
.get_float = gst_amc_format_ml_get_float,
.set_float = gst_amc_format_ml_set_float,
.get_int = gst_amc_format_ml_get_int,
.set_int = gst_amc_format_ml_set_int,
.get_string = gst_amc_format_ml_get_string,
.set_string = gst_amc_format_ml_set_string,
.get_buffer = gst_amc_format_ml_get_buffer,
.set_buffer = gst_amc_format_ml_set_buffer,
};

View file

@ -21,13 +21,17 @@
#ifndef __GST_AMC_INTERNAL_ML_H__
#define __GST_AMC_INTERNAL_ML_H__
#include "../gstamc-codec.h"
#include "../gstamc-format.h"
#include <ml_api.h>
G_BEGIN_DECLS
GstAmcFormat *gst_amc_format_new_handle (MLHandle handle);
MLHandle gst_amc_format_get_handle (GstAmcFormat * format);
extern GstAmcFormatVTable gst_amc_format_ml_vtable;
extern GstAmcCodecVTable gst_amc_codec_ml_vtable;
GstAmcFormat *gst_amc_format_ml_new_handle (MLHandle handle);
MLHandle gst_amc_format_ml_get_handle (GstAmcFormat * format);
G_END_DECLS

View file

@ -18,6 +18,7 @@
*/
#include "../gstamc.h"
#include "gstamc-internal-ml.h"
gboolean
gst_amc_static_init (void)
@ -26,5 +27,9 @@ gst_amc_static_init (void)
* MagicLeap doesn't require any static initialization. All required
* functions are in C and are linked into the plugin directly.
*/
gst_amc_codec_vtable = &gst_amc_codec_ml_vtable;
gst_amc_format_vtable = &gst_amc_format_ml_vtable;
return TRUE;
}

View file

@ -1,6 +1,8 @@
androidmedia_sources = [
'gstamcaudiodec.c',
'gstamc.c',
'gstamc-codec.c',
'gstamc-format.c',
'gstamcsurfacetexture.c',
'gstamcvideodec.c',
'gstamcvideoenc.c',