Skip to content

Commit

Permalink
Remove redundant namespace references
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed Aug 9, 2022
1 parent 0f7ec78 commit 37070a9
Show file tree
Hide file tree
Showing 45 changed files with 736 additions and 736 deletions.
4 changes: 2 additions & 2 deletions av/src/AudioDecoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ignition::common::AudioDecoderPrivate
AudioDecoder::AudioDecoder()
: data(new AudioDecoderPrivate)
{
ignition::common::load();
load();

this->data->formatCtx = nullptr;
this->data->codecCtx = nullptr;
Expand Down Expand Up @@ -108,7 +108,7 @@ bool AudioDecoder::Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize)

bool result = true;

if (!(decodedFrame = common::AVFrameAlloc()))
if (!(decodedFrame = AVFrameAlloc()))
{
ignerr << "Audio decoder out of memory\n";
result = false;
Expand Down
14 changes: 7 additions & 7 deletions av/src/HWEncoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ HWEncoderType DetectHWEncoderType(const std::string& _codecName)

bool matches;
if (matchPrefix)
matches = common::StartsWith(_codecName, matchString);
matches = StartsWith(_codecName, matchString);
else
matches = common::EndsWith(_codecName, matchString);
matches = EndsWith(_codecName, matchString);

if (matches)
return hwAccel;
Expand Down Expand Up @@ -232,7 +232,7 @@ AVCodec* HWEncoder::FindEncoder(AVCodecID _codecId)
case HWEncoderType::NVENC:
{
std::string deviceName = "/dev/nvidia0";
if (common::StartsWith(initHwDevice, "/dev/nvidia"))
if (StartsWith(initHwDevice, "/dev/nvidia"))
deviceName = initHwDevice;
else if (!initHwDevice.empty())
break;
Expand Down Expand Up @@ -268,18 +268,18 @@ AVCodec* HWEncoder::FindEncoder(AVCodecID _codecId)
"/dev/dri/renderD129", "/dev/dri/renderD128", ":0"
};
std::string display;
if (common::env("DISPLAY", display) && display != ":0")
if (env("DISPLAY", display) && display != ":0")
devices.push_back(display);

// DRM device or local X display
if (common::StartsWith(initHwDevice, "/dev/dri/renderD") ||
common::StartsWith(initHwDevice, ":"))
if (StartsWith(initHwDevice, "/dev/dri/renderD") ||
StartsWith(initHwDevice, ":"))
{
devices = {initHwDevice};
}
else if (!initHwDevice.empty())
{
const auto parts = common::Split(initHwDevice, ':');
const auto parts = Split(initHwDevice, ':');
// check if device is of form <host>:<display>
if (parts.size() != 2)
break;
Expand Down
6 changes: 3 additions & 3 deletions av/src/Video.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Video::Video()
: dataPtr(new VideoPrivate)
{
// Make sure libav is loaded.
ignition::common::load();
load();
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -100,7 +100,7 @@ bool Video::Load(const std::string &_filename)
this->Cleanup();
}

this->dataPtr->avFrame = common::AVFrameAlloc();
this->dataPtr->avFrame = AVFrameAlloc();

// Open video file
if (avformat_open_input(&this->dataPtr->formatCtx, _filename.c_str(),
Expand Down Expand Up @@ -212,7 +212,7 @@ bool Video::Load(const std::string &_filename)
}

// swscale needs 32-byte-aligned output frame on some systems
this->dataPtr->avFrameDst = common::AVFrameAlloc();
this->dataPtr->avFrameDst = AVFrameAlloc();
this->dataPtr->avFrameDst->format = this->dataPtr->dstPixelFormat;
this->dataPtr->avFrameDst->width = this->dataPtr->codecCtx->width;
this->dataPtr->avFrameDst->height = this->dataPtr->codecCtx->height;
Expand Down
12 changes: 6 additions & 6 deletions av/src/VideoEncoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using namespace std;

// Private data class
// hidden visibility specifier has to be explicitly set to silent a gcc warning
class IGNITION_COMMON_AV_HIDDEN ignition::common::VideoEncoderPrivate
class IGNITION_COMMON_AV_HIDDEN common::VideoEncoderPrivate
{
/// \brief Name of the file which stores the video while it is being
/// recorded.
Expand Down Expand Up @@ -147,7 +147,7 @@ VideoEncoder::VideoEncoder()
: dataPtr(new VideoEncoderPrivate)
{
// Make sure libav is loaded.
ignition::common::load();
load();
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -265,7 +265,7 @@ bool VideoEncoder::Start(
}

// Remove old temp file, if it exists.
if (common::exists(this->dataPtr->filename))
if (exists(this->dataPtr->filename))
{
auto success = removeFile(this->dataPtr->filename.c_str());
if (!success)
Expand Down Expand Up @@ -323,7 +323,7 @@ bool VideoEncoder::Start(
}
else
{
this->dataPtr->filename = joinPaths(common::cwd(), "TMP_RECORDING." +
this->dataPtr->filename = joinPaths(cwd(), "TMP_RECORDING." +
this->dataPtr->format);
}
}
Expand Down Expand Up @@ -961,7 +961,7 @@ bool VideoEncoder::SaveToFile(const std::string &_filename)

if (this->dataPtr->format != "v4l2")
{
result = common::moveFile(this->dataPtr->filename, _filename);
result = moveFile(this->dataPtr->filename, _filename);

if (!result)
{
Expand All @@ -984,7 +984,7 @@ void VideoEncoder::Reset()
this->Stop();

// Remove old temp file, if it exists.
if (common::exists(this->dataPtr->filename))
if (exists(this->dataPtr->filename))
{
auto success = removeFile(this->dataPtr->filename.c_str());
if (!success)
Expand Down
52 changes: 26 additions & 26 deletions av/src/VideoEncoder_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class VideoEncoderTest : public common::testing::AutoLogFixture
/////////////////////////////////////////////////
TEST_F(VideoEncoderTest, StartStopDefault)
{
auto filePathMp4 = common::joinPaths(common::cwd(), "TMP_RECORDING.mp4");
auto filePathMp4 = joinPaths(cwd(), "TMP_RECORDING.mp4");

{
VideoEncoder video;
Expand All @@ -45,21 +45,21 @@ TEST_F(VideoEncoderTest, StartStopDefault)

EXPECT_TRUE(video.Start());
EXPECT_TRUE(video.IsEncoding());
EXPECT_TRUE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_TRUE(exists(filePathMp4)) << filePathMp4;
EXPECT_EQ(video.BitRate(), 920000u);

EXPECT_TRUE(video.Stop());
EXPECT_FALSE(video.IsEncoding());
}

// Check that temp files are removed when video goes out of scope
EXPECT_FALSE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(exists(filePathMp4)) << filePathMp4;
}

/////////////////////////////////////////////////
TEST_F(VideoEncoderTest, StartStopMpg)
{
auto filePathMpg = common::joinPaths(common::cwd(), "TMP_RECORDING.mpg");
auto filePathMpg = joinPaths(cwd(), "TMP_RECORDING.mpg");

{
VideoEncoder video;
Expand All @@ -71,19 +71,19 @@ TEST_F(VideoEncoderTest, StartStopMpg)
EXPECT_TRUE(video.Start("mpg", "", 1024, 768));
EXPECT_TRUE(video.IsEncoding());
EXPECT_STREQ(video.Format().c_str(), "mpg");
EXPECT_TRUE(common::exists(filePathMpg)) << filePathMpg;
EXPECT_TRUE(exists(filePathMpg)) << filePathMpg;
EXPECT_TRUE(video.Stop());
EXPECT_FALSE(video.IsEncoding());
}

EXPECT_FALSE(common::exists(filePathMpg)) << filePathMpg;
EXPECT_FALSE(exists(filePathMpg)) << filePathMpg;
}


/////////////////////////////////////////////////
TEST_F(VideoEncoderTest, StartStopMp4)
{
auto filePathMp4 = common::joinPaths(common::cwd(), "TMP_RECORDING.mp4");
auto filePathMp4 = joinPaths(cwd(), "TMP_RECORDING.mp4");

{
VideoEncoder video;
Expand All @@ -95,19 +95,19 @@ TEST_F(VideoEncoderTest, StartStopMp4)
EXPECT_TRUE(video.Start("mp4", "", 1024, 768));
EXPECT_TRUE(video.IsEncoding());
EXPECT_STREQ(video.Format().c_str(), "mp4");
EXPECT_TRUE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_TRUE(exists(filePathMp4)) << filePathMp4;
video.Stop();
EXPECT_FALSE(video.IsEncoding());
}

EXPECT_FALSE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(exists(filePathMp4)) << filePathMp4;
}

/////////////////////////////////////////////////
TEST_F(VideoEncoderTest, RepeatedStart)
{
auto filePathMpg = common::joinPaths(common::cwd(), "TMP_RECORDING.mpg");
auto filePathMp4 = common::joinPaths(common::cwd(), "TMP_RECORDING.mp4");
auto filePathMpg = joinPaths(cwd(), "TMP_RECORDING.mpg");
auto filePathMp4 = joinPaths(cwd(), "TMP_RECORDING.mp4");

{
VideoEncoder video;
Expand All @@ -119,15 +119,15 @@ TEST_F(VideoEncoderTest, RepeatedStart)
EXPECT_TRUE(video.Start("mp4", "", 1024, 768));
EXPECT_TRUE(video.IsEncoding());
EXPECT_STREQ(video.Format().c_str(), "mp4");
EXPECT_TRUE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_TRUE(exists(filePathMp4)) << filePathMp4;

// Calling start again should return false and not mutate any
// internal state of the VideoEncoder
EXPECT_FALSE(video.Start("mpg", "", 1024, 768));
EXPECT_TRUE(video.IsEncoding());
EXPECT_STREQ(video.Format().c_str(), "mp4");
EXPECT_TRUE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(common::exists(filePathMpg)) << filePathMpg;
EXPECT_TRUE(exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(exists(filePathMpg)) << filePathMpg;

EXPECT_TRUE(video.Stop());
EXPECT_FALSE(video.IsEncoding());
Expand All @@ -136,38 +136,38 @@ TEST_F(VideoEncoderTest, RepeatedStart)
EXPECT_TRUE(video.Start("mpg", "", 1024, 768));
EXPECT_TRUE(video.IsEncoding());
EXPECT_STREQ(video.Format().c_str(), "mpg");
EXPECT_FALSE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_TRUE(common::exists(filePathMpg)) << filePathMpg;
EXPECT_FALSE(exists(filePathMp4)) << filePathMp4;
EXPECT_TRUE(exists(filePathMpg)) << filePathMpg;
}

// All temporary files will be removed after exiting scope.
EXPECT_FALSE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(common::exists(filePathMpg)) << filePathMp4;
EXPECT_FALSE(exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(exists(filePathMpg)) << filePathMp4;
}


/////////////////////////////////////////////////
TEST_F(VideoEncoderTest, Exists)
{
auto filePathMp4 = common::joinPaths(common::cwd(), "TMP_RECORDING.mp4");
auto filePathMpg = common::joinPaths(common::cwd(), "TMP_RECORDING.mpg");
auto filePathMp4 = joinPaths(cwd(), "TMP_RECORDING.mp4");
auto filePathMpg = joinPaths(cwd(), "TMP_RECORDING.mpg");

{
VideoEncoder video;
EXPECT_FALSE(video.IsEncoding());
EXPECT_STREQ(video.Format().c_str(), VIDEO_ENCODER_FORMAT_DEFAULT);

EXPECT_FALSE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(common::exists(filePathMpg)) << filePathMpg;
EXPECT_FALSE(exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(exists(filePathMpg)) << filePathMpg;

video.Start();
EXPECT_TRUE(common::exists(filePathMp4));
EXPECT_TRUE(exists(filePathMp4));

video.Reset();
EXPECT_FALSE(common::exists(filePathMp4));
EXPECT_FALSE(exists(filePathMp4));
}

// Check that temp files are removed when video goes out of scope
EXPECT_FALSE(common::exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(common::exists(filePathMpg)) << filePathMpg;
EXPECT_FALSE(exists(filePathMp4)) << filePathMp4;
EXPECT_FALSE(exists(filePathMpg)) << filePathMpg;
}
24 changes: 12 additions & 12 deletions events/src/MouseEvent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class ignition::common::MouseEventPrivate
{}

/// \brief Mouse pointer position on the screen.
public: ignition::math::Vector2i pos;
public: math::Vector2i pos;

/// \brief Previous position.
public: ignition::math::Vector2i prevPos;
public: math::Vector2i prevPos;

/// \brief Position of button press.
public: ignition::math::Vector2i pressPos;
public: math::Vector2i pressPos;

/// \brief Scroll position.
public: ignition::math::Vector2i scroll;
public: math::Vector2i scroll;

/// \brief Scaling factor.
public: float moveScale;
Expand Down Expand Up @@ -88,13 +88,13 @@ MouseEvent::~MouseEvent()
}

/////////////////////////////////////////////////
ignition::math::Vector2i MouseEvent::Pos() const
math::Vector2i MouseEvent::Pos() const
{
return this->dataPtr->pos;
}

/////////////////////////////////////////////////
void MouseEvent::SetPos(const ignition::math::Vector2i &_pos)
void MouseEvent::SetPos(const math::Vector2i &_pos)
{
this->dataPtr->pos = _pos;
}
Expand All @@ -106,13 +106,13 @@ void MouseEvent::SetPos(const int _x, const int _y)
}

/////////////////////////////////////////////////
ignition::math::Vector2i MouseEvent::PrevPos() const
math::Vector2i MouseEvent::PrevPos() const
{
return this->dataPtr->prevPos;
}

/////////////////////////////////////////////////
void MouseEvent::SetPrevPos(const ignition::math::Vector2i &_pos)
void MouseEvent::SetPrevPos(const math::Vector2i &_pos)
{
this->dataPtr->prevPos = _pos;
}
Expand All @@ -124,13 +124,13 @@ void MouseEvent::SetPrevPos(const int _x, const int _y)
}

/////////////////////////////////////////////////
ignition::math::Vector2i MouseEvent::PressPos() const
math::Vector2i MouseEvent::PressPos() const
{
return this->dataPtr->pressPos;
}

/////////////////////////////////////////////////
void MouseEvent::SetPressPos(const ignition::math::Vector2i &_pos)
void MouseEvent::SetPressPos(const math::Vector2i &_pos)
{
this->dataPtr->pressPos = _pos;
}
Expand All @@ -142,13 +142,13 @@ void MouseEvent::SetPressPos(const int _x, const int _y)
}

/////////////////////////////////////////////////
ignition::math::Vector2i MouseEvent::Scroll() const
math::Vector2i MouseEvent::Scroll() const
{
return this->dataPtr->scroll;
}

/////////////////////////////////////////////////
void MouseEvent::SetScroll(const ignition::math::Vector2i &_scroll)
void MouseEvent::SetScroll(const math::Vector2i &_scroll)
{
this->dataPtr->scroll = _scroll;
}
Expand Down
Loading

0 comments on commit 37070a9

Please sign in to comment.