From 0dbbe942d2b08c6014812bd74ac2cdfb60e2f93f Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Sun, 4 Aug 2019 21:53:29 -0400 Subject: [PATCH] Use std:: in WriterBase --- include/WriterBase.h | 12 +++++------- src/WriterBase.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/WriterBase.h b/include/WriterBase.h index 7620da64..7387d613 100644 --- a/include/WriterBase.h +++ b/include/WriterBase.h @@ -39,8 +39,6 @@ #include "ReaderBase.h" #include "ZmqLogger.h" -using namespace std; - namespace openshot { /** @@ -63,20 +61,20 @@ namespace openshot int video_bit_rate; ///< The bit rate of the video stream (in bytes) Fraction pixel_ratio; ///< The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) Fraction display_ratio; ///< The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) - string vcodec; ///< The name of the video codec used to encode / decode the video stream + std::string vcodec; ///< The name of the video codec used to encode / decode the video stream int64_t video_length; ///< The number of frames in the video stream int video_stream_index; ///< The index of the video stream Fraction video_timebase; ///< The video timebase determines how long each frame stays on the screen bool interlaced_frame; ///< Are the contents of this frame interlaced bool top_field_first; ///< Which interlaced field should be displayed first - string acodec; ///< The name of the audio codec used to encode / decode the video stream + std::string acodec; ///< The name of the audio codec used to encode / decode the video stream int audio_bit_rate; ///< The bit rate of the audio stream (in bytes) int sample_rate; ///< The number of audio samples per second (44100 is a common sample rate) int channels; ///< The number of audio channels used in the audio stream ChannelLayout channel_layout; ///< The channel layout (mono, stereo, 5 point surround, etc...) int audio_stream_index; ///< The index of the audio stream Fraction audio_timebase; ///< The audio timebase determines how long each audio packet should be played - std::map metadata; ///< An optional map/dictionary of video & audio metadata + std::map metadata; ///< An optional map/dictionary of video & audio metadata }; /** @@ -109,9 +107,9 @@ namespace openshot virtual void WriteFrame(ReaderBase* reader, int64_t start, int64_t length) = 0; /// Get and Set JSON methods - string Json(); ///< Generate JSON string of this object + std::string Json(); ///< Generate JSON string of this object Json::Value JsonValue(); ///< Generate Json::JsonValue for this object - void SetJson(string value); ///< Load JSON string into this object + void SetJson(std::string value); ///< Load JSON string into this object void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object /// Display file information in the standard output stream (stdout) diff --git a/src/WriterBase.cpp b/src/WriterBase.cpp index f677215a..147ee9c0 100644 --- a/src/WriterBase.cpp +++ b/src/WriterBase.cpp @@ -139,7 +139,7 @@ void WriterBase::DisplayInfo() { } // Generate JSON string of this object -string WriterBase::Json() { +std::string WriterBase::Json() { // Return formatted string return JsonValue().toStyledString(); @@ -154,7 +154,7 @@ Json::Value WriterBase::JsonValue() { root["has_audio"] = info.has_audio; root["has_single_image"] = info.has_single_image; root["duration"] = info.duration; - stringstream filesize_stream; + std::stringstream filesize_stream; filesize_stream << info.file_size; root["file_size"] = filesize_stream.str(); root["height"] = info.height; @@ -171,7 +171,7 @@ Json::Value WriterBase::JsonValue() { root["display_ratio"]["num"] = info.display_ratio.num; root["display_ratio"]["den"] = info.display_ratio.den; root["vcodec"] = info.vcodec; - stringstream video_length_stream; + std::stringstream video_length_stream; video_length_stream << info.video_length; root["video_length"] = video_length_stream.str(); root["video_stream_index"] = info.video_stream_index; @@ -195,14 +195,14 @@ Json::Value WriterBase::JsonValue() { } // Load JSON string into this object -void WriterBase::SetJson(string value) { +void WriterBase::SetJson(std::string value) { // Parse JSON string into JSON objects Json::Value root; Json::CharReaderBuilder rbuilder; Json::CharReader* reader(rbuilder.newCharReader()); - string errors; + std::string errors; bool success = reader->parse( value.c_str(), value.c_str() + value.size(), &root, &errors ); delete reader;