kaiqiang.xiang | d8184ff | 2024-10-09 14:35:02 +0800 | [diff] [blame] | 1 | /* GStreamer |
| 2 | * Copyright (C) 2022 amlogic |
| 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 | #include <gst/gst.h> |
| 21 | #include <aml_ge2d.h> |
| 22 | #include <gst/video/video.h> |
| 23 | |
| 24 | #define MAX_PLANES (3) |
| 25 | typedef struct _GemBuffer |
| 26 | { |
| 27 | gint width; |
| 28 | gint height; |
| 29 | gint planeCount; |
| 30 | guint handle[MAX_PLANES]; |
| 31 | guint stride[MAX_PLANES]; |
| 32 | guint offset[MAX_PLANES]; |
| 33 | guint size[MAX_PLANES]; |
| 34 | gint fd[MAX_PLANES]; |
| 35 | } GemBuffer; |
| 36 | |
| 37 | typedef struct _ROTBuffer{ |
| 38 | gint index; |
| 39 | gboolean used; |
| 40 | GemBuffer gemBuf; |
| 41 | }ROTBuffer; |
| 42 | |
| 43 | typedef enum |
| 44 | { |
| 45 | WST_ROTATION_0 = 0, |
| 46 | WST_ROTATION_90 = 1, |
| 47 | WST_ROTATION_180 = 2, |
| 48 | WST_ROTATION_270 = 3, |
| 49 | }ROTATION_DEGREE; |
| 50 | |
| 51 | |
| 52 | ROTBuffer* rotation_buffer_setup(int numPlanes, int width, int height, int numBuffer); |
| 53 | void rotation_buffer_teardown(ROTBuffer *pROTbuf, int numBuffer); |
| 54 | GstFlowReturn rotation_transform(aml_ge2d_info_t *pge2dinfo, GstBuffer *inbuf, ROTBuffer *pROTbuf, ROTATION_DEGREE ROTDegree); |
| 55 | gboolean rotation_init(aml_ge2d_t* pAmlge2d, aml_ge2d_info_t **pge2dinfo); |
| 56 | gboolean rotation_exit(aml_ge2d_t* pAmlge2d); |
| 57 | gboolean get_rotation_size(int src_w, int src_h, int* dst_w, int* dst_h); |