X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fmjpeg_encoder.cpp;h=a526c1e1e875c2e53cedece541a9020cd473625d;hb=b22b0f8e945c5a0b9e738eb982b61aa70b88ed1d;hp=26eb9a868f70ddeb6bbf23349318f7435d73565e;hpb=8850f9468d6a1727e7be302d2a9b4360f69210cc;p=nageru diff --git a/nageru/mjpeg_encoder.cpp b/nageru/mjpeg_encoder.cpp index 26eb9a8..a526c1e 100644 --- a/nageru/mjpeg_encoder.cpp +++ b/nageru/mjpeg_encoder.cpp @@ -10,6 +10,7 @@ extern "C" { #include +#include } #include "defs.h" @@ -190,8 +191,9 @@ void add_audio_stream(AVFormatContext *avctx) stream->time_base = AVRational{ 1, OUTPUT_FREQUENCY }; stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; stream->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE; - stream->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; - stream->codecpar->channels = 2; + stream->codecpar->ch_layout.order = AV_CHANNEL_ORDER_NATIVE; + stream->codecpar->ch_layout.nb_channels = 2; + stream->codecpar->ch_layout.u.mask = AV_CH_LAYOUT_STEREO; stream->codecpar->sample_rate = OUTPUT_FREQUENCY; } @@ -234,10 +236,9 @@ MJPEGEncoder::MJPEGEncoder(HTTPD *httpd, const string &va_display) fprintf(stderr, "Could not initialize VA-API for MJPEG encoding: %s. JPEGs will be encoded in software if needed.\n", error.c_str()); } - va_pool.reset(new VAResourcePool(va_dpy->va_dpy, uyvy_format, nv12_format, config_id_422, config_id_420, /*with_data_buffer=*/true)); - encoder_thread = thread(&MJPEGEncoder::encoder_thread_func, this); if (va_dpy != nullptr) { + va_pool.reset(new VAResourcePool(va_dpy->va_dpy, uyvy_format, nv12_format, config_id_422, config_id_420, /*with_data_buffer=*/true)); va_receiver_thread = thread(&MJPEGEncoder::va_receiver_thread_func, this); }