2020-02-06 02:42:56 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2020 Nicolas Dufresne <nicolas.dufresne@collabora.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_V4L2_DECODER_H__
|
|
|
|
#define __GST_V4L2_DECODER_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/video.h>
|
|
|
|
|
|
|
|
#include "gstv4l2codecdevice.h"
|
2020-02-15 03:03:17 +00:00
|
|
|
#include "linux/videodev2.h"
|
2020-02-06 02:42:56 +00:00
|
|
|
|
2023-12-10 13:22:00 +00:00
|
|
|
/**
|
|
|
|
* GST_CODEC_PICTURE_TS_NS:
|
|
|
|
* @picture: a #GstCodecPicture
|
|
|
|
*
|
|
|
|
* Returns system_frame_number field of @picture converted to nanosecond.
|
|
|
|
*
|
|
|
|
* Since: 1.24
|
|
|
|
*/
|
|
|
|
#define GST_CODEC_PICTURE_TS_NS(picture) \
|
2023-12-10 13:28:42 +00:00
|
|
|
gst_util_uint64_scale_int (GST_CODEC_PICTURE_FRAME_NUMBER(picture), 1000, 1)
|
2023-12-10 13:22:00 +00:00
|
|
|
|
2020-02-06 02:42:56 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_TYPE_V4L2_DECODER gst_v4l2_decoder_get_type ()
|
|
|
|
G_DECLARE_FINAL_TYPE (GstV4l2Decoder, gst_v4l2_decoder, GST, V4L2_DECODER, GstObject);
|
|
|
|
|
2020-02-15 03:03:17 +00:00
|
|
|
typedef struct _GstV4l2Request GstV4l2Request;
|
|
|
|
|
2020-02-06 02:42:56 +00:00
|
|
|
GstV4l2Decoder * gst_v4l2_decoder_new (GstV4l2CodecDevice * device);
|
|
|
|
|
2020-09-30 17:14:41 +00:00
|
|
|
guint gst_v4l2_decoder_get_version (GstV4l2Decoder * self);
|
|
|
|
|
2020-02-06 02:42:56 +00:00
|
|
|
gboolean gst_v4l2_decoder_open (GstV4l2Decoder * decoder);
|
|
|
|
|
2020-02-10 23:05:39 +00:00
|
|
|
gboolean gst_v4l2_decoder_close (GstV4l2Decoder * decoder);
|
|
|
|
|
2020-02-16 19:51:37 +00:00
|
|
|
gboolean gst_v4l2_decoder_streamon (GstV4l2Decoder * self,
|
|
|
|
GstPadDirection direction);
|
|
|
|
|
|
|
|
gboolean gst_v4l2_decoder_streamoff (GstV4l2Decoder * self,
|
|
|
|
GstPadDirection direction);
|
|
|
|
|
2020-03-20 18:14:46 +00:00
|
|
|
gboolean gst_v4l2_decoder_flush (GstV4l2Decoder * self);
|
|
|
|
|
2020-02-09 16:31:11 +00:00
|
|
|
gboolean gst_v4l2_decoder_enum_sink_fmt (GstV4l2Decoder * self,
|
|
|
|
gint i, guint32 * out_fmt);
|
2020-02-06 02:42:56 +00:00
|
|
|
|
2020-02-10 23:05:39 +00:00
|
|
|
gboolean gst_v4l2_decoder_set_sink_fmt (GstV4l2Decoder * self, guint32 fmt,
|
2020-05-06 16:27:56 +00:00
|
|
|
gint width, gint height,
|
|
|
|
gint pixel_bitdepth);
|
2020-02-10 23:05:39 +00:00
|
|
|
|
2024-02-16 21:48:17 +00:00
|
|
|
GstCaps * gst_v4l2_decoder_enum_src_formats (GstV4l2Decoder * self,
|
|
|
|
GstStaticCaps * static_filter);
|
2020-02-17 23:08:48 +00:00
|
|
|
|
2020-02-10 23:05:39 +00:00
|
|
|
gboolean gst_v4l2_decoder_select_src_format (GstV4l2Decoder * self,
|
2020-02-17 23:08:48 +00:00
|
|
|
GstCaps * caps,
|
2024-01-06 12:07:16 +00:00
|
|
|
GstVideoInfo * vinfo,
|
|
|
|
GstVideoInfoDmaDrm * vinfo_drm);
|
2020-02-10 23:05:39 +00:00
|
|
|
|
2024-02-17 05:01:41 +00:00
|
|
|
GstVideoCodecState * gst_v4l2_decoder_set_output_state (GstVideoDecoder * decoder,
|
|
|
|
GstVideoInfo * vinfo,
|
2024-01-06 12:07:16 +00:00
|
|
|
GstVideoInfoDmaDrm * drm_info,
|
2024-02-17 05:01:41 +00:00
|
|
|
guint width,
|
|
|
|
guint height,
|
|
|
|
GstVideoCodecState * reference);
|
|
|
|
|
2020-02-13 04:39:25 +00:00
|
|
|
gint gst_v4l2_decoder_request_buffers (GstV4l2Decoder * self,
|
|
|
|
GstPadDirection direction,
|
|
|
|
guint num_buffers);
|
|
|
|
|
|
|
|
gboolean gst_v4l2_decoder_export_buffer (GstV4l2Decoder * self,
|
|
|
|
GstPadDirection directon,
|
|
|
|
gint index,
|
|
|
|
gint * fds,
|
|
|
|
gsize * sizes,
|
|
|
|
gsize * offsets,
|
|
|
|
guint *num_fds);
|
|
|
|
|
2020-02-15 03:03:17 +00:00
|
|
|
gboolean gst_v4l2_decoder_set_controls (GstV4l2Decoder * self,
|
|
|
|
GstV4l2Request * request,
|
|
|
|
struct v4l2_ext_control *control,
|
|
|
|
guint count);
|
|
|
|
|
2020-05-05 21:55:19 +00:00
|
|
|
gboolean gst_v4l2_decoder_get_controls (GstV4l2Decoder * self,
|
|
|
|
struct v4l2_ext_control * control,
|
|
|
|
guint count);
|
|
|
|
|
2020-09-30 17:14:41 +00:00
|
|
|
gboolean gst_v4l2_decoder_query_control_size (GstV4l2Decoder * self,
|
|
|
|
unsigned int control_id,
|
|
|
|
unsigned int *control_size);
|
|
|
|
|
2020-02-06 02:42:56 +00:00
|
|
|
void gst_v4l2_decoder_install_properties (GObjectClass * gobject_class,
|
|
|
|
gint prop_offset,
|
|
|
|
GstV4l2CodecDevice * device);
|
|
|
|
|
|
|
|
void gst_v4l2_decoder_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
void gst_v4l2_decoder_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2020-04-28 00:26:54 +00:00
|
|
|
void gst_v4l2_decoder_register (GstPlugin * plugin,
|
|
|
|
GType dec_type,
|
|
|
|
GClassInitFunc class_init,
|
2021-05-22 19:29:09 +00:00
|
|
|
gconstpointer class_data,
|
2020-04-28 00:26:54 +00:00
|
|
|
GInstanceInitFunc instance_init,
|
|
|
|
const gchar *element_name_tmpl,
|
|
|
|
GstV4l2CodecDevice * device,
|
2021-05-22 19:29:09 +00:00
|
|
|
guint rank,
|
|
|
|
gchar ** element_name);
|
2020-04-28 00:26:54 +00:00
|
|
|
|
2020-12-14 22:07:01 +00:00
|
|
|
GstV4l2Request *gst_v4l2_decoder_alloc_request (GstV4l2Decoder * self,
|
|
|
|
guint32 frame_num,
|
|
|
|
GstMemory *bitstream,
|
|
|
|
GstBuffer * pic_buf);
|
|
|
|
|
|
|
|
GstV4l2Request *gst_v4l2_decoder_alloc_sub_request (GstV4l2Decoder * self,
|
|
|
|
GstV4l2Request * prev_request,
|
|
|
|
GstMemory *bitstream);
|
2020-02-15 03:03:17 +00:00
|
|
|
|
2021-01-29 14:41:22 +00:00
|
|
|
void gst_v4l2_decoder_set_render_delay (GstV4l2Decoder * self,
|
|
|
|
guint delay);
|
|
|
|
|
|
|
|
guint gst_v4l2_decoder_get_render_delay (GstV4l2Decoder * self);
|
|
|
|
|
|
|
|
|
2020-12-18 21:36:16 +00:00
|
|
|
GstV4l2Request * gst_v4l2_request_ref (GstV4l2Request * request);
|
|
|
|
|
|
|
|
void gst_v4l2_request_unref (GstV4l2Request * request);
|
2020-02-15 03:03:17 +00:00
|
|
|
|
2020-12-14 22:07:01 +00:00
|
|
|
gboolean gst_v4l2_request_queue (GstV4l2Request * request,
|
|
|
|
guint flags);
|
2020-02-15 03:03:17 +00:00
|
|
|
|
2020-12-14 22:07:01 +00:00
|
|
|
gint gst_v4l2_request_poll (GstV4l2Request * request,
|
|
|
|
GstClockTime timeout);
|
2020-02-16 19:51:37 +00:00
|
|
|
|
2021-01-27 20:53:49 +00:00
|
|
|
gint gst_v4l2_request_set_done (GstV4l2Request * request);
|
2020-02-16 19:51:37 +00:00
|
|
|
|
2020-12-14 22:07:01 +00:00
|
|
|
gboolean gst_v4l2_request_failed (GstV4l2Request * request);
|
|
|
|
|
2021-11-30 22:05:22 +00:00
|
|
|
GstBuffer * gst_v4l2_request_dup_pic_buf (GstV4l2Request * request);
|
|
|
|
|
2021-12-21 15:59:37 +00:00
|
|
|
gint gst_v4l2_request_get_fd (GstV4l2Request * request);
|
|
|
|
|
2020-02-06 02:42:56 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_V4L2_DECODER_H__ */
|