You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Merge branch 'develop' into std-prefixes
This commit is contained in:
@@ -7,20 +7,22 @@ our support for this in the future!
|
||||
|
||||
The following table summarizes our current level of support:
|
||||
|
||||
| | Linux Decode | Linux Encode | Mac Decode | Mac Encode |Windows Decode| Windows Encode | Notes |
|
||||
|--------------------|------------------------|----------------------|------------------|----------------|--------------|------------------|------------------|
|
||||
| VA-API | :heavy_check_mark: | :heavy_check_mark: | - | - | - | - | *Linux Only* |
|
||||
| VDPAU | :heavy_check_mark:(+) |:white_check_mark:(++)| - | - | - | - | *Linux Only* |
|
||||
| CUDA (NVDEC/NVENC) | :x:(+++) | :heavy_check_mark: | - | - | - |:heavy_check_mark:| *Cross Platform* |
|
||||
| VideoToolBox | - | - |:heavy_check_mark:| :x:(++++) | - | - | *Mac Only* |
|
||||
| DXVA2 | - | - | - | - | :x:(+++) | - | *Windows Only* |
|
||||
| D3D11VA | - | - | - | - | :x:(+++) | - | *Windows Only* |
|
||||
| QSV | :x:(+++) | :x: | :x: | :x: | :x: | :x: | *Cross Platform* |
|
||||
| | Linux Decode | Linux Encode | Mac Decode | Mac Encode | Windows Decode | Windows Encode | Notes |
|
||||
|--------------------|:---------------:|:--------------:|:----------:|:--------------:|:--------------:|:--------------:|------------------|
|
||||
| VA-API | ✔️ | ✔️ | - | - | - | - | *Linux Only* |
|
||||
| VDPAU | ✔️ <sup>1</sup> | ✅ <sup>2</sup> | - | - | - | - | *Linux Only* |
|
||||
| CUDA (NVDEC/NVENC) | ❌ <sup>3</sup> | ✔️ | - | - | - | ✔️ | *Cross Platform* |
|
||||
| VideoToolBox | - | - | ✔️ | ❌ <sup>4</sup> | - | - | *Mac Only* |
|
||||
| DXVA2 | - | - | - | - | ❌ <sup>3</sup> | - | *Windows Only* |
|
||||
| D3D11VA | - | - | - | - | ❌ <sup>3</sup> | - | *Windows Only* |
|
||||
| QSV | ❌ <sup>3</sup> | ❌ | ❌ | ❌ | ❌ | ❌ | *Cross Platform* |
|
||||
|
||||
* *(+) VDPAU for some reason needs a card number one higher than it really is*
|
||||
* *(++) VDPAU is a decoder only.*
|
||||
* *(+++) Green frames (pixel data not correctly tranferred back to system memory)*
|
||||
* *(++++) Crashes and burns*
|
||||
#### Notes
|
||||
|
||||
1. VDPAU for some reason needs a card number one higher than it really is
|
||||
2. VDPAU is a decoder only
|
||||
3. Green frames (pixel data not correctly tranferred back to system memory)
|
||||
4. Crashes and burns
|
||||
|
||||
## Supported FFmpeg Versions
|
||||
|
||||
@@ -37,7 +39,7 @@ included.
|
||||
The following settings are use by libopenshot to enable, disable, and control
|
||||
the various hardware acceleration features.
|
||||
|
||||
```
|
||||
```{cpp}
|
||||
/// Use video codec for faster video decoding (if supported)
|
||||
int HARDWARE_DECODER = 0;
|
||||
|
||||
@@ -76,9 +78,9 @@ in Ubuntu 18.04) for the AppImage to work with hardware acceleration.
|
||||
An AppImage that works on both systems (supporting libva and libva2),
|
||||
might be possible when no libva is included in the AppImage.
|
||||
|
||||
* vaapi is working for intel and AMD
|
||||
* vaapi is working for decode only for nouveau
|
||||
* nVidia driver is working for export only
|
||||
* vaapi is working for intel and AMD
|
||||
* vaapi is working for decode only for nouveau
|
||||
* nVidia driver is working for export only
|
||||
|
||||
## AMD Graphics Cards (RadeonOpenCompute/ROCm)
|
||||
|
||||
|
||||
@@ -105,13 +105,13 @@
|
||||
// Define this for compatibility
|
||||
#ifndef PixelFormat
|
||||
#define PixelFormat AVPixelFormat
|
||||
#endif
|
||||
#endif
|
||||
#ifndef PIX_FMT_RGBA
|
||||
#define PIX_FMT_RGBA AV_PIX_FMT_RGBA
|
||||
#endif
|
||||
#endif
|
||||
#ifndef PIX_FMT_NONE
|
||||
#define PIX_FMT_NONE AV_PIX_FMT_NONE
|
||||
#endif
|
||||
#endif
|
||||
#ifndef PIX_FMT_RGB24
|
||||
#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24
|
||||
#endif
|
||||
@@ -149,11 +149,12 @@
|
||||
#define AV_REGISTER_ALL
|
||||
#define AVCODEC_REGISTER_ALL
|
||||
#define AV_FILENAME url
|
||||
#define AV_SET_FILENAME(oc, f) oc->AV_FILENAME = av_strdup(f)
|
||||
#define MY_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
|
||||
#define AV_ALLOCATE_FRAME() av_frame_alloc()
|
||||
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1)
|
||||
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
|
||||
#define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context)
|
||||
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type
|
||||
@@ -184,11 +185,12 @@
|
||||
#define AV_REGISTER_ALL av_register_all();
|
||||
#define AVCODEC_REGISTER_ALL avcodec_register_all();
|
||||
#define AV_FILENAME filename
|
||||
#define AV_SET_FILENAME(oc, f) snprintf(oc->AV_FILENAME, sizeof(oc->AV_FILENAME), "%s", f)
|
||||
#define MY_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
|
||||
#define AV_ALLOCATE_FRAME() av_frame_alloc()
|
||||
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1)
|
||||
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
|
||||
#define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context)
|
||||
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type
|
||||
@@ -222,11 +224,12 @@
|
||||
#define AV_REGISTER_ALL av_register_all();
|
||||
#define AVCODEC_REGISTER_ALL avcodec_register_all();
|
||||
#define AV_FILENAME filename
|
||||
#define AV_SET_FILENAME(oc, f) snprintf(oc->AV_FILENAME, sizeof(oc->AV_FILENAME), "%s", f)
|
||||
#define MY_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
|
||||
#define AV_ALLOCATE_FRAME() av_frame_alloc()
|
||||
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) avpicture_alloc((AVPicture *) av_frame, pix_fmt, width, height)
|
||||
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
|
||||
#define AV_FREE_CONTEXT(av_context) avcodec_close(av_context)
|
||||
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codec->codec_type
|
||||
@@ -252,6 +255,7 @@
|
||||
#define AV_REGISTER_ALL av_register_all();
|
||||
#define AVCODEC_REGISTER_ALL avcodec_register_all();
|
||||
#define AV_FILENAME filename
|
||||
#define AV_SET_FILENAME(oc, f) snprintf(oc->AV_FILENAME, sizeof(oc->AV_FILENAME), "%s", f)
|
||||
#define MY_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
|
||||
#define AV_ALLOCATE_FRAME() avcodec_alloc_frame()
|
||||
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) avpicture_alloc((AVPicture *) av_frame, pix_fmt, width, height)
|
||||
|
||||
@@ -55,8 +55,7 @@ namespace openshot
|
||||
* @brief This struct contains info about a media file, such as height, width, frames per second, etc...
|
||||
*
|
||||
* Each derived class of ReaderBase is responsible for updating this struct to reflect accurate information
|
||||
* about the streams. Derived classes of ReaderBase should call the InitFileInfo() method to initialize the
|
||||
* default values of this struct.
|
||||
* about the streams.
|
||||
*/
|
||||
struct ReaderInfo
|
||||
{
|
||||
@@ -93,7 +92,7 @@ namespace openshot
|
||||
*
|
||||
* Readers are types of classes that read video, audio, and image files, and
|
||||
* return openshot::Frame objects. The only requirements for a 'reader', are to
|
||||
* derive from this base class, implement the GetFrame method, and call the InitFileInfo() method.
|
||||
* derive from this base class, implement the GetFrame method, and populate ReaderInfo.
|
||||
*/
|
||||
class ReaderBase
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ void AudioReaderSource::GetMoreSamplesFromReader()
|
||||
}
|
||||
|
||||
// Debug
|
||||
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::GetMoreSamplesFromReader", "amount_needed", amount_needed, "amount_remaining", amount_remaining, "", -1, "", -1, "", -1, "", -1);
|
||||
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::GetMoreSamplesFromReader", "amount_needed", amount_needed, "amount_remaining", amount_remaining);
|
||||
|
||||
// Init estimated buffer equal to the current frame position (before getting more samples)
|
||||
estimated_frame = frame_number;
|
||||
@@ -149,7 +149,7 @@ juce::AudioSampleBuffer* AudioReaderSource::reverse_buffer(juce::AudioSampleBuff
|
||||
int channels = buffer->getNumChannels();
|
||||
|
||||
// Debug
|
||||
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::reverse_buffer", "number_of_samples", number_of_samples, "channels", channels, "", -1, "", -1, "", -1, "", -1);
|
||||
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::reverse_buffer", "number_of_samples", number_of_samples, "channels", channels);
|
||||
|
||||
// Reverse array (create new buffer to hold the reversed version)
|
||||
AudioSampleBuffer *reversed = new juce::AudioSampleBuffer(channels, number_of_samples);
|
||||
|
||||
@@ -616,7 +616,7 @@ std::shared_ptr<Frame> Clip::GetOrCreateFrame(int64_t number)
|
||||
|
||||
try {
|
||||
// Debug output
|
||||
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (from reader)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1);
|
||||
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (from reader)", "number", number, "samples_in_frame", samples_in_frame);
|
||||
|
||||
// Attempt to get a frame (but this could fail if a reader has just been closed)
|
||||
new_frame = reader->GetFrame(number);
|
||||
@@ -634,7 +634,7 @@ std::shared_ptr<Frame> Clip::GetOrCreateFrame(int64_t number)
|
||||
}
|
||||
|
||||
// Debug output
|
||||
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (create blank)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1);
|
||||
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (create blank)", "number", number, "samples_in_frame", samples_in_frame);
|
||||
|
||||
// Create blank frame
|
||||
new_frame = std::make_shared<Frame>(number, reader->info.width, reader->info.height, "#000000", samples_in_frame, reader->info.channels);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
using namespace openshot;
|
||||
|
||||
// Initialize the values of the FileInfo struct
|
||||
// Initialize the values of the EffectInfo struct
|
||||
void EffectBase::InitEffectInfo()
|
||||
{
|
||||
// Init clip settings
|
||||
|
||||
@@ -525,9 +525,7 @@ void FFmpegWriter::WriteHeader() {
|
||||
}
|
||||
|
||||
// Force the output filename (which doesn't always happen for some reason)
|
||||
snprintf(oc->AV_FILENAME, sizeof(oc->AV_FILENAME), "%s", path.c_str());
|
||||
|
||||
// Write the stream header, if any
|
||||
AV_SET_FILENAME(oc, path.c_str());
|
||||
|
||||
// Add general metadata (if any)
|
||||
for (std::map<std::string, std::string>::iterator iter = info.metadata.begin(); iter != info.metadata.end(); ++iter) {
|
||||
@@ -543,6 +541,7 @@ void FFmpegWriter::WriteHeader() {
|
||||
if (is_mp4 || is_mov)
|
||||
av_dict_copy(&dict, mux_dict, 0);
|
||||
|
||||
// Write the stream header
|
||||
if (avformat_write_header(oc, &dict) != 0) {
|
||||
throw InvalidFile("Could not write header to file.", path);
|
||||
};
|
||||
@@ -1389,7 +1388,7 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVStream *st) {
|
||||
av_dict_set(&st->metadata, iter->first.c_str(), iter->second.c_str(), 0);
|
||||
}
|
||||
|
||||
ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::open_video", "video_codec->thread_count", video_codec->thread_count, "", -1, "", -1, "", -1, "", -1, "", -1);
|
||||
ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::open_video", "video_codec->thread_count", video_codec->thread_count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -160,6 +160,9 @@ void ZmqLogger::Path(string new_path)
|
||||
|
||||
void ZmqLogger::Close()
|
||||
{
|
||||
// Disable logger as it no longer needed
|
||||
enabled = false;
|
||||
|
||||
// Close file (if already open)
|
||||
if (log_file.is_open())
|
||||
log_file.close();
|
||||
|
||||
@@ -59,7 +59,6 @@ TEST(ReaderBase_Derived_Class)
|
||||
TestReader t1;
|
||||
|
||||
// Check some of the default values of the FileInfo struct on the base class
|
||||
// If InitFileInfo() is not called in the derived class, these checks would fail.
|
||||
CHECK_EQUAL(false, t1.info.has_audio);
|
||||
CHECK_EQUAL(false, t1.info.has_audio);
|
||||
CHECK_CLOSE(0.0f, t1.info.duration, 0.00001);
|
||||
|
||||
Reference in New Issue
Block a user