1 /* 2 * Copyright 2019 Rockchip Electronics Co. LTD 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 * Author: martin.cheng@rock-chips.com 17 * Date: 2019/01/22 18 */ 19 20 #ifndef SRC_RT_MEDIA_INCLUDE_RTMEDIADATA_H_ 21 #define SRC_RT_MEDIA_INCLUDE_RTMEDIADATA_H_ 22 23 #include "RTMediaDef.h" 24 #include "RTMediaMetaKeys.h" 25 #include "RTMediaPixel.h" 26 27 typedef RT_RET (*RT_RAW_FREE)(void*); 28 29 typedef struct _RTPacket { 30 INT64 mPts; 31 INT64 mDts; 32 INT64 mPos; 33 INT32 mTrackIndex; 34 INT32 mFlags; 35 INT64 mDuration; 36 uint8_t *mData; 37 INT32 mSize; 38 INT32 mSerial; 39 RT_BOOL mKey; 40 void* mRawPtr; 41 RTTrackType mType; 42 RT_RAW_FREE mFuncFree; 43 } RTPacket; 44 45 typedef struct _RTFrame { 46 INT64 mPts; /* with unit of us*/ 47 INT64 mDts; /* with unit of us*/ 48 INT32 mFrameW; 49 INT32 mFrameH; 50 INT32 mDisplayW; 51 INT32 mDisplayH; 52 INT32 mFormat; 53 INT32 mDuration; 54 INT32 mFrameEos; 55 INT32 mFrameErr; 56 57 /** 58 * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) 59 */ 60 INT32 mQuality; 61 INT32 mFrameType; 62 INT32 mFieldOrder; 63 64 void* mData; 65 INT32 mSize; 66 INT32 mSerial; 67 void* mRawPtr; 68 RT_RAW_FREE mFuncFree; 69 } RTFrame; 70 71 class RTMediaBuffer; 72 73 /* utils for rt_packet */ 74 RT_RET rt_utils_packet_free(RTPacket* rt_pkt); 75 RT_RET rt_mediabuf_from_packet(RTMediaBuffer* media_buf, RTPacket* rt_pkt); 76 RT_RET rt_mediabuf_goto_packet(RTMediaBuffer* media_buf, RTPacket* rt_pkt); 77 78 /* utils for rt_frame */ 79 RT_RET rt_utils_frame_free(RTFrame* rt_frame); 80 RT_RET rt_mediabuf_from_frame(RTMediaBuffer* media_buf, RTFrame* rt_frame); 81 RT_RET rt_mediabuf_goto_frame(RTMediaBuffer* media_buf, RTFrame* rt_frame); 82 83 /* utils for track parameters */ 84 RT_RET rt_medatdata_from_trackpar(RtMetaData* meta, RTTrackParam* tpar); 85 RT_RET rt_medatdata_goto_trackpar(RtMetaData* meta, RTTrackParam* tpar); 86 RT_RET rt_utils_dump_track(RtMetaData* meta, RT_BOOL full = false); 87 88 #endif // SRC_RT_MEDIA_INCLUDE_RTMEDIADATA_H_ 89