Moved all libav includes to a namespace

This commit is contained in:
2025-09-05 14:18:06 +03:00
parent 407bbe2ed7
commit fc3a5300af
5 changed files with 21 additions and 26 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,20 @@
#ifndef CHARGE_VIDEO_BASE_H
#define CHARGE_VIDEO_BASE_H
#include <Corrade/Containers/Array.h>
#include <Magnum/GL/Texture.h>
#include <Magnum/Image.h>
#include <Magnum/ImageView.h>
#include <Magnum/Magnum.h>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <queue>
#include <vector>
namespace ChargeVideo {
namespace _dependencies {
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavcodec/codec.h>
@@ -14,26 +29,12 @@ extern "C" {
#include <libswresample/swresample.h>
#include <libswscale/swscale.h>
}
#include <Corrade/Containers/Array.h>
#include <Magnum/GL/Texture.h>
#include <Magnum/Image.h>
#include <Magnum/ImageView.h>
#include <Magnum/Magnum.h>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <queue>
#include <string>
#include <vector>
} // namespace _dependencies
using namespace Corrade;
using namespace Magnum;
using namespace Math::Literals;
namespace ChargeVideo {
using namespace _dependencies;
// ======================== CLASSES ========================
class Time {
public:
@@ -101,7 +102,7 @@ private:
// Buffering
std::queue<Image2D> frameBuffer;
uint32_t bufferMaxFrames = 0, p = 0, z = 0;
uint32_t bufferMaxFrames = 0;
// SAR / Sizing
uint32_t scaleFactor = 1;

View File

@@ -1,12 +1,13 @@
#include "ChargeVideo.hpp"
#include <Corrade/Utility/Utility.h>
#include <Magnum/GL/TextureFormat.h>
#include <Magnum/Math/Functions.h>
#include <Magnum/PixelFormat.h>
#include <cstring>
using namespace ChargeVideo;
#include <cstring>
#include <string>
// ================== Video Construct/Destruct ==================
// ShouldVideoLoop default is true
@@ -131,7 +132,6 @@ void Video::continueVideo() {
Pause(); // Here we did that (check comment below)
return; // We remove what we are returning TO
}
Utility::Debug{} << "Audio" << p << "Video" << z;
restartVideo();
}
@@ -179,9 +179,6 @@ Containers::Array<char> Video::loadNextFrame() {
swr_convert(swrCtx, convertedAudioFrame->data,
convertedAudioFrame->nb_samples, audioFrame->data,
audioFrame->nb_samples);
p++;
Utility::Debug{} << "Loaded an audio frame";
}
}
@@ -198,14 +195,11 @@ Containers::Array<char> Video::loadNextFrame() {
frameConvert(frame, convertedFrame);
// FrameDebug(convertedFrame);
z++;
Utility::Debug{} << "Loaded a video frame";
break;
}
}
av_packet_unref(packet);
}
Utility::Debug{} << "Finished Load";
// You cannot use strlen(data) it does not work
size_t dataSize = av_image_get_buffer_size(
static_cast<AVPixelFormat>(convertedFrame->format), Dimensions.x(),