Added a new ImageWriter class, which specializes in creating images (powered by ImageMagick). This can quickly and easily create animated GIFs with nice color pallets, and a hundred other misc image formats.

This commit is contained in:
Jonathan Thomas
2015-02-05 00:02:59 -06:00
parent a6087dab3a
commit 9afcb67630
4 changed files with 432 additions and 4 deletions

View File

@@ -54,6 +54,7 @@ WriterBase::WriterBase()
info.audio_bit_rate = 0;
info.sample_rate = 0;
info.channels = 0;
info.channel_layout = LAYOUT_MONO;
info.audio_stream_index = -1;
info.audio_timebase = Fraction();
@@ -154,6 +155,7 @@ void WriterBase::CopyReaderInfo(ReaderBase* reader)
info.audio_bit_rate = reader->info.audio_bit_rate;
info.sample_rate = reader->info.sample_rate;
info.channels = reader->info.channels;
info.channel_layout = reader->info.channel_layout;
info.audio_stream_index = reader->info.audio_stream_index;
info.audio_timebase.num = reader->info.audio_timebase.num;
info.audio_timebase.den = reader->info.audio_timebase.den;
@@ -192,6 +194,7 @@ void WriterBase::DisplayInfo() {
cout << "--> Audio Bit Rate: " << info.audio_bit_rate/1000 << " kb/s" << endl;
cout << "--> Sample Rate: " << info.sample_rate << " Hz" << endl;
cout << "--> # of Channels: " << info.channels << endl;
cout << "--> Channel Layout: " << info.channel_layout << endl;
cout << "--> Audio Stream Index: " << info.audio_stream_index << endl;
cout << "--> Audio Timebase: " << info.audio_timebase.ToDouble() << " (" << info.audio_timebase.num << "/" << info.audio_timebase.den << ")" << endl;
cout << "----------------------------" << endl;
@@ -242,6 +245,7 @@ Json::Value WriterBase::JsonValue() {
root["audio_bit_rate"] = info.audio_bit_rate;
root["sample_rate"] = info.sample_rate;
root["channels"] = info.channels;
root["channel_layout"] = info.channel_layout;
root["audio_stream_index"] = info.audio_stream_index;
root["audio_timebase"] = Json::Value(Json::objectValue);
root["audio_timebase"]["num"] = info.audio_timebase.num;
@@ -337,6 +341,8 @@ void WriterBase::SetJsonValue(Json::Value root) {
info.sample_rate = root["sample_rate"].asInt();
if (!root["channels"].isNull())
info.channels = root["channels"].asInt();
if (!root["channel_layout"].isNull())
info.channel_layout = (ChannelLayout) root["channel_layout"].asInt();
if (!root["audio_stream_index"].isNull())
info.audio_stream_index = root["audio_stream_index"].asInt();
if (!root["audio_timebase"].isNull() && root["audio_timebase"].isObject()) {