2 * Copyright (C) 2020 Nicolas Dufresne <nicolas.dufresne@collabora.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_V4L2_DECODER_H__
21 #define __GST_V4L2_DECODER_H__
24 #include <gst/video/video.h>
26 #include "gstv4l2codecdevice.h"
27 #include "linux/videodev2.h"
31 #define GST_TYPE_V4L2_DECODER gst_v4l2_decoder_get_type ()
32 G_DECLARE_FINAL_TYPE (GstV4l2Decoder, gst_v4l2_decoder, GST, V4L2_DECODER, GstObject);
34 typedef struct _GstV4l2Request GstV4l2Request;
36 GstV4l2Decoder * gst_v4l2_decoder_new (GstV4l2CodecDevice * device);
38 gboolean gst_v4l2_decoder_open (GstV4l2Decoder * decoder);
40 gboolean gst_v4l2_decoder_close (GstV4l2Decoder * decoder);
42 gboolean gst_v4l2_decoder_streamon (GstV4l2Decoder * self,
43 GstPadDirection direction);
45 gboolean gst_v4l2_decoder_streamoff (GstV4l2Decoder * self,
46 GstPadDirection direction);
48 gboolean gst_v4l2_decoder_enum_sink_fmt (GstV4l2Decoder * self,
49 gint i, guint32 * out_fmt);
51 gboolean gst_v4l2_decoder_set_sink_fmt (GstV4l2Decoder * self, guint32 fmt,
52 gint width, gint height);
54 GstCaps * gst_v4l2_decoder_enum_src_formats (GstV4l2Decoder * self);
56 gboolean gst_v4l2_decoder_select_src_format (GstV4l2Decoder * self,
60 gint gst_v4l2_decoder_request_buffers (GstV4l2Decoder * self,
61 GstPadDirection direction,
64 gboolean gst_v4l2_decoder_export_buffer (GstV4l2Decoder * self,
65 GstPadDirection directon,
72 gboolean gst_v4l2_decoder_queue_sink_mem (GstV4l2Decoder * self,
73 GstV4l2Request * request,
78 gboolean gst_v4l2_decoder_dequeue_sink (GstV4l2Decoder * self);
80 gboolean gst_v4l2_decoder_queue_src_buffer (GstV4l2Decoder * self,
84 gboolean gst_v4l2_decoder_dequeue_src (GstV4l2Decoder * self,
85 guint32 *out_frame_num);
87 gboolean gst_v4l2_decoder_set_controls (GstV4l2Decoder * self,
88 GstV4l2Request * request,
89 struct v4l2_ext_control *control,
92 void gst_v4l2_decoder_install_properties (GObjectClass * gobject_class,
94 GstV4l2CodecDevice * device);
96 void gst_v4l2_decoder_set_property (GObject * object, guint prop_id,
97 const GValue * value, GParamSpec * pspec);
99 void gst_v4l2_decoder_get_property (GObject * object, guint prop_id,
100 GValue * value, GParamSpec * pspec);
102 GstV4l2Request *gst_v4l2_decoder_alloc_request (GstV4l2Decoder * self);
104 void gst_v4l2_request_free (GstV4l2Request * request);
106 gboolean gst_v4l2_request_queue (GstV4l2Request * request);
108 gint gst_v4l2_request_poll (GstV4l2Request * request, GstClockTime timeout);
110 void gst_v4l2_request_set_done (GstV4l2Request * request);
112 gboolean gst_v4l2_request_is_done (GstV4l2Request * request);
116 #endif /* __GST_V4L2_DECODER_H__ */