OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
wxMediaCtrl3.cpp File Reference
#include "wxMediaCtrl3.h"
#include "AVVideoDecoder.hpp"
#include <algorithm>
#include <boost/log/trivial.hpp>
#include "slic3r/GUI/Printer/BambuTunnel.h"
#include <cassert>
#include <memory>
#include <string>
#include <chrono>
#include <thread>
#include <wx/dcclient.h>
#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include <mutex>
#include <wx/event.h>
#include <wx/uri.h>
#include <wx/gdicmn.h>
#include <wx/mediactrl.h>
#include <wx/string.h>
#include <wx/image.h>
#include <libavformat/avformat.h>
#include <libavutil/log.h>
Include dependency graph for wxMediaCtrl3.cpp:

Go to the source code of this file.

Classes

struct  StaticBambuLib

Functions

 wxDEFINE_EVENT (EVT_MEDIA_CTRL_STAT, wxCommandEvent)
static void adjust_frame_size (wxSize &frame, wxSize const &video, wxSize const &window)
static int ffmpeg_log_level_from_env ()
static void ffmpeg_log_callback (void *avcl, int level, const char *fmt, va_list vl)
static void install_ffmpeg_logger ()

Function Documentation

◆ adjust_frame_size()

void adjust_frame_size ( wxSize & frame,
wxSize const & video,
wxSize const & window )
static
197{
198 if (video.x * window.y < video.y * window.x)
199 frame = { video.x * window.y / video.y, window.y };
200 else
201 frame = { window.x, video.y * window.x / video.x };
202}

Referenced by wxMediaCtrl3::DoSetSize(), wxMediaCtrl3::PlayFfmpeg(), wxMediaCtrl3::PlayThread(), and wxMediaCtrl3::SetExternalFrame().

Here is the caller graph for this function:

◆ ffmpeg_log_callback()

void ffmpeg_log_callback ( void * avcl,
int level,
const char * fmt,
va_list vl )
static
296{
297 if (level > av_log_get_level())
298 return;
299 thread_local int print_prefix = 1;
300 char line[1024];
301 av_log_format_line2(avcl, level, fmt, vl, line, (int) sizeof(line), &print_prefix);
302 size_t len = std::strlen(line);
303 while (len > 0 && (line[len - 1] == '\n' || line[len - 1] == '\r' || line[len - 1] == ' '))
304 line[--len] = '\0';
305 if (len == 0)
306 return;
307 if (level <= AV_LOG_ERROR)
308 BOOST_LOG_TRIVIAL(error) << "ffmpeg: " << line;
309 else if (level <= AV_LOG_WARNING)
310 BOOST_LOG_TRIVIAL(warning) << "ffmpeg: " << line;
311 else if (level <= AV_LOG_INFO)
312 BOOST_LOG_TRIVIAL(info) << "ffmpeg: " << line;
313 else
314 BOOST_LOG_TRIVIAL(debug) << "ffmpeg: " << line;
315}

Referenced by install_ffmpeg_logger().

Here is the caller graph for this function:

◆ ffmpeg_log_level_from_env()

int ffmpeg_log_level_from_env ( )
static
278{
279 const char *env = std::getenv("ORCA_FFMPEG_LOG_LEVEL");
280 if (env == nullptr || *env == '\0')
281 return AV_LOG_VERBOSE;
282 const wxString v = wxString(env).Lower();
283 if (v == "quiet") return AV_LOG_QUIET;
284 if (v == "panic") return AV_LOG_PANIC;
285 if (v == "fatal") return AV_LOG_FATAL;
286 if (v == "error") return AV_LOG_ERROR;
287 if (v == "warning") return AV_LOG_WARNING;
288 if (v == "info") return AV_LOG_INFO;
289 if (v == "verbose") return AV_LOG_VERBOSE;
290 if (v == "debug") return AV_LOG_DEBUG;
291 if (v == "trace") return AV_LOG_TRACE;
292 return AV_LOG_VERBOSE;
293}

Referenced by install_ffmpeg_logger().

Here is the caller graph for this function:

◆ install_ffmpeg_logger()

void install_ffmpeg_logger ( )
static
318{
319 av_log_set_level(ffmpeg_log_level_from_env());
320 av_log_set_callback(&ffmpeg_log_callback);
321}
static void ffmpeg_log_callback(void *avcl, int level, const char *fmt, va_list vl)
Definition wxMediaCtrl3.cpp:295
static int ffmpeg_log_level_from_env()
Definition wxMediaCtrl3.cpp:277

References ffmpeg_log_callback(), and ffmpeg_log_level_from_env().

Referenced by wxMediaCtrl3::PlayFfmpeg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wxDEFINE_EVENT()

wxDEFINE_EVENT ( EVT_MEDIA_CTRL_STAT ,
wxCommandEvent  )

References wxMediaCtrl3::paintEvent().

Here is the call graph for this function: