1 /* 2 * 3 * Copyright 2015 Rockchip Electronics Co., LTD. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef __MPP_FRAME_IMPL_H__ 19 #define __MPP_FRAME_IMPL_H__ 20 21 #include "mpp_time.h" 22 #include "mpp_frame.h" 23 24 typedef struct MppFrameImpl_t MppFrameImpl; 25 26 struct MppFrameImpl_t { 27 const char *name; 28 29 /* 30 * dimension parameter for display 31 */ 32 RK_U32 width; 33 RK_U32 height; 34 RK_U32 hor_stride; 35 RK_U32 ver_stride; 36 RK_U32 hor_stride_pixel; 37 RK_U32 offset_x; 38 RK_U32 offset_y; 39 40 /* 41 * interlaced related mode status 42 * 43 * 0 - frame 44 * 1 - top field 45 * 2 - bottom field 46 * 3 - paired top and bottom field 47 * 4 - deinterlaced flag 48 * 7 - deinterlaced paired field 49 */ 50 RK_U32 mode; 51 /* 52 * current decoded frame whether to display 53 * 54 * 0 - reserve 55 * 1 - discard 56 */ 57 RK_U32 discard; 58 /* 59 * send decoded frame belong which view 60 */ 61 RK_U32 viewid; 62 /* 63 * poc - picture order count 64 */ 65 RK_U32 poc; 66 /* 67 * pts - display time stamp 68 * dts - decode time stamp 69 */ 70 RK_S64 pts; 71 RK_S64 dts; 72 73 /* 74 * eos - end of stream 75 * info_change - set when buffer resized or frame infomation changed 76 */ 77 RK_U32 eos; 78 RK_U32 info_change; 79 RK_U32 errinfo; 80 MppFrameColorRange color_range; 81 MppFrameColorPrimaries color_primaries; 82 MppFrameColorTransferCharacteristic color_trc; 83 84 /** 85 * YUV colorspace type. 86 * It must be accessed using av_frame_get_colorspace() and 87 * av_frame_set_colorspace(). 88 * - encoding: Set by user 89 * - decoding: Set by libavcodec 90 */ 91 MppFrameColorSpace colorspace; 92 MppFrameChromaLocation chroma_location; 93 94 MppFrameFormat fmt; 95 96 MppFrameRational sar; 97 MppFrameMasteringDisplayMetadata mastering_display; 98 MppFrameContentLightMetadata content_light; 99 100 /* 101 * buffer information 102 * NOTE: buf_size only access internally 103 */ 104 MppBuffer buffer; 105 size_t buf_size; 106 107 /* 108 * meta data information 109 */ 110 MppMeta meta; 111 MppStopwatch stopwatch; 112 113 /* 114 * frame buffer compression (FBC) information 115 * 116 * NOTE: some constraint on fbc data 117 * 1. FBC config need two addresses but only one buffer. 118 * The second address should be represented by base + offset form. 119 * 2. FBC has header address and payload address 120 * Both addresses should be 4K aligned. 121 * 3. The header section size is default defined by: 122 * header size = aligned(aligned(width, 16) * aligned(height, 16) / 16, 4096) 123 * 4. The stride in header section is defined by: 124 * stride = aligned(width, 16) 125 */ 126 RK_U32 fbc_offset; 127 128 /* 129 * pointer for multiple frame output at one time 130 */ 131 MppFrameImpl *next; 132 }; 133 134 #ifdef __cplusplus 135 extern "C" { 136 #endif 137 138 MPP_RET mpp_frame_set_next(MppFrame frame, MppFrame next); 139 MPP_RET mpp_frame_copy(MppFrame frame, MppFrame next); 140 MPP_RET mpp_frame_info_cmp(MppFrame frame0, MppFrame frame1); 141 RK_U32 mpp_frame_get_fbc_offset(MppFrame frame); 142 RK_U32 mpp_frame_get_fbc_stride(MppFrame frame); 143 144 /* 145 * Debug for frame process timing 146 */ 147 void mpp_frame_set_stopwatch_enable(MppFrame frame, RK_S32 enable); 148 MppStopwatch mpp_frame_get_stopwatch(const MppFrame frame); 149 150 MPP_RET check_is_mpp_frame(void *pointer); 151 152 #ifdef __cplusplus 153 } 154 #endif 155 156 #endif /* __MPP_FRAME_IMPL_H__ */ 157