Cleanup std namespace usage.

This commit is contained in:
brunoherbelin
2020-03-24 00:02:56 +01:00
parent a8167fd684
commit cf6ef69342
6 changed files with 26 additions and 24 deletions

View File

@@ -41,30 +41,33 @@ GLuint blackTexture()
MediaPlayer::MediaPlayer(string name) : id(name) MediaPlayer::MediaPlayer(string name) : id(name)
{ {
if (std::empty(id))
id = GstToolkit::date_time_string();
uri = "undefined"; uri = "undefined";
pipeline = nullptr;
discoverer = nullptr;
ready = false; ready = false;
seekable = false; seekable = false;
isimage = false; isimage = false;
interlaced = false; interlaced = false;
pipeline = nullptr; need_loop = false;
discoverer = nullptr; v_frame_is_full = false;
rate = 1.0;
framerate = 0.0;
width = 640; width = par_width = 640;
height = 480; height = 480;
position = GST_CLOCK_TIME_NONE; position = GST_CLOCK_TIME_NONE;
duration = GST_CLOCK_TIME_NONE; duration = GST_CLOCK_TIME_NONE;
start_position = GST_CLOCK_TIME_NONE; start_position = GST_CLOCK_TIME_NONE;
frame_duration = GST_CLOCK_TIME_NONE; frame_duration = GST_CLOCK_TIME_NONE;
desired_state = GST_STATE_PAUSED; desired_state = GST_STATE_PAUSED;
rate = 1.0;
framerate = 1.0;
loop = LoopMode::LOOP_REWIND; loop = LoopMode::LOOP_REWIND;
need_loop = false;
v_frame_is_full = false;
current_segment = segments.begin(); current_segment = segments.begin();
textureindex = 0; textureindex = 0;
} }
MediaPlayer::~MediaPlayer() MediaPlayer::~MediaPlayer()
@@ -631,6 +634,9 @@ bool MediaPlayer::fill_v_frame(GstBuffer *buf)
// set start position (i.e. pts of first frame we got) // set start position (i.e. pts of first frame we got)
if (start_position == GST_CLOCK_TIME_NONE) if (start_position == GST_CLOCK_TIME_NONE)
start_position = position; start_position = position;
// keep update time (i.e. actual FPS of update)
timecount.tic();
} }
} }
@@ -670,8 +676,6 @@ GstFlowReturn MediaPlayer::callback_pull_sample_video (GstElement *bin, MediaPla
sample = gst_app_sink_try_pull_sample( (GstAppSink * ) bin, 0 ); sample = gst_app_sink_try_pull_sample( (GstAppSink * ) bin, 0 );
} }
// keep update time (i.e. actual FPS of update)
m->timecount.tic();
} }
return ret; return ret;

View File

@@ -7,7 +7,6 @@
#include <set> #include <set>
#include <list> #include <list>
#include <utility> #include <utility>
using namespace std;
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/gl/gl.h> #include <gst/gl/gl.h>
@@ -91,7 +90,7 @@ public:
/** /**
* Constructor of a GStreamer Media * Constructor of a GStreamer Media
*/ */
MediaPlayer(string name); MediaPlayer( std::string name = std::string() );
/** /**
* Destructor. * Destructor.
*/ */
@@ -99,7 +98,7 @@ public:
/** /**
* Open a media using gstreamer URI * Open a media using gstreamer URI
* */ * */
void Open(string uri); void Open( std::string uri);
/** /**
* True if a media was oppenned * True if a media was oppenned
* */ * */
@@ -211,8 +210,8 @@ private:
bool removeAllPlaySegmentOverlap(MediaSegment s); bool removeAllPlaySegmentOverlap(MediaSegment s);
std::list< std::pair<guint64, guint64> > getPlaySegments() const; std::list< std::pair<guint64, guint64> > getPlaySegments() const;
string id; std::string id;
string uri; std::string uri;
guint textureindex; guint textureindex;
guint width; guint width;
guint height; guint height;

View File

@@ -2,6 +2,7 @@
#include "Log.h" #include "Log.h"
#include <iostream> #include <iostream>
using namespace std;
#include <tinyxml2.h> #include <tinyxml2.h>
using namespace tinyxml2; using namespace tinyxml2;

View File

@@ -3,16 +3,14 @@
#include "defines.h" #include "defines.h"
#include <string> #include <string>
#include <list> #include <list>
using namespace std;
namespace Settings { namespace Settings {
struct Window struct Window
{ {
string name; std::string name;
int x,y,w,h; int x,y,w,h;
bool fullscreen; bool fullscreen;
@@ -22,10 +20,10 @@ struct Window
struct Application struct Application
{ {
string name; std::string name;
float scale; float scale;
int color; int color;
list<Window> windows; std::list<Window> windows;
Application() : name(APP_NAME), scale(1.f), color(0){ Application() : name(APP_NAME), scale(1.f), color(0){
windows.push_back(Window()); windows.push_back(Window());

View File

@@ -718,7 +718,7 @@ void MainWindow::Render()
if ( Rendering::manager().CurrentScreenshot()->IsFull() ){ if ( Rendering::manager().CurrentScreenshot()->IsFull() ){
std::time_t t = std::time(0); // get time now std::time_t t = std::time(0); // get time now
std::tm* now = std::localtime(&t); std::tm* now = std::localtime(&t);
std::string filename = ImGuiToolkit::DateTime() + "_vmixcapture.png"; std::string filename = GstToolkit::date_time_string() + "_vmixcapture.png";
Rendering::manager().CurrentScreenshot()->SaveFile( filename.c_str() ); Rendering::manager().CurrentScreenshot()->SaveFile( filename.c_str() );
Rendering::manager().CurrentScreenshot()->Clear(); Rendering::manager().CurrentScreenshot()->Clear();
} }

View File

@@ -29,7 +29,7 @@
#define PI 3.14159265358979323846 #define PI 3.14159265358979323846
MediaPlayer testmedia("testmedia"); MediaPlayer testmedia;
MediaPlayer testmedia2("testmedia2"); MediaPlayer testmedia2("testmedia2");
Shader rendering_shader; Shader rendering_shader;
unsigned int vbo, vao, ebo; unsigned int vbo, vao, ebo;
@@ -365,10 +365,10 @@ int main(int, char**)
// 1 // 1
// testmedia.Open("file:///home/bhbn/Videos/MOV001.MOD"); // testmedia.Open("file:///home/bhbn/Videos/MOV001.MOD");
testmedia.Open("file:///home/bhbn/Videos/TestFormats/Commodore64GameReviewMoondust.flv"); // testmedia.Open("file:///home/bhbn/Videos/TestFormats/Commodore64GameReviewMoondust.flv");
// testmedia.Open("file:///home/bhbn/Videos/fish.mp4"); // testmedia.Open("file:///home/bhbn/Videos/fish.mp4");
// testmedia.Open("file:///home/bhbn/Videos/jean/Solitude1080p.mov"); // testmedia.Open("file:///home/bhbn/Videos/jean/Solitude1080p.mov");
// testmedia.Open("file:///home/bhbn/Videos/TearsOfSteel_720p_h265.mkv"); testmedia.Open("file:///home/bhbn/Videos/TearsOfSteel_720p_h265.mkv");
// testmedia.Open("file:///home/bhbn/Videos/TestFormats/_h264GoldenLamps.mkv"); // testmedia.Open("file:///home/bhbn/Videos/TestFormats/_h264GoldenLamps.mkv");
// testmedia.Open("file:///home/bhbn/Videos/TestEncoding/vpxvp9high.webm"); // testmedia.Open("file:///home/bhbn/Videos/TestEncoding/vpxvp9high.webm");