1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Have v4l2 read MJPEG video by default

Fixes #2826

Thanks to @seanlaguna for finding a fix
This commit is contained in:
tux3 2016-01-19 23:49:42 +01:00
parent f79bb24024
commit aef447d7c7
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 17 additions and 0 deletions

View File

@ -164,6 +164,7 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
{
av_dict_set(&options, "video_size", QString("%1x%2").arg(mode.width).arg(mode.height).toStdString().c_str(), 0);
av_dict_set(&options, "framerate", QString().setNum(mode.FPS).toStdString().c_str(), 0);
av_dict_set(&options, "pixel_format", "mjpeg", 0);
}
#endif
#ifdef Q_OS_OSX

View File

@ -32,6 +32,22 @@ VideoFrame::VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function<void
frameOther{nullptr}, frameYUV420{nullptr}, frameRGB24{nullptr},
width{w}, height{h}, pixFmt{fmt}
{
// Silences pointless swscale warning spam
// See libswscale/utils.c:1153 @ 74f0bd3
frame->color_range = AVCOL_RANGE_MPEG;
if (pixFmt == AV_PIX_FMT_YUVJ420P)
pixFmt = AV_PIX_FMT_YUV420P;
else if (pixFmt == AV_PIX_FMT_YUVJ411P)
pixFmt = AV_PIX_FMT_YUV411P;
else if (pixFmt == AV_PIX_FMT_YUVJ422P)
pixFmt = AV_PIX_FMT_YUV422P;
else if (pixFmt == AV_PIX_FMT_YUVJ444P)
pixFmt = AV_PIX_FMT_YUV444P;
else if (pixFmt == AV_PIX_FMT_YUVJ440P)
pixFmt = AV_PIX_FMT_YUV440P;
else
frame->color_range = AVCOL_RANGE_UNSPECIFIED;
if (pixFmt == AV_PIX_FMT_YUV420P)
frameYUV420 = frame;
else if (pixFmt == AV_PIX_FMT_RGB24)