1 /* 2 * Copyright (C) 2012,2018 Collabora Ltd. 3 * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation 8 * version 2.1 of the License. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 * 19 */ 20 21 #ifndef __GST_AMC_CODEC_H__ 22 #define __GST_AMC_CODEC_H__ 23 24 #include <gst/gst.h> 25 26 #include "gstamc-format.h" 27 #include "gstamcsurfacetexture.h" 28 29 G_BEGIN_DECLS 30 31 typedef struct _GstAmcBuffer GstAmcBuffer; 32 typedef struct _GstAmcBufferInfo GstAmcBufferInfo; 33 typedef struct _GstAmcCodec GstAmcCodec; 34 35 struct _GstAmcBuffer { 36 guint8 *data; 37 gsize size; 38 }; 39 40 struct _GstAmcBufferInfo { 41 gint flags; 42 gint offset; 43 gint64 presentation_time_us; 44 gint size; 45 }; 46 47 gboolean gst_amc_codec_static_init (void); 48 49 void gst_amc_buffer_free (GstAmcBuffer * buffer); 50 gboolean gst_amc_buffer_set_position_and_limit (GstAmcBuffer * buffer, GError ** err, 51 gint position, gint limit); 52 53 GstAmcCodec * gst_amc_codec_new (const gchar *name, gboolean is_encoder, GError **err); 54 void gst_amc_codec_free (GstAmcCodec * codec); 55 56 gboolean gst_amc_codec_configure (GstAmcCodec * codec, GstAmcFormat * format, GstAmcSurfaceTexture * surface_texture, GError **err); 57 GstAmcFormat * gst_amc_codec_get_output_format (GstAmcCodec * codec, GError **err); 58 59 gboolean gst_amc_codec_start (GstAmcCodec * codec, GError **err); 60 gboolean gst_amc_codec_stop (GstAmcCodec * codec, GError **err); 61 gboolean gst_amc_codec_flush (GstAmcCodec * codec, GError **err); 62 gboolean gst_amc_codec_release (GstAmcCodec * codec, GError **err); 63 gboolean gst_amc_codec_request_key_frame (GstAmcCodec * codec, GError **err); 64 gboolean gst_amc_codec_have_dynamic_bitrate (void); 65 gboolean gst_amc_codec_set_dynamic_bitrate (GstAmcCodec * codec, GError **err, gint bitrate); 66 67 GstAmcBuffer * gst_amc_codec_get_output_buffer (GstAmcCodec * codec, gint index, GError **err); 68 GstAmcBuffer * gst_amc_codec_get_input_buffer (GstAmcCodec * codec, gint index, GError **err); 69 70 gint gst_amc_codec_dequeue_input_buffer (GstAmcCodec * codec, gint64 timeoutUs, GError **err); 71 gint gst_amc_codec_dequeue_output_buffer (GstAmcCodec * codec, GstAmcBufferInfo *info, gint64 timeoutUs, GError **err); 72 73 gboolean gst_amc_codec_queue_input_buffer (GstAmcCodec * codec, gint index, const GstAmcBufferInfo *info, GError **err); 74 gboolean gst_amc_codec_release_output_buffer (GstAmcCodec * codec, gint index, gboolean render, GError **err); 75 76 GstAmcSurfaceTexture * gst_amc_codec_new_surface_texture (GError ** err); 77 78 G_END_DECLS 79 80 #endif /* __GST_AMC_CODEC_H__ */ 81