1 /* 2 * Copyright (C) 2017 Amlogic, Inc. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * Description: 19 */ 20 #ifndef VDEC_ADAPT_H 21 #define VDEC_ADAPT_H 22 23 #include <linux/amlogic/media/utils/vformat.h> 24 #include <linux/amlogic/media/utils/amstream.h> 25 #include "../stream_input/amports/streambuf.h" 26 #include "aml_vcodec_drv.h" 27 28 struct aml_vdec_adapt { 29 enum vformat_e format; 30 void *vsi; 31 int32_t failure; 32 uint32_t inst_addr; 33 unsigned int signaled; 34 struct aml_vcodec_ctx *ctx; 35 struct platform_device *dev; 36 wait_queue_head_t wq; 37 struct file *filp; 38 struct vdec_s *vdec; 39 struct stream_port_s port; 40 struct dec_sysinfo dec_prop; 41 struct v4l2_config_parm config; 42 int video_type; 43 char *recv_name; 44 int vfm_path; 45 }; 46 47 int video_decoder_init(struct aml_vdec_adapt *ada_ctx); 48 49 int video_decoder_release(struct aml_vdec_adapt *ada_ctx); 50 51 int vdec_vbuf_write(struct aml_vdec_adapt *ada_ctx, 52 const char *buf, unsigned int count); 53 54 int vdec_vframe_write(struct aml_vdec_adapt *ada_ctx, 55 const char *buf, unsigned int count, u64 timestamp); 56 57 int vdec_vframe_write_with_dma(struct aml_vdec_adapt *ada_ctx, 58 ulong addr, u32 count, u64 timestamp, u32 handle); 59 60 bool vdec_input_full(struct aml_vdec_adapt *ada_ctx); 61 62 void aml_decoder_flush(struct aml_vdec_adapt *ada_ctx); 63 64 int aml_codec_reset(struct aml_vdec_adapt *ada_ctx, int *flag); 65 66 extern void dump_write(const char __user *buf, size_t count); 67 68 bool is_input_ready(struct aml_vdec_adapt *ada_ctx); 69 70 int vdec_frame_number(struct aml_vdec_adapt *ada_ctx); 71 72 u32 aml_recycle_buffer(struct aml_vdec_adapt *adaptor); 73 74 #endif /* VDEC_ADAPT_H */ 75 76