• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 __AML_VCODEC_VFM_H_
21 #define __AML_VCODEC_VFM_H_
22 
23 #include "aml_vcodec_vfq.h"
24 #include "aml_vcodec_drv.h"
25 #include "aml_vcodec_dec.h"
26 #include <linux/amlogic/media/vfm/vframe_provider.h>
27 #include <linux/amlogic/media/vfm/vframe_receiver.h>
28 
29 #define VF_NAME_SIZE	(32)
30 #define POOL_SIZE	(32)
31 
32 struct vcodec_vfm_s {
33 	struct aml_vcodec_ctx *ctx;
34 	struct aml_vdec_adapt *ada_ctx;
35 	struct vfq_s vf_que;
36 	struct vfq_s vf_que_recycle;
37 	struct vframe_s *vf;
38 	struct vframe_s *pool[POOL_SIZE + 1];
39 	struct vframe_s *pool_recycle[POOL_SIZE + 1];
40 	char recv_name[VF_NAME_SIZE];
41 	char prov_name[VF_NAME_SIZE];
42 	struct vframe_provider_s vf_prov;
43 	struct vframe_receiver_s vf_recv;
44 	bool vfm_initialized;
45 };
46 
47 int vcodec_vfm_init(struct vcodec_vfm_s *vfm);
48 
49 void vcodec_vfm_release(struct vcodec_vfm_s *vfm);
50 
51 struct vframe_s *peek_video_frame(struct vcodec_vfm_s *vfm);
52 
53 struct vframe_s *get_video_frame(struct vcodec_vfm_s *vfm);
54 
55 int get_fb_from_queue(struct aml_vcodec_ctx *ctx, struct vdec_v4l2_buffer **out_fb);
56 int put_fb_to_queue(struct aml_vcodec_ctx *ctx, struct vdec_v4l2_buffer *in_fb);
57 
58 void video_vf_put(char *receiver, struct vdec_v4l2_buffer *fb, int id);
59 
60 #endif /* __AML_VCODEC_VFM_H_ */
61