xref: /OK3568_Linux_fs/external/rockit/tgi/sdk/include/RTAudioPacket.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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_RTAUDIOPACKET_H_
18 #define SRC_RT_MEDIA_INCLUDE_RTAUDIOPACKET_H_
19 
20 #include "RTAVShellBuffer.h"
21 
22 class RTAudioPacket : public RTAVShellBuffer {
23  public:
24     RTAudioPacket();
25 
26     virtual ~RTAudioPacket() = default;
27 
28     virtual RTMediaBufferType getType();
29     virtual void reset();
30 
31     RTAudioFormat getAudioFormat() const;
32     INT32  getSoundMode() const;
33     INT32  getChannels() const;
34     INT32  getSampleRate() const;
35     INT64  getChannelLayout() const;
36     UINT64 getPts() const;
37     UINT64 getDts() const;
38     INT32  getDuration() const;
39     UINT32 getSeq() const;
40 
41     void  setAudioFormat(const RTAudioFormat audioFormat);
42     void  setSoundMode(const INT32 soundMode);
43     void  setChannels(INT32 channels);
44     void  setSampleRate(INT32 sampleRate);
45     void  setChannelLayout(INT64 channelLayout);
46     void  setPts(const UINT64 pts);
47     void  setDts(const UINT64 dts);
48     void  setDuration(const INT32 duration);
49     void  setSeq(const UINT32 seq);
50 
51  private:
52     void baseInit();
53 
54  private:
55      RTAudioFormat mAudioFormat;
56      INT32   mSoundMode;
57      INT32   mChannels;
58      INT32   mSampleRate;
59      INT64   mChannelLayout;
60      UINT64  mPts;
61      UINT64  mDts;
62      UINT32  mSeq;
63      INT32   mDuration;
64 };
65 
66 RTAudioPacket* reinterpret_apacket(RTMediaBuffer *buffer);
67 RTAudioPacket* construct_apacket(RTMediaBuffer *buffer);
68 
69 #endif  // SRC_RT_MEDIA_INCLUDE_RTAUDIOPACKET_H_
70 
71