mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
chore: Make building for FreeBSD easier
Add some patches from https://svnweb.freebsd.org/ports/head/net-im/qTox/ and make some things more platform independent.
This commit is contained in:
parent
c1c4632f5f
commit
8d320ca3be
12
qtox.pro
12
qtox.pro
@ -260,6 +260,18 @@ macx {
|
|||||||
LIBPATH += /usr/local/lib
|
LIBPATH += /usr/local/lib
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unix {
|
||||||
|
target.path = $$PREFIX/bin
|
||||||
|
|
||||||
|
desktop.files = qTox.desktop
|
||||||
|
desktop.path = $$PREFIX/share/applications
|
||||||
|
|
||||||
|
icon.files = img/qtox.png
|
||||||
|
icon.path = $$PREFIX/share/pixmaps
|
||||||
|
|
||||||
|
INSTALLS = target desktop icon
|
||||||
|
}
|
||||||
|
|
||||||
RESOURCES += res.qrc
|
RESOURCES += res.qrc
|
||||||
|
|
||||||
!contains(SMILEYS, NO) {
|
!contains(SMILEYS, NO) {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Most of this file is adapted from libavdevice's v4l2.c,
|
* Most of this file is adapted from libavdevice's v4l2.c,
|
||||||
@ -201,7 +202,7 @@ QString v4l2::getPixelFormatString(uint32_t pixel_format)
|
|||||||
{
|
{
|
||||||
if (pixFmtToName.find(pixel_format) == pixFmtToName.end())
|
if (pixFmtToName.find(pixel_format) == pixFmtToName.end())
|
||||||
{
|
{
|
||||||
printf("BAD!\n");
|
qWarning() << "Pixel format not found";
|
||||||
return QString("unknown");
|
return QString("unknown");
|
||||||
}
|
}
|
||||||
return pixFmtToName.at(pixel_format);
|
return pixFmtToName.at(pixel_format);
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include "video/videomode.h"
|
#include "video/videomode.h"
|
||||||
|
|
||||||
#ifndef Q_OS_LINUX
|
#if !(defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD))
|
||||||
#error "This file is only meant to be compiled for Linux targets"
|
#error "This file is only meant to be compiled for Linux or FreeBSD targets"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace v4l2
|
namespace v4l2
|
||||||
|
@ -31,7 +31,7 @@ extern "C" {
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include "platform/camera/directshow.h"
|
#include "platform/camera/directshow.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
#include "platform/camera/v4l2.h"
|
#include "platform/camera/v4l2.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
@ -150,7 +150,7 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
|
|||||||
|
|
||||||
AVDictionary* options = nullptr;
|
AVDictionary* options = nullptr;
|
||||||
if (!iformat);
|
if (!iformat);
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
else if (devName.startsWith("x11grab#"))
|
else if (devName.startsWith("x11grab#"))
|
||||||
{
|
{
|
||||||
QSize screen;
|
QSize screen;
|
||||||
@ -359,7 +359,7 @@ QVector<QPair<QString, QString>> CameraDevice::getDeviceList()
|
|||||||
else if (iformat->name == QString("dshow"))
|
else if (iformat->name == QString("dshow"))
|
||||||
devices += DirectShow::getDeviceList();
|
devices += DirectShow::getDeviceList();
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
else if (iformat->name == QString("video4linux2,v4l2"))
|
else if (iformat->name == QString("video4linux2,v4l2"))
|
||||||
devices += v4l2::getDeviceList();
|
devices += v4l2::getDeviceList();
|
||||||
#endif
|
#endif
|
||||||
@ -467,7 +467,7 @@ QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
|
|||||||
else if (iformat->name == QString("dshow"))
|
else if (iformat->name == QString("dshow"))
|
||||||
return DirectShow::getDeviceModes(devName);
|
return DirectShow::getDeviceModes(devName);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
else if (iformat->name == QString("video4linux2,v4l2"))
|
else if (iformat->name == QString("video4linux2,v4l2"))
|
||||||
return v4l2::getDeviceModes(devName);
|
return v4l2::getDeviceModes(devName);
|
||||||
#endif
|
#endif
|
||||||
@ -488,7 +488,7 @@ QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
|
|||||||
*/
|
*/
|
||||||
QString CameraDevice::getPixelFormatString(uint32_t pixel_format)
|
QString CameraDevice::getPixelFormatString(uint32_t pixel_format)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
return v4l2::getPixelFormatString(pixel_format);
|
return v4l2::getPixelFormatString(pixel_format);
|
||||||
#else
|
#else
|
||||||
return QString("unknown");
|
return QString("unknown");
|
||||||
@ -504,7 +504,7 @@ QString CameraDevice::getPixelFormatString(uint32_t pixel_format)
|
|||||||
*/
|
*/
|
||||||
bool CameraDevice::betterPixelFormat(uint32_t a, uint32_t b)
|
bool CameraDevice::betterPixelFormat(uint32_t a, uint32_t b)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
return v4l2::betterPixelFormat(a, b);
|
return v4l2::betterPixelFormat(a, b);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
@ -524,7 +524,7 @@ bool CameraDevice::getDefaultInputFormat()
|
|||||||
avdevice_register_all();
|
avdevice_register_all();
|
||||||
|
|
||||||
// Desktop capture input formats
|
// Desktop capture input formats
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
idesktopFormat = av_find_input_format("x11grab");
|
idesktopFormat = av_find_input_format("x11grab");
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -532,7 +532,7 @@ bool CameraDevice::getDefaultInputFormat()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Webcam input formats
|
// Webcam input formats
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||||
if ((iformat = av_find_input_format("v4l2")))
|
if ((iformat = av_find_input_format("v4l2")))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Copyright © 2016 Zetok Zalbavar <zetok@openmailbox.org>
|
# Copyright © 2016 Zetok Zalbavar <zetok@openmailbox.org>
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user