Parcourir la source

frame类型成员函数名修改

huihui il y a 3 mois
Parent
commit
23f47f0871

+ 2 - 2
module/VideoPlayer/src/PcmPlayer/PcmPlayer.cpp

@@ -142,8 +142,8 @@ void PcmPlayer::playAudioBuffer(void *stream, int len)
         PCMFramePtr pcm_frame = m_pcm_frame_list.front();
         m_pcm_frame_list.pop_front();
 
-        memcpy(m_last_frame_buffer + m_last_frame_buffer_size, pcm_frame->getBuffer(), pcm_frame->getSize());
-        m_last_frame_buffer_size += pcm_frame->getSize();
+        memcpy(m_last_frame_buffer + m_last_frame_buffer_size, pcm_frame->buffer(), pcm_frame->size());
+        m_last_frame_buffer_size += pcm_frame->size();
 
         m_current_pts = pcm_frame->pts();
     }

+ 7 - 3
module/VideoPlayer/src/frame/AudioFrame/AACFrame.h

@@ -66,11 +66,14 @@ public:
     void setFrameBuffer(const uint8_t * const buffer, const unsigned int &size);
     void setFrameBuffer(const uint8_t * const adtsBuffer, const unsigned int &adtsSize, const uint8_t * const buffer, const unsigned int &size);
 
-    uint8_t *getBuffer(){return mFrameBuffer;}
-    unsigned int getSize(){return  mFrameBufferSize;}
+    uint8_t *buffer(){return mFrameBuffer;}
+    unsigned int size(){return  mFrameBufferSize;}
+
+    void setPts(uint32_t pts){m_pts = pts;}
+    uint32_t pts(){return m_pts;}
 
     void setTimeStamp(uint64_t t){m_timestamp_ms = t;}
-    uint64_t getTimeStamp(){return m_timestamp_ms;}
+    uint64_t timeStamp(){return m_timestamp_ms;}
 
 private:
     ADTS_HEADER mAdtsHeader;
@@ -78,6 +81,7 @@ private:
     uint8_t *mFrameBuffer; //aac数据(包括adts头)
     unsigned int mFrameBufferSize; //aac数据长度(包括adts头的大小)
 
+    uint32_t m_pts = 0; //时间戳
     uint64_t m_timestamp_ms = 0; //本地绝对时间(UTC时间戳-毫秒)
 
 };

+ 3 - 3
module/VideoPlayer/src/frame/AudioFrame/PCMFrame.h

@@ -32,8 +32,8 @@ public:
     ~PCMFrame();
 
     void setFrameBuffer(const uint8_t * const buffer, const unsigned int &size);
-    uint8_t *getBuffer(){return mFrameBuffer;}
-    unsigned int getSize(){return  mFrameBufferSize;}
+    uint8_t *buffer(){return mFrameBuffer;}
+    unsigned int size(){return  mFrameBufferSize;}
 
     void setFrameInfo(int sample_rate, int channels, uint32_t pts, FrameType type = PCMFRAME_TYPE_PCM);
     uint32_t pts(){return m_pts;}
@@ -42,7 +42,7 @@ public:
     FrameType type(){return m_type;}
 
     void setTimeStamp(uint64_t t){m_timestamp_ms = t;}
-    uint64_t getTimeStamp(){return m_timestamp_ms;}
+    uint64_t timeStamp(){return m_timestamp_ms;}
 
 private:
     uint8_t *mFrameBuffer = nullptr; //pcm数据

+ 20 - 23
module/VideoPlayer/src/frame/VideoFrame/VideoEncodedFrame.cpp

@@ -4,22 +4,19 @@
 
 VideoEncodedFrame::VideoEncodedFrame()
 {
-    mNalu = nullptr;
-    mPts = 0;
-    mIsKeyFrame = false;
     m_timestamp_ms = Util::GetUtcTime();
 }
 
 VideoEncodedFrame::~VideoEncodedFrame()
 {
-    NALUParsing::FreeNALU(mNalu); //释放NALU内存
-    mNalu = nullptr;
+    NALUParsing::FreeNALU(m_nalu); //释放NALU内存
+    m_nalu = nullptr;
 }
 
 void VideoEncodedFrame::setNalu(T_NALU *nalu, const int64_t &time)
 {
-    mNalu = nalu;
-    mPts  = time;
+    m_nalu = nalu;
+    m_pts  = time;
 }
 
 void VideoEncodedFrame::setNalu(uint8_t *buffer, const int &len, const bool &isAllocBuffer, const T_NALU_TYPE &type, const uint64_t &time)
@@ -82,32 +79,32 @@ void VideoEncodedFrame::setNalu(uint8_t *buffer, const int &len, const bool &isA
 //        }
     }
 
-    if (mNalu != nullptr)
+    if (m_nalu != nullptr)
     {
-        NALUParsing::FreeNALU(mNalu); //释放NALU内存
+        NALUParsing::FreeNALU(m_nalu); //释放NALU内存
     }
 
-    mNalu = nalu;
-    mPts  = time;
+    m_nalu = nalu;
+    m_pts  = time;
 }
 
-uint8_t *VideoEncodedFrame::getBuffer()
+uint8_t *VideoEncodedFrame::buffer()
 {
     uint8_t *buffer = nullptr;
 
     do{
-        if (!mNalu)
+        if (!m_nalu)
         {
             break;
         }
 
-        if (mNalu->type == T_NALU_H264)
+        if (m_nalu->type == T_NALU_H264)
         {
-            buffer = mNalu->nalu.h264Nalu.buf;
+            buffer = m_nalu->nalu.h264Nalu.buf;
         }
-        else if (mNalu->type == T_NALU_H265)
+        else if (m_nalu->type == T_NALU_H265)
         {
-            buffer = mNalu->nalu.h265Nalu.buf;
+            buffer = m_nalu->nalu.h265Nalu.buf;
         }
 
     } while (0);
@@ -115,23 +112,23 @@ uint8_t *VideoEncodedFrame::getBuffer()
     return buffer;
 }
 
-unsigned int VideoEncodedFrame::getSize()
+unsigned int VideoEncodedFrame::size()
 {
     unsigned int buffer_size = 0;
 
     do{
-        if (!mNalu)
+        if (!m_nalu)
         {
             break;
         }
 
-        if (mNalu->type == T_NALU_H264)
+        if (m_nalu->type == T_NALU_H264)
         {
-            buffer_size = mNalu->nalu.h264Nalu.len;
+            buffer_size = m_nalu->nalu.h264Nalu.len;
         }
-        else if (mNalu->type == T_NALU_H265)
+        else if (m_nalu->type == T_NALU_H265)
         {
-            buffer_size = mNalu->nalu.h265Nalu.len;
+            buffer_size = m_nalu->nalu.h265Nalu.len;
         }
 
     } while (0);

+ 13 - 13
module/VideoPlayer/src/frame/VideoFrame/VideoEncodedFrame.h

@@ -20,30 +20,30 @@ public:
     void setNalu(T_NALU *nalu, const int64_t &time = 0);
     void setNalu(uint8_t *buffer, const int &len, const bool & isAllocBuffer, const T_NALU_TYPE &type, const uint64_t &time = 0);
 
-    void setIsKeyFrame(const bool &isKeyFrame){mIsKeyFrame = isKeyFrame;}
+    void setIsKeyFrame(const bool &is_key_frame){m_key_frame = is_key_frame;}
 
-    T_NALU *getNalu(){return mNalu;}
-    bool getIsKeyFrame(){return mIsKeyFrame;}
-    uint64_t getPts(){return mPts;}
+    T_NALU *nalu(){return m_nalu;}
+    bool isKeyFrame(){return m_key_frame;}
+    uint64_t pts(){return m_pts;}
 
     void setTimeStamp(uint64_t t){m_timestamp_ms = t;}
-    uint64_t getTimeStamp(){return m_timestamp_ms;}
+    uint64_t timeStamp(){return m_timestamp_ms;}
 
-    uint8_t *getBuffer();
-    unsigned int getSize();
+    uint8_t *buffer();
+    unsigned int size();
 
-    void setId(uint64_t id){m_id = id;}
-    uint64_t getId(){return m_id;}
+    // void setId(uint64_t id){m_id = id;}
+    // uint64_t id(){return m_id;}
 
 private:
-    T_NALU *mNalu;
+    T_NALU *m_nalu = nullptr;
 
-    bool mIsKeyFrame;
+    bool m_key_frame = false;
 
-    uint64_t mPts;
+    uint64_t m_pts = 0;
     uint64_t m_timestamp_ms = 0; //本地绝对时间(UTC时间戳-毫秒)
 
-    uint64_t m_id = 0;
+    // uint64_t m_id = 0;
 };
 
 #endif // VIDEOFRAME_H

+ 3 - 3
module/VideoPlayer/src/frame/VideoFrame/VideoFrame.cpp

@@ -12,16 +12,16 @@ VideoFrame::~VideoFrame()
 
 void VideoFrame::setFrame(std::shared_ptr<VideoEncodedFrame> frame)
 {
-    if (frame->getNalu()->type == T_NALU_H264)
+    if (frame->nalu()->type == T_NALU_H264)
     {
         m_type = VIDEOFRAME_TYPE_H264;
     }
-    else if (frame->getNalu()->type == T_NALU_H265)
+    else if (frame->nalu()->type == T_NALU_H265)
     {
         m_type = VIDEOFRAME_TYPE_H265;
     }
 
-    m_pts = frame->getPts();
+    m_pts = frame->pts();
 
     m_encoded_frame = frame;
 }

+ 1 - 1
module/VideoPlayer/src/frame/VideoFrame/VideoRawFrame.h

@@ -37,7 +37,7 @@ public:
     int64_t pts(){return mPts;}
 
     void setTimeStamp(uint64_t t){m_timestamp_ms = t;}
-    uint64_t getTimeStamp(){return m_timestamp_ms;}
+    uint64_t timeStamp(){return m_timestamp_ms;}
 
     FrameType type(){return mType;}