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:
parent
f79bb24024
commit
aef447d7c7
|
@ -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, "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, "framerate", QString().setNum(mode.FPS).toStdString().c_str(), 0);
|
||||||
|
av_dict_set(&options, "pixel_format", "mjpeg", 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
|
|
|
@ -32,6 +32,22 @@ VideoFrame::VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function<void
|
||||||
frameOther{nullptr}, frameYUV420{nullptr}, frameRGB24{nullptr},
|
frameOther{nullptr}, frameYUV420{nullptr}, frameRGB24{nullptr},
|
||||||
width{w}, height{h}, pixFmt{fmt}
|
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)
|
if (pixFmt == AV_PIX_FMT_YUV420P)
|
||||||
frameYUV420 = frame;
|
frameYUV420 = frame;
|
||||||
else if (pixFmt == AV_PIX_FMT_RGB24)
|
else if (pixFmt == AV_PIX_FMT_RGB24)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user