From cf6ef69342a0147f8733819caa21cadb6f21b7cb Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Tue, 24 Mar 2020 00:02:56 +0100 Subject: [PATCH] Cleanup std namespace usage. --- MediaPlayer.cpp | 24 ++++++++++++++---------- MediaPlayer.h | 9 ++++----- Settings.cpp | 1 + Settings.h | 8 +++----- UserInterfaceManager.cpp | 2 +- main.cpp | 6 +++--- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/MediaPlayer.cpp b/MediaPlayer.cpp index fdaba19..f59b670 100644 --- a/MediaPlayer.cpp +++ b/MediaPlayer.cpp @@ -41,30 +41,33 @@ GLuint blackTexture() MediaPlayer::MediaPlayer(string name) : id(name) { + if (std::empty(id)) + id = GstToolkit::date_time_string(); + uri = "undefined"; + pipeline = nullptr; + discoverer = nullptr; + ready = false; seekable = false; isimage = false; interlaced = false; - pipeline = nullptr; - discoverer = nullptr; + need_loop = false; + v_frame_is_full = false; + rate = 1.0; + framerate = 0.0; - width = 640; + width = par_width = 640; height = 480; position = GST_CLOCK_TIME_NONE; duration = GST_CLOCK_TIME_NONE; start_position = GST_CLOCK_TIME_NONE; frame_duration = GST_CLOCK_TIME_NONE; desired_state = GST_STATE_PAUSED; - rate = 1.0; - framerate = 1.0; loop = LoopMode::LOOP_REWIND; - need_loop = false; - v_frame_is_full = false; current_segment = segments.begin(); textureindex = 0; - } MediaPlayer::~MediaPlayer() @@ -631,6 +634,9 @@ bool MediaPlayer::fill_v_frame(GstBuffer *buf) // set start position (i.e. pts of first frame we got) if (start_position == GST_CLOCK_TIME_NONE) 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 ); } - // keep update time (i.e. actual FPS of update) - m->timecount.tic(); } return ret; diff --git a/MediaPlayer.h b/MediaPlayer.h index 61fe1b7..3263c1d 100644 --- a/MediaPlayer.h +++ b/MediaPlayer.h @@ -7,7 +7,6 @@ #include #include #include -using namespace std; #include #include @@ -91,7 +90,7 @@ public: /** * Constructor of a GStreamer Media */ - MediaPlayer(string name); + MediaPlayer( std::string name = std::string() ); /** * Destructor. */ @@ -99,7 +98,7 @@ public: /** * Open a media using gstreamer URI * */ - void Open(string uri); + void Open( std::string uri); /** * True if a media was oppenned * */ @@ -211,8 +210,8 @@ private: bool removeAllPlaySegmentOverlap(MediaSegment s); std::list< std::pair > getPlaySegments() const; - string id; - string uri; + std::string id; + std::string uri; guint textureindex; guint width; guint height; diff --git a/Settings.cpp b/Settings.cpp index 3edb50b..42b20b7 100644 --- a/Settings.cpp +++ b/Settings.cpp @@ -2,6 +2,7 @@ #include "Log.h" #include +using namespace std; #include using namespace tinyxml2; diff --git a/Settings.h b/Settings.h index e71d590..d6bcef2 100644 --- a/Settings.h +++ b/Settings.h @@ -3,16 +3,14 @@ #include "defines.h" - #include #include -using namespace std; namespace Settings { struct Window { - string name; + std::string name; int x,y,w,h; bool fullscreen; @@ -22,10 +20,10 @@ struct Window struct Application { - string name; + std::string name; float scale; int color; - list windows; + std::list windows; Application() : name(APP_NAME), scale(1.f), color(0){ windows.push_back(Window()); diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index bc9071c..0f65532 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -718,7 +718,7 @@ void MainWindow::Render() if ( Rendering::manager().CurrentScreenshot()->IsFull() ){ std::time_t t = std::time(0); // get time now 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()->Clear(); } diff --git a/main.cpp b/main.cpp index 02ae065..99f0b5c 100644 --- a/main.cpp +++ b/main.cpp @@ -29,7 +29,7 @@ #define PI 3.14159265358979323846 -MediaPlayer testmedia("testmedia"); +MediaPlayer testmedia; MediaPlayer testmedia2("testmedia2"); Shader rendering_shader; unsigned int vbo, vao, ebo; @@ -365,10 +365,10 @@ int main(int, char**) // 1 // 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/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/TestEncoding/vpxvp9high.webm");