xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 1 | /* 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.han | 02c38f0 | 2024-08-16 02:35:36 +0000 | [diff] [blame] | 25 | #include "gstamlvideodecoder.h" |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 26 | #include <gst/video/gstvideometa.h> |
| 27 | |
| 28 | #include <gstamlv4l2object.h> |
| 29 | #include <gstamlv4l2bufferpool.h> |
| 30 | |
xuesong.jiang | a6df641 | 2022-05-12 20:37:59 +0800 | [diff] [blame] | 31 | #define GST_IMPORT_LGE_PROP 0 |
xuesong.jiang | 61ea801 | 2022-05-12 15:38:17 +0800 | [diff] [blame] | 32 | |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 33 | G_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 | |
| 46 | typedef struct _GstAmlV4l2VideoDec GstAmlV4l2VideoDec; |
xuesong.jiang | 61ea801 | 2022-05-12 15:38:17 +0800 | [diff] [blame] | 47 | #if GST_IMPORT_LGE_PROP |
| 48 | typedef struct _GstAmlV4l2VideoDecLgeCtxt GstAmlV4l2VideoDecLgeCtxt; |
| 49 | #endif |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 50 | typedef struct _GstAmlV4l2VideoDecClass GstAmlV4l2VideoDecClass; |
| 51 | |
| 52 | struct _GstAmlV4l2VideoDec |
| 53 | { |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 54 | GstAmlVideoDecoder parent; |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 55 | |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 56 | /* < private > */ |
| 57 | GstAmlV4l2Object *v4l2output; |
| 58 | GstAmlV4l2Object *v4l2capture; |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 59 | |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 60 | /* pads */ |
| 61 | GstCaps *probed_srccaps; |
| 62 | GstCaps *probed_sinkcaps; |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 63 | |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 64 | /* State */ |
| 65 | GstAmlVideoCodecState *input_state; |
| 66 | gboolean active; |
| 67 | GstFlowReturn output_flow; |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 68 | |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 69 | /* flags */ |
| 70 | gboolean is_secure_path; |
| 71 | gboolean is_res_chg; |
xuesong.jiang | c5dac0f | 2023-02-01 14:42:24 +0800 | [diff] [blame] | 72 | |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 73 | /* resolution change lock */ |
| 74 | GMutex res_chg_lock; |
| 75 | GCond res_chg_cond; |
xuesong.jiang | 61ea801 | 2022-05-12 15:38:17 +0800 | [diff] [blame] | 76 | |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 77 | GstClockTime last_out_pts; |
| 78 | GstClockTime frame_duration; |
| 79 | gboolean codec_data_inject; |
fei.deng | ccc8963 | 2022-07-15 19:10:17 +0800 | [diff] [blame] | 80 | |
xuesong.jiang | 61ea801 | 2022-05-12 15:38:17 +0800 | [diff] [blame] | 81 | #if GST_IMPORT_LGE_PROP |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 82 | /* LGE context */ |
| 83 | GstAmlV4l2VideoDecLgeCtxt *lge_ctxt; |
xuesong.jiang | 61ea801 | 2022-05-12 15:38:17 +0800 | [diff] [blame] | 84 | #endif |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | struct _GstAmlV4l2VideoDecClass |
| 88 | { |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 89 | GstAmlVideoDecoderClass parent_class; |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 90 | |
bo.xiao | 857b868 | 2024-09-12 16:40:32 +0800 | [diff] [blame] | 91 | gchar *default_device; |
xuesong.jiang | ae1548e | 2022-05-06 16:38:46 +0800 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | GType gst_aml_v4l2_video_dec_get_type(void); |
| 95 | |
| 96 | gboolean gst_aml_v4l2_is_video_dec(GstCaps *sink_caps, GstCaps *src_caps); |
| 97 | void 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 | |
| 102 | G_END_DECLS |
| 103 | |
| 104 | #endif /* __GST_AML_V4L2_VIDEO_DEC_H__ */ |