1 /* 2 * Copyright 2021 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 17 #ifndef SRC_RT_MEDIA_INCLUDE_RTAUDIOFRAME_H_ 18 #define SRC_RT_MEDIA_INCLUDE_RTAUDIOFRAME_H_ 19 20 #include "RTAVShellBuffer.h" 21 22 class RTAudioFrame : public RTAVShellBuffer { 23 public: 24 RTAudioFrame(); 25 RTAudioFrame(const RTAudioFrame& in); 26 RTAudioFrame& operator=(const RTAudioFrame& in); 27 28 virtual ~RTAudioFrame() = default; 29 30 virtual RTMediaBufferType getType(); 31 virtual void reset(); 32 33 RTAudioFormat getAudioFormat() const; 34 INT32 getSoundMode() const; 35 INT32 getChannels() const; 36 INT32 getSampleRate() const; 37 INT64 getChannelLayout() const; 38 INT32 getFrameNum() const; 39 INT32 getDuration() const; 40 UINT64 getPts() const; 41 UINT64 getDts() const; 42 UINT32 getSeq() const; 43 UINT32 getReadSize() const; 44 45 void setAudioFormat(const RTAudioFormat audioFormat); 46 void setSoundMode(const INT32 soundMode); 47 void setChannels(INT32 channels); 48 void setSampleRate(INT32 sampleRate); 49 void setChannelLayout(INT64 channelLayout); 50 void setFrameNum(INT32 frames); 51 void setDuration(INT32 duration); 52 void setPts(const UINT64 pts); 53 void setDts(const UINT64 dts); 54 void setSeq(const UINT32 seq); 55 void setReadSize(const UINT32 size); 56 void clone(const RTAudioFrame& in); 57 58 private: 59 void baseInit(); 60 61 private: 62 RTAudioFormat mAudioFormat; 63 INT32 mSoundMode; 64 UINT64 mPts; 65 UINT64 mDts; 66 INT32 mChannels; 67 INT32 mSampleRate; 68 INT64 mChannelLayout; 69 INT32 mDuration; 70 UINT32 mSeq; 71 UINT32 mFrameNum; 72 UINT32 mReadSize; 73 }; 74 75 RTAudioFrame* reinterpret_aframe(RTMediaBuffer *buffer); 76 RTAudioFrame* construct_aframe(RTMediaBuffer *buffer); 77 78 #endif // SRC_RT_MEDIA_INCLUDE_RTAUDIOFRAME_H_ 79 80