Commit 977fb50d authored by Sébastien Gonzalve's avatar Sébastien Gonzalve Committed by Arjan Spieard

Make ffmpeg private in video.cc

parent 818c2ed5
......@@ -9,7 +9,7 @@
#include "video.hh"
#include "playlist.hh"
#include "menu.hh"
#include <aubio/fvec.h>
#include "aubio/aubio.h"
class Audio;
class Database;
......
#include "video.hh"
#include "ffmpeg.hh"
#include "util.hh"
#include <cmath>
......@@ -44,9 +45,10 @@ Video::~Video() {
m_grabber.get();
}
Video::Video(fs::path const& _videoFile, double videoGap): m_mpeg(_videoFile, 0, nullptr, [this] (auto f) { push(std::move(f)); }), m_videoGap(videoGap), m_textureTime(), m_alpha(-0.5, 1.5) {
Video::Video(fs::path const& _videoFile, double videoGap): m_videoGap(videoGap), m_textureTime(), m_alpha(-0.5, 1.5) {
m_grabber = std::async(std::launch::async, [this, file = _videoFile] {
auto ffmpeg = std::make_unique<FFmpeg>(_videoFile, 0, nullptr, [this] (auto f) { push(std::move(f)); });
m_grabber = std::async(std::launch::async, [this, file = _videoFile, ffmpeg = std::move(ffmpeg)] {
int errors = 0;
std::unique_lock<std::mutex> l(m_mutex);
while (!m_quit) {
......@@ -58,12 +60,12 @@ Video::Video(fs::path const& _videoFile, double videoGap): m_mpeg(_videoFile, 0,
// discard all outdated frame. Do it here to avoid races between clean and push, because push are done in this thread.
m_queue.clear();
l.unlock();
m_mpeg.seek(std::max(0.0, seek_pos - 5.0)); // -5 to workaround ffmpeg inaccurate seeking
ffmpeg->seek(std::max(0.0, seek_pos - 5.0)); // -5 to workaround ffmpeg inaccurate seeking
}
else l.unlock();
try {
m_mpeg.handleOneFrame();
ffmpeg->handleOneFrame();
} catch (FFmpeg::eof_error&) {
push(Bitmap()); // EOF marker
std::clog << "ffmpeg/debug: done loading " << file << std::endl;
......
......@@ -2,7 +2,7 @@
#include "animvalue.hh"
#include "texture.hh"
#include "ffmpeg.hh"
#include <deque>
#include <future>
#include <string>
......@@ -18,7 +18,6 @@ class Video {
Dimensions const& dimensions() const { return m_texture.dimensions; }
private:
FFmpeg m_mpeg;
const double m_videoGap;
Bitmap m_videoFrame;
Texture m_texture;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment