// 576p60/720p60/1080i60 works, 1080p60 does not work (firmware limitation)
// Audio comes out as 8-channel 24-bit raw audio.
+#include <assert.h>
+#include <errno.h>
+#include <libusb.h>
+#include <netinet/in.h>
+#include <sched.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <libusb.h>
-#include <arpa/inet.h>
-#include <unistd.h>
#include <string.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <assert.h>
#ifdef __SSE2__
#include <immintrin.h>
#endif
+#include "bmusb.h"
+
#include <algorithm>
+#include <atomic>
+#include <condition_variable>
+#include <cstddef>
+#include <cstdint>
+#include <deque>
#include <functional>
#include <memory>
-#include <deque>
-#include <utility>
#include <mutex>
-#include <condition_variable>
-#include <thread>
#include <stack>
-#include <atomic>
-#include "bmusb.h"
+#include <thread>
using namespace std;
using namespace std::placeholders;
#include <functional>
#include <mutex>
#include <thread>
+#include <vector>
+
+struct libusb_transfer;
// An interface for frame allocators; if you do not specify one
// (using set_video_frame_allocator), a default one that pre-allocates
#include <stdio.h>
-#include <stdlib.h>
-#include <QOpenGLContext>
+#include <QGL>
#include <QOffscreenSurface>
-#include <QWindow>
-#include <QGLWidget>
+#include <QOpenGLContext>
+#include <QSurfaceFormat>
+
+class QSurface;
QGLWidget *global_share_widget = nullptr;
-#include <qmetatype.h>
-#include <qdatastream.h>
-#include <qtextstream.h>
-#include <qcursor.h>
-#include <qcoreevent.h>
+#include <qmetatype.h> // Needs to come before egl.h.
+#include <qdatastream.h> // Needs to come before egl.h.
+#include <qtextstream.h> // Needs to come before egl.h.
+#include <qcursor.h> // Needs to come before egl.h.
+#include <qcoreevent.h> // Needs to come before egl.h.
#include <epoxy/gl.h>
#include <epoxy/egl.h>
-#include "context.h"
+#include <QSurfaceFormat>
+
#include "glwidget.h"
-#include "mixer.h"
-#include <QCoreApplication>
-#include <QGuiApplication>
-#include <QThread>
-#include <math.h>
-#include <thread>
+
#include <movit/resource_pool.h>
+#include <stdio.h>
+
+#include "context.h"
+#include "mixer.h"
+#include "ref_counted_gl_sync.h"
+
+class QSurface;
+class QWidget;
+
#undef Success
#include <movit/util.h>
+#include <string>
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(parent, global_share_widget),
#ifndef GLWIDGET_H
#define GLWIDGET_H
+#include <epoxy/gl.h>
#include <QGLWidget>
+class QWidget;
+
namespace movit {
class ResourcePool;
}
//#include "sysdeps.h"
+#include "h264encode.h"
+
+#include <EGL/eglplatform.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <assert.h>
+#include <epoxy/egl.h>
+#include <libavcodec/avcodec.h>
+#include <libavformat/avio.h>
+#include <libavutil/mathematics.h>
+#include <libavutil/rational.h>
+#include <libdrm/drm_fourcc.h>
+#include <stdint.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <getopt.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <pthread.h>
-#include <errno.h>
-#include <math.h>
+#include <string.h>
#include <va/va.h>
-#include <va/va_x11.h>
-#include <va/va_enc_h264.h>
#include <va/va_drmcommon.h>
-#include <libdrm/drm_fourcc.h>
-#include <thread>
+#include <va/va_enc_h264.h>
+#include <va/va_x11.h>
+#include <condition_variable>
#include <mutex>
#include <queue>
-#include <condition_variable>
-#include "h264encode.h"
+#include <string>
+#include <thread>
+
+#include "context.h"
+
+class QOpenGLContext;
+class QSurface;
#define CHECK_VASTATUS(va_status, func) \
if (va_status != VA_STATUS_SUCCESS) { \
extern "C" {
#include <libavformat/avformat.h>
}
-#include <epoxy/egl.h>
+#include <epoxy/gl.h>
#include <atomic>
+#include <condition_variable>
#include <map>
#include <memory>
#include <mutex>
+#include <queue>
#include <thread>
-#include <condition_variable>
+#include <vector>
-#include "pbo_frame_allocator.h"
+#include "bmusb.h"
#include "context.h"
+#include "pbo_frame_allocator.h"
#include "ref_counted_gl_sync.h"
+class QSurface;
+
#define SURFACE_NUM 16 /* 16 surfaces for source YUV */
class H264Encoder {
+#include <stdlib.h>
#include <epoxy/gl.h>
+
#include <QApplication>
-#include <QDesktopWidget>
+#include <QCoreApplication>
+#include <QGL>
+#include <QSize>
#include <QSurfaceFormat>
-#include <QtGui/QOpenGLContext>
-#include <QGLFormat>
+#include "context.h"
#include "mainwindow.h"
#include "mixer.h"
-#include "context.h"
int main(int argc, char *argv[])
{
#define WIDTH 1280
#define HEIGHT 720
-#include <epoxy/gl.h>
-#include <epoxy/egl.h>
-
#undef Success
-#include <assert.h>
-#include <features.h>
-#include <math.h>
-#include <png.h>
-#include <pngconf.h>
-#include <setjmp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-#include <mutex>
-#include <queue>
-#include <condition_variable>
+#include "mixer.h"
-#include <diffusion_effect.h>
+#include <assert.h>
#include <effect.h>
#include <effect_chain.h>
-#include <flat_input.h>
+#include <effect_util.h>
+#include <epoxy/egl.h>
+#include <features.h>
#include <image_format.h>
#include <init.h>
-#include <lift_gamma_gain_effect.h>
-#include <saturation_effect.h>
-#include <util.h>
-#include <ycbcr_input.h>
-#include <vignette_effect.h>
-#include <resample_effect.h>
-#include <resize_effect.h>
#include <overlay_effect.h>
#include <padding_effect.h>
+#include <resample_effect.h>
+#include <resource_pool.h>
+#include <saturation_effect.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include <util.h>
#include <white_balance_effect.h>
#include <ycbcr.h>
-#include <resource_pool.h>
-#include <effect_util.h>
-
-#include <EGL/egl.h>
+#include <ycbcr_input.h>
+#include <cmath>
+#include <condition_variable>
+#include <cstddef>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <thread>
+#include <vector>
-#include "h264encode.h"
-#include "context.h"
#include "bmusb.h"
+#include "context.h"
+#include "h264encode.h"
#include "pbo_frame_allocator.h"
-#include "mixer.h"
#include "ref_counted_gl_sync.h"
+class QOpenGLContext;
+
using namespace movit;
using namespace std;
using namespace std::placeholders;
#ifndef _MIXER_H
#define _MIXER_H 1
+#include <epoxy/gl.h>
+#include <functional>
+
#include "ref_counted_gl_sync.h"
class QSurface;
+
void start_mixer(QSurface *surface, QSurface *surface2, QSurface *surface3, QSurface *surface4);
void mixer_quit();
#include "pbo_frame_allocator.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <cstddef>
+
#include "util.h"
using namespace std;
#ifndef _PBO_FRAME_ALLOCATOR
#define _PBO_FRAME_ALLOCATOR 1
+#include <epoxy/gl.h>
#include <mutex>
#include <queue>
-#include <epoxy/gl.h>
#include "bmusb.h"
-#include "glwidget.h"
#include "window.h"
-#include "mainwindow.h"
-#include <QApplication>
+
#include <QBoxLayout>
+#include <QString>
+
+#include "glwidget.h"
Window::Window(MainWindow *mw)
: main_window(mw)