blob: 854b070cbf23eda5d491eb3bb0b4bdd23a63a2fe [file] [log] [blame]
xuesong.jiangae1548e2022-05-06 16:38:46 +08001/* GStreamer
2 * Copyright (C) 2022 <xuesong.jiang@amlogic.com>
3 *
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.
8 *
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.
13 *
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 Street, Suite 500,
17 * Boston, MA 02110-1335, USA.
18 */
19
20#ifndef __GST_AML_V4L2_VIDEO_DEC_H__
21#define __GST_AML_V4L2_VIDEO_DEC_H__
22
23#include <gst/gst.h>
24#include <gst/video/video.h>
le.han02c38f02024-08-16 02:35:36 +000025#include "gstamlvideodecoder.h"
xuesong.jiangae1548e2022-05-06 16:38:46 +080026#include <gst/video/gstvideometa.h>
27
28#include <gstamlv4l2object.h>
29#include <gstamlv4l2bufferpool.h>
30
xuesong.jianga6df6412022-05-12 20:37:59 +080031#define GST_IMPORT_LGE_PROP 0
xuesong.jiang61ea8012022-05-12 15:38:17 +080032
xuesong.jiangae1548e2022-05-06 16:38:46 +080033G_BEGIN_DECLS
34
35#define GST_TYPE_AML_V4L2_VIDEO_DEC \
36 (gst_aml_v4l2_video_dec_get_type())
37#define GST_AML_V4L2_VIDEO_DEC(obj) \
38 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AML_V4L2_VIDEO_DEC, GstAmlV4l2VideoDec))
39#define GST_AML_V4L2_VIDEO_DEC_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AML_V4L2_VIDEO_DEC, GstAmlV4l2VideoDecClass))
41#define GST_IS_AML_V4L2_VIDEO_DEC(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AML_V4L2_VIDEO_DEC))
43#define GST_IS_AML_V4L2_VIDEO_DEC_CLASS(obj) \
44 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AML_V4L2_VIDEO_DEC))
45
46typedef struct _GstAmlV4l2VideoDec GstAmlV4l2VideoDec;
xuesong.jiang61ea8012022-05-12 15:38:17 +080047#if GST_IMPORT_LGE_PROP
48typedef struct _GstAmlV4l2VideoDecLgeCtxt GstAmlV4l2VideoDecLgeCtxt;
49#endif
xuesong.jiangae1548e2022-05-06 16:38:46 +080050typedef struct _GstAmlV4l2VideoDecClass GstAmlV4l2VideoDecClass;
51
52struct _GstAmlV4l2VideoDec
53{
bo.xiao857b8682024-09-12 16:40:32 +080054 GstAmlVideoDecoder parent;
xuesong.jiangae1548e2022-05-06 16:38:46 +080055
bo.xiao857b8682024-09-12 16:40:32 +080056 /* < private > */
57 GstAmlV4l2Object *v4l2output;
58 GstAmlV4l2Object *v4l2capture;
xuesong.jiangae1548e2022-05-06 16:38:46 +080059
bo.xiao857b8682024-09-12 16:40:32 +080060 /* pads */
61 GstCaps *probed_srccaps;
62 GstCaps *probed_sinkcaps;
xuesong.jiangae1548e2022-05-06 16:38:46 +080063
bo.xiao857b8682024-09-12 16:40:32 +080064 /* State */
65 GstAmlVideoCodecState *input_state;
66 gboolean active;
67 GstFlowReturn output_flow;
xuesong.jiangae1548e2022-05-06 16:38:46 +080068
bo.xiao857b8682024-09-12 16:40:32 +080069 /* flags */
70 gboolean is_secure_path;
71 gboolean is_res_chg;
xuesong.jiangc5dac0f2023-02-01 14:42:24 +080072
bo.xiao857b8682024-09-12 16:40:32 +080073 /* resolution change lock */
74 GMutex res_chg_lock;
75 GCond res_chg_cond;
xuesong.jiang61ea8012022-05-12 15:38:17 +080076
bo.xiao857b8682024-09-12 16:40:32 +080077 GstClockTime last_out_pts;
78 GstClockTime frame_duration;
79 gboolean codec_data_inject;
fei.dengccc89632022-07-15 19:10:17 +080080
xuesong.jiang61ea8012022-05-12 15:38:17 +080081#if GST_IMPORT_LGE_PROP
bo.xiao857b8682024-09-12 16:40:32 +080082 /* LGE context */
83 GstAmlV4l2VideoDecLgeCtxt *lge_ctxt;
xuesong.jiang61ea8012022-05-12 15:38:17 +080084#endif
xuesong.jiangae1548e2022-05-06 16:38:46 +080085};
86
87struct _GstAmlV4l2VideoDecClass
88{
bo.xiao857b8682024-09-12 16:40:32 +080089 GstAmlVideoDecoderClass parent_class;
xuesong.jiangae1548e2022-05-06 16:38:46 +080090
bo.xiao857b8682024-09-12 16:40:32 +080091 gchar *default_device;
xuesong.jiangae1548e2022-05-06 16:38:46 +080092};
93
94GType gst_aml_v4l2_video_dec_get_type(void);
95
96gboolean gst_aml_v4l2_is_video_dec(GstCaps *sink_caps, GstCaps *src_caps);
97void gst_aml_v4l2_video_dec_register(GstPlugin *plugin,
98 const gchar *basename,
99 const gchar *device_path,
100 GstCaps *sink_caps, GstCaps *src_caps);
101
102G_END_DECLS
103
104#endif /* __GST_AML_V4L2_VIDEO_DEC_H__ */