#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
+ImageInput::ImageInput()
+ : sRGBSwitchingFlatInput({movit::COLORSPACE_sRGB, movit::GAMMA_sRGB}, movit::FORMAT_RGBA_POSTMULTIPLIED_ALPHA,
+ GL_UNSIGNED_BYTE, 1280, 720) // Resolution will be overwritten.
+{}
+
ImageInput::ImageInput(const string &filename)
: sRGBSwitchingFlatInput({movit::COLORSPACE_sRGB, movit::GAMMA_sRGB}, movit::FORMAT_RGBA_POSTMULTIPLIED_ALPHA,
GL_UNSIGNED_BYTE, 1280, 720), // Resolution will be overwritten.
ImageInput::ImageInput(const string &filename)
: sRGBSwitchingFlatInput({movit::COLORSPACE_sRGB, movit::GAMMA_sRGB}, movit::FORMAT_RGBA_POSTMULTIPLIED_ALPHA,
GL_UNSIGNED_BYTE, 1280, 720), // Resolution will be overwritten.
// is mostly there to save startup time, not RAM).
{
lock_guard<mutex> lock(all_images_lock);
// is mostly there to save startup time, not RAM).
{
lock_guard<mutex> lock(all_images_lock);
if (all_images[pathname] != current_image) {
current_image = all_images[pathname];
set_texture_num(*current_image->tex);
if (all_images[pathname] != current_image) {
current_image = all_images[pathname];
set_texture_num(*current_image->tex);
- AVPacket pkt;
- unique_ptr<AVPacket, decltype(av_packet_unref)*> pkt_cleanup(
- &pkt, av_packet_unref);
- av_init_packet(&pkt);
- pkt.data = nullptr;
- pkt.size = 0;
- if (av_read_frame(format_ctx.get(), &pkt) == 0) {
- if (pkt.stream_index != stream_index) {
+ AVPacketWithDeleter pkt = av_packet_alloc_unique();
+ pkt->data = nullptr;
+ pkt->size = 0;
+ if (av_read_frame(format_ctx.get(), pkt.get()) == 0) {
+ if (pkt->stream_index != stream_index) {
- shared_ptr<Image> image(new Image{unsigned(frame->width), unsigned(frame->height), RefCountedTexture(new GLuint(tex)), last_modified});
+ shared_ptr<Image> image(new Image{unsigned(frame->width), unsigned(frame->height), UniqueTexture(new GLuint(tex)), last_modified});
void ImageInput::start_update_thread(QSurface *surface)
{
update_thread = thread(update_thread_func, surface);
void ImageInput::start_update_thread(QSurface *surface)
{
update_thread = thread(update_thread_func, surface);