1 /* 2 * Copyright (C) 2014 Amlogic Corporation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef AMVDEC_AMVIDEO_HEADER_SS 18 #define AMVDEC_AMVIDEO_HEADER_SS 19 #include <stdlib.h> 20 #include <stdint.h> 21 #include <linux/videodev2.h> 22 //#include "videodev2.h" 23 #include <stdbool.h> 24 #define FLAGS_OVERLAY_MODE (1) 25 #define FLAGS_V4L_MODE (2) 26 27 28 struct amvideo_dev; 29 typedef struct vframebuf { 30 char * vbuf; 31 int fd; 32 int index; 33 int offset; 34 int length; 35 int64_t pts; 36 int duration; 37 int width; 38 int height; 39 int error_recovery; 40 int sync_frame; 41 uint32_t frame_num; 42 } vframebuf_t; 43 44 struct amvideo_dev_ops { 45 int (*setparameters)(struct amvideo_dev *dev, int cmd, void*para); 46 int (*init)(struct amvideo_dev *dev, int flags, int width, int height, int fmt, int buffernum); 47 int (*release)(struct amvideo_dev *dev); 48 int (*dequeuebuf)(struct amvideo_dev *dev, vframebuf_t*vf); 49 int (*queuebuf)(struct amvideo_dev *dev, vframebuf_t*vf); 50 int (*start)(struct amvideo_dev *dev); 51 int (*stop)(struct amvideo_dev *dev); 52 }; 53 54 #define AMVIDEO_DEV_NAME_SIZE 16 55 56 typedef struct amvideo_dev { 57 char devname[AMVIDEO_DEV_NAME_SIZE]; 58 int mode; 59 int display_mode; 60 bool use_frame_mode; 61 int video_id; 62 struct amvideo_dev_ops ops; 63 void *devpriv;//must at last of the struct 64 } amvideo_dev_t; 65 66 typedef struct amvideo { 67 amvideo_dev_t *dev; 68 } amvideo_t; 69 70 amvideo_dev_t *new_amvideo(int flags); 71 int amvideo_setparameters(amvideo_dev_t *dev, int cmd, void * parameters); 72 int amvideo_init(amvideo_dev_t *dev, int flags, int width, int height, int fmt, int buffernum); 73 int amvideo_start(amvideo_dev_t *dev); 74 int amvideo_stop(amvideo_dev_t *dev); 75 int amvideo_release(amvideo_dev_t *dev); 76 int amlv4l_dequeuebuf(amvideo_dev_t *dev, vframebuf_t*vf); 77 int amlv4l_queuebuf(amvideo_dev_t *dev, vframebuf_t*vf); 78 #endif 79