Skip to content

Commit 6847185

Browse files
author
Clement Champetier
committed
decoded data: rename class Frame to IFrame
* IFrame is an abstract class. * To keep the naming convention of the project, rename it to IFrame.
1 parent c662a70 commit 6847185

32 files changed

+83
-83
lines changed

src/AvTranscoder/data/data.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
%{
44
#include <AvTranscoder/data/coded/CodedData.hpp>
5-
#include <AvTranscoder/data/decoded/Frame.hpp>
5+
#include <AvTranscoder/data/decoded/IFrame.hpp>
66
#include <AvTranscoder/data/decoded/VideoFrame.hpp>
77
#include <AvTranscoder/data/decoded/AudioFrame.hpp>
88
%}
99

1010
%include <AvTranscoder/data/coded/CodedData.hpp>
11-
%include <AvTranscoder/data/decoded/Frame.hpp>
11+
%include <AvTranscoder/data/decoded/IFrame.hpp>
1212
%include <AvTranscoder/data/decoded/VideoFrame.hpp>
1313
%include <AvTranscoder/data/decoded/AudioFrame.hpp>

src/AvTranscoder/data/decoded/AudioFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void AudioFrameDesc::setParameters(const ProfileLoader::Profile& profile)
4040
}
4141

4242
AudioFrame::AudioFrame(const AudioFrameDesc& desc, const bool forceDataAllocation)
43-
: Frame()
43+
: IFrame()
4444
, _desc(desc)
4545
{
4646
// Set Frame properties

src/AvTranscoder/data/decoded/AudioFrame.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef _AV_TRANSCODER_FRAME_AUDIO_FRAME_HPP_
22
#define _AV_TRANSCODER_FRAME_AUDIO_FRAME_HPP_
33

4-
#include "Frame.hpp"
4+
#include "IFrame.hpp"
55
#include <AvTranscoder/profile/ProfileLoader.hpp>
66

77
namespace avtranscoder
@@ -33,7 +33,7 @@ struct AvExport AudioFrameDesc
3333
/**
3434
* @brief This class describes decoded audio data.
3535
*/
36-
class AvExport AudioFrame : public Frame
36+
class AvExport AudioFrame : public IFrame
3737
{
3838
public:
3939
AudioFrame(const AudioFrameDesc& desc, const bool forceDataAllocation = true);

src/AvTranscoder/data/decoded/Frame.cpp renamed to src/AvTranscoder/data/decoded/IFrame.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
#include "Frame.hpp"
1+
#include "IFrame.hpp"
22

33
#include <stdexcept>
44

55
namespace avtranscoder
66
{
77

8-
Frame::Frame()
8+
IFrame::IFrame()
99
: _frame(NULL)
1010
, _dataAllocated(false)
1111
{
1212
allocateAVFrame();
1313
}
1414

15-
Frame::~Frame()
15+
IFrame::~IFrame()
1616
{
1717
freeAVFrame();
1818
}
1919

20-
void Frame::copyData(const Frame& frameToRef)
20+
void IFrame::copyData(const IFrame& frameToRef)
2121
{
2222
const int ret = av_frame_copy(_frame, &frameToRef.getAVFrame());
2323
if(ret < 0)
@@ -26,12 +26,12 @@ void Frame::copyData(const Frame& frameToRef)
2626
}
2727
}
2828

29-
void Frame::copyProperties(const Frame& otherFrame)
29+
void IFrame::copyProperties(const IFrame& otherFrame)
3030
{
3131
av_frame_copy_props(_frame, &otherFrame.getAVFrame());
3232
}
3333

34-
void Frame::allocateAVFrame()
34+
void IFrame::allocateAVFrame()
3535
{
3636
#if LIBAVCODEC_VERSION_MAJOR > 54
3737
_frame = av_frame_alloc();
@@ -45,7 +45,7 @@ void Frame::allocateAVFrame()
4545
}
4646
}
4747

48-
void Frame::freeAVFrame()
48+
void IFrame::freeAVFrame()
4949
{
5050
if(_frame != NULL)
5151
{
@@ -62,14 +62,14 @@ void Frame::freeAVFrame()
6262
}
6363
}
6464

65-
bool Frame::isAudioFrame() const
65+
bool IFrame::isAudioFrame() const
6666
{
6767
if(_frame->sample_rate && _frame->channels && _frame->channel_layout && _frame->format != -1)
6868
return true;
6969
return false;
7070
}
7171

72-
bool Frame::isVideoFrame() const
72+
bool IFrame::isVideoFrame() const
7373
{
7474
if(_frame->width && _frame->height && _frame->format != -1)
7575
return true;

src/AvTranscoder/data/decoded/Frame.hpp renamed to src/AvTranscoder/data/decoded/IFrame.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace avtranscoder
1616
* @see VideoFrame
1717
* @see AudioFrame
1818
*/
19-
class AvExport Frame
19+
class AvExport IFrame
2020
{
2121
public:
2222
/**
@@ -25,9 +25,9 @@ class AvExport Frame
2525
* Depending on the case, we could manipulate frame with data allocated elsewhere.
2626
* For example, an empty frame is given to a decoder, which is responsible to allocate and free the data buffers.
2727
*/
28-
Frame();
28+
IFrame();
2929

30-
virtual ~Frame();
30+
virtual ~IFrame();
3131

3232
/**
3333
* @brief Allocate the buffer of the frame.
@@ -66,13 +66,13 @@ class AvExport Frame
6666
* @note It copies the frame data (i.e. the contents of the data / extended data arrays), not any other properties.
6767
* @see copyProperties
6868
*/
69-
void copyData(const Frame& frameToRef);
69+
void copyData(const IFrame& frameToRef);
7070

7171
/**
7272
* @brief Copy all the fields that do not affect the data layout in the buffers.
7373
* @warning The info checked when copying data of an other frame (width/height, channels...) are not copied.
7474
*/
75-
void copyProperties(const Frame& otherFrame);
75+
void copyProperties(const IFrame& otherFrame);
7676

7777
/**
7878
* @return If it corresponds to a valid audio frame.

src/AvTranscoder/data/decoded/VideoFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void VideoFrameDesc::setParameters(const ProfileLoader::Profile& profile)
4646
}
4747

4848
VideoFrame::VideoFrame(const VideoFrameDesc& desc, const bool forceDataAllocation)
49-
: Frame()
49+
: IFrame()
5050
, _desc(desc)
5151
{
5252
_frame->width = desc._width;

src/AvTranscoder/data/decoded/VideoFrame.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef _AV_TRANSCODER_FRAME_VIDEO_FRAME_HPP_
22
#define _AV_TRANSCODER_FRAME_VIDEO_FRAME_HPP_
33

4-
#include "Frame.hpp"
4+
#include "IFrame.hpp"
55
#include <AvTranscoder/profile/ProfileLoader.hpp>
66

77
extern "C" {
@@ -40,7 +40,7 @@ struct AvExport VideoFrameDesc
4040
/**
4141
* @brief This class describes decoded video data.
4242
*/
43-
class AvExport VideoFrame : public Frame
43+
class AvExport VideoFrame : public IFrame
4444
{
4545
public:
4646
VideoFrame(const VideoFrameDesc& desc, const bool forceDataAllocation = true);

src/AvTranscoder/decoder/AudioDecoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void AudioDecoder::setupDecoder(const ProfileLoader::Profile& profile)
7676
_isSetup = true;
7777
}
7878

79-
bool AudioDecoder::decodeNextFrame(Frame& frameBuffer)
79+
bool AudioDecoder::decodeNextFrame(IFrame& frameBuffer)
8080
{
8181
bool decodeNextFrame = false;
8282
const size_t channelLayout = frameBuffer.getAVFrame().channel_layout;
@@ -121,7 +121,7 @@ bool AudioDecoder::decodeNextFrame(Frame& frameBuffer)
121121
return decodeNextFrame;
122122
}
123123

124-
bool AudioDecoder::decodeNextFrame(Frame& frameBuffer, const std::vector<size_t> channelIndexArray)
124+
bool AudioDecoder::decodeNextFrame(IFrame& frameBuffer, const std::vector<size_t> channelIndexArray)
125125
{
126126
AVCodecContext& avCodecContext = _inputStream->getAudioCodec().getAVCodecContext();
127127
const size_t srcNbChannels = avCodecContext.channels;

src/AvTranscoder/decoder/AudioDecoder.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class AvExport AudioDecoder : public IDecoder
1616

1717
void setupDecoder(const ProfileLoader::Profile& profile = ProfileLoader::Profile());
1818

19-
bool decodeNextFrame(Frame& frameBuffer);
20-
bool decodeNextFrame(Frame& frameBuffer, const std::vector<size_t> channelIndexArray);
19+
bool decodeNextFrame(IFrame& frameBuffer);
20+
bool decodeNextFrame(IFrame& frameBuffer, const std::vector<size_t> channelIndexArray);
2121

2222
void flushDecoder();
2323

src/AvTranscoder/decoder/AudioGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AudioGenerator::~AudioGenerator()
1919
delete _silent;
2020
}
2121

22-
bool AudioGenerator::decodeNextFrame(Frame& frameBuffer)
22+
bool AudioGenerator::decodeNextFrame(IFrame& frameBuffer)
2323
{
2424
// Generate silent
2525
if(!_inputFrame)
@@ -53,7 +53,7 @@ bool AudioGenerator::decodeNextFrame(Frame& frameBuffer)
5353
return true;
5454
}
5555

56-
bool AudioGenerator::decodeNextFrame(Frame& frameBuffer, const std::vector<size_t> channelIndexArray)
56+
bool AudioGenerator::decodeNextFrame(IFrame& frameBuffer, const std::vector<size_t> channelIndexArray)
5757
{
5858
return decodeNextFrame(frameBuffer);
5959
}

0 commit comments

Comments
 (0)