diff --git a/include/Frame.h b/include/Frame.h index 7e7866c07..8987dcb40 100644 --- a/include/Frame.h +++ b/include/Frame.h @@ -73,17 +73,17 @@ namespace openshot * There are many ways to create an instance of an openshot::Frame: * @code * - * // Most basic: a blank frame (300x200 blank image, 48kHz audio silence) + * // Most basic: a blank frame (all default values) * Frame(); * - * // Image only settings (48kHz audio silence) + * // Image only settings * Frame(1, // Frame number * 720, // Width of image * 480, // Height of image * "#000000" // HTML color code of background color * ); * - * // Audio only (300x200 blank image) + * // Audio only * Frame(number, // Frame number * 44100, // Sample rate of audio stream * 2 // Number of audio channels @@ -131,13 +131,13 @@ namespace openshot bool has_image_data; ///< This frame has been loaded with pixel data - /// Constructor - blank frame (300x200 blank image, 48kHz audio silence) + /// Constructor - blank frame Frame(); - /// Constructor - image only (48kHz audio silence) + /// Constructor - image only Frame(int64_t number, int width, int height, std::string color); - /// Constructor - audio only (300x200 blank image) + /// Constructor - audio only Frame(int64_t number, int samples, int channels); /// Constructor - image & audio diff --git a/src/Frame.cpp b/src/Frame.cpp index 16f420bc8..54901cc56 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -33,41 +33,35 @@ using namespace std; using namespace openshot; -// Constructor - blank frame (300x200 blank image, 48kHz audio silence) +// Constructor - blank frame Frame::Frame() : number(1), pixel_ratio(1,1), channels(2), width(1), height(1), color("#000000"), channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false), max_audio_sample(0) { - // Init the image magic and audio buffer + // Allocate and zero (fill with silence) the audio buffer audio = std::make_shared(channels, 0); - - // initialize the audio samples to zero (silence) audio->clear(); } -// Constructor - image only (48kHz audio silence) +// Constructor - image only Frame::Frame(int64_t number, int width, int height, std::string color) : number(number), pixel_ratio(1,1), channels(2), width(width), height(height), color(color), channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false), max_audio_sample(0) { - // Init the image magic and audio buffer + // Allocate and zero (fill with silence) the audio buffer audio = std::make_shared(channels, 0); - - // initialize the audio samples to zero (silence) audio->clear(); } -// Constructor - audio only (300x200 blank image) +// Constructor - audio only Frame::Frame(int64_t number, int samples, int channels) : number(number), pixel_ratio(1,1), channels(channels), width(1), height(1), color("#000000"), channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false), max_audio_sample(0) { - // Init the image magic and audio buffer + // Allocate and zero (fill with silence) the audio buffer audio = std::make_shared(channels, samples); - - // initialize the audio samples to zero (silence) audio->clear(); } @@ -77,10 +71,8 @@ Frame::Frame(int64_t number, int width, int height, std::string color, int sampl channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false), max_audio_sample(0) { - // Init the image magic and audio buffer + // Allocate and zero (fill with silence) the audio buffer audio = std::make_shared(channels, samples); - - // initialize the audio samples to zero (silence) audio->clear(); }