MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / JsonValue

Method JsonValue

src/WriterBase.cpp:139–185  ·  view source on GitHub ↗

Generate Json::Value for this object

Source from the content-addressed store, hash-verified

137
138// Generate Json::Value for this object
139Json::Value WriterBase::JsonValue() const {
140
141 // Create root json object
142 Json::Value root;
143 root["has_video"] = info.has_video;
144 root["has_audio"] = info.has_audio;
145 root["has_single_image"] = info.has_single_image;
146 root["duration"] = info.duration;
147 std::stringstream filesize_stream;
148 filesize_stream << info.file_size;
149 root["file_size"] = filesize_stream.str();
150 root["height"] = info.height;
151 root["width"] = info.width;
152 root["pixel_format"] = info.pixel_format;
153 root["fps"] = Json::Value(Json::objectValue);
154 root["fps"]["num"] = info.fps.num;
155 root["fps"]["den"] = info.fps.den;
156 root["video_bit_rate"] = info.video_bit_rate;
157 root["pixel_ratio"] = Json::Value(Json::objectValue);
158 root["pixel_ratio"]["num"] = info.pixel_ratio.num;
159 root["pixel_ratio"]["den"] = info.pixel_ratio.den;
160 root["display_ratio"] = Json::Value(Json::objectValue);
161 root["display_ratio"]["num"] = info.display_ratio.num;
162 root["display_ratio"]["den"] = info.display_ratio.den;
163 root["vcodec"] = info.vcodec;
164 std::stringstream video_length_stream;
165 video_length_stream << info.video_length;
166 root["video_length"] = video_length_stream.str();
167 root["video_stream_index"] = info.video_stream_index;
168 root["video_timebase"] = Json::Value(Json::objectValue);
169 root["video_timebase"]["num"] = info.video_timebase.num;
170 root["video_timebase"]["den"] = info.video_timebase.den;
171 root["interlaced_frame"] = info.interlaced_frame;
172 root["top_field_first"] = info.top_field_first;
173 root["acodec"] = info.acodec;
174 root["audio_bit_rate"] = info.audio_bit_rate;
175 root["sample_rate"] = info.sample_rate;
176 root["channels"] = info.channels;
177 root["channel_layout"] = info.channel_layout;
178 root["audio_stream_index"] = info.audio_stream_index;
179 root["audio_timebase"] = Json::Value(Json::objectValue);
180 root["audio_timebase"]["num"] = info.audio_timebase.num;
181 root["audio_timebase"]["den"] = info.audio_timebase.den;
182
183 // return JsonValue
184 return root;
185}
186
187// Load JSON string into this object
188void WriterBase::SetJson(const std::string value) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected