Skip to content

Commit 1cea044

Browse files
author
Clement Champetier
committed
IFrame: rename getSize to getDataSize
1 parent dcf6509 commit 1cea044

File tree

12 files changed

+22
-22
lines changed

12 files changed

+22
-22
lines changed

src/AvTranscoder/data/decoded/AudioFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ size_t AudioFrame::getBytesPerSample() const
7575
return av_get_bytes_per_sample(getSampleFormat());
7676
}
7777

78-
size_t AudioFrame::getSize() const
78+
size_t AudioFrame::getDataSize() const
7979
{
8080
if(getSampleFormat() == AV_SAMPLE_FMT_NONE)
8181
{

src/AvTranscoder/data/decoded/AudioFrame.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class AvExport AudioFrame : public IFrame
4949
*/
5050
void allocateData();
5151
void freeData();
52-
size_t getSize() const;
52+
size_t getDataSize() const;
5353

5454
size_t getSampleRate() const { return av_frame_get_sample_rate(_frame); }
5555
size_t getNbChannels() const { return av_frame_get_channels(_frame); }

src/AvTranscoder/data/decoded/IFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void IFrame::assignValue(const unsigned char value)
6868
freeData();
6969

7070
// Create the buffer
71-
const int bufferSize = getSize();
71+
const int bufferSize = getDataSize();
7272
unsigned char* dataBuffer = static_cast<unsigned char*>(malloc(bufferSize * sizeof(unsigned char)));
7373
memset(dataBuffer, value, bufferSize);
7474

src/AvTranscoder/data/decoded/IFrame.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class AvExport IFrame
4747
* @brief Get the size in bytes that a video/audio buffer of the given frame properties would occupy if allocated.
4848
* @warning This methods does not guarantee that the buffer is actually allocated.
4949
*/
50-
virtual size_t getSize() const = 0;
50+
virtual size_t getDataSize() const = 0;
5151

5252
/**
5353
* @brief Assign the given ptr of data to the data of the frame.

src/AvTranscoder/data/decoded/VideoFrame.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ VideoFrame::~VideoFrame()
6767
freeData();
6868
}
6969

70-
size_t VideoFrame::getSize() const
70+
size_t VideoFrame::getDataSize() const
7171
{
7272
if(getPixelFormat() == AV_PIX_FMT_NONE)
7373
{
@@ -117,7 +117,7 @@ void VideoFrame::assignBuffer(const unsigned char* ptrValue)
117117
if(ret < 0)
118118
{
119119
std::stringstream msg;
120-
msg << "Unable to assign an image buffer of " << getSize() << " bytes: " << getDescriptionFromErrorCode(ret);
120+
msg << "Unable to assign an image buffer of " << getDataSize() << " bytes: " << getDescriptionFromErrorCode(ret);
121121
throw std::runtime_error(msg.str());
122122
}
123123
}

src/AvTranscoder/data/decoded/VideoFrame.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class AvExport VideoFrame : public IFrame
5757
*/
5858
void allocateData();
5959
void freeData();
60-
size_t getSize() const;
60+
size_t getDataSize() const;
6161

6262
size_t getWidth() const { return _frame->width; }
6363
size_t getHeight() const { return _frame->height; }

src/AvTranscoder/transform/AudioTransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void AudioTransform::convert(const IFrame& srcFrame, IFrame& dstFrame)
9797
assert(src.getNbChannels() > 0);
9898
assert(src.getNbSamplesPerChannel() > 0);
9999
assert(src.getSampleFormat() != AV_SAMPLE_FMT_NONE);
100-
assert(dst.getSize() > 0);
100+
assert(dst.getDataSize() > 0);
101101

102102
if(!_isInit)
103103
_isInit = init(src, dst);

src/AvTranscoder/transform/VideoTransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void VideoTransform::convert(const IFrame& srcFrame, IFrame& dstFrame)
6868
assert(src.getWidth() > 0);
6969
assert(src.getHeight() > 0);
7070
assert(src.getPixelFormat() != AV_PIX_FMT_NONE);
71-
assert(dst.getSize() > 0);
71+
assert(dst.getDataSize() > 0);
7272

7373
if(!_isInit)
7474
_isInit = init(src, dst);

test/pyTest/testAudioFrame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def testInvalidAudioFrameManualAllocated():
2424
frame = av.AudioFrame(desc, False)
2525

2626
assert_equals(frame.isDataAllocated(), False)
27-
assert_equals(frame.getSize(), 0)
27+
assert_equals(frame.getDataSize(), 0)
2828
assert_equals(frame.getSampleRate(), sampleRate)
2929
assert_equals(frame.getNbChannels(), nbChannels)
3030
assert_equals(frame.getChannelLayoutDesc(), "mono")
@@ -46,7 +46,7 @@ def testAudioFrame():
4646

4747
assert_equals(frame.isDataAllocated(), True)
4848
assert_equals(frame.isAudioFrame(), True)
49-
assert_equals(frame.getSize(), frame.getNbSamplesPerChannel() * frame.getBytesPerSample() * nbChannels)
49+
assert_equals(frame.getDataSize(), frame.getNbSamplesPerChannel() * frame.getBytesPerSample() * nbChannels)
5050

5151
frame.freeData()
5252
assert_equals(frame.isDataAllocated(), False)

test/pyTest/testAudioReader.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def testAudioReaderCreateNewInputFile():
2323
frame = reader.readNextFrame()
2424
if not frame:
2525
break
26-
assert_greater(frame.getSize(), 0)
26+
assert_greater(frame.getDataSize(), 0)
2727

2828
# check if there is no next frame
2929
frame = reader.readNextFrame()
@@ -45,13 +45,13 @@ def testAudioReaderChannelsExtraction():
4545
nbChannels = readerOfAllChannels.getOutputNbChannels()
4646
# read first frame
4747
frame = readerOfAllChannels.readNextFrame()
48-
sizeOfFrameWithAllChannels = frame.getSize()
48+
sizeOfFrameWithAllChannels = frame.getDataSize()
4949

5050
# create reader to read one channel of the audio stream
5151
readerOfOneChannel = av.AudioReader(inputFile, streamIndex, channelIndex)
5252
# read first frame
5353
frame = readerOfOneChannel.readNextFrame()
54-
sizeOfFrameWithOneChannels = frame.getSize()
54+
sizeOfFrameWithOneChannels = frame.getDataSize()
5555

5656
assert_equals( sizeOfFrameWithAllChannels / nbChannels, sizeOfFrameWithOneChannels )
5757

@@ -70,7 +70,7 @@ def testAudioReaderWithGenerator():
7070
frame = reader.readNextFrame()
7171
if not frame:
7272
break
73-
assert_greater(frame.getSize(), 0)
73+
assert_greater(frame.getDataSize(), 0)
7474

7575
# check if there is no next frame
7676
assert_equals( reader.readNextFrame(), None )
@@ -82,4 +82,4 @@ def testAudioReaderWithGenerator():
8282
# assuming we generate data of 1920 samples of 2 bytes
8383
nbSamplesPerChannel = 1920
8484
bytesPerSample = 2
85-
assert_equals(frame.getSize(), reader.getOutputNbChannels() * nbSamplesPerChannel * bytesPerSample )
85+
assert_equals(frame.getDataSize(), reader.getOutputNbChannels() * nbSamplesPerChannel * bytesPerSample )

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy