Merge pull request #419 from fryshorts/deb7-compat

linux-v4l2: Build fixes for older versions
master
Jim 2015-04-22 18:50:50 -07:00
commit 1f3b7476c0
2 changed files with 26 additions and 0 deletions

View File

@ -240,6 +240,12 @@ int_fast32_t v4l2_set_standard(int_fast32_t dev, int *standard)
int_fast32_t v4l2_enum_dv_timing(int_fast32_t dev, struct v4l2_dv_timings *dvt,
int index)
{
#ifndef VIDIOC_ENUM_DV_TIMINGS
UNUSED_PARAMETER(dev);
UNUSED_PARAMETER(dvt);
UNUSED_PARAMETER(index);
return -1;
#else
if (!dev || !dvt)
return -1;
@ -253,6 +259,7 @@ int_fast32_t v4l2_enum_dv_timing(int_fast32_t dev, struct v4l2_dv_timings *dvt,
memcpy(dvt, &iter.timings, sizeof(struct v4l2_dv_timings));
return 0;
#endif
}
int_fast32_t v4l2_set_dv_timing(int_fast32_t dev, int *timing)

View File

@ -41,6 +41,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "v4l2-udev.h"
#endif
/* The new dv timing api was introduced in Linux 3.4
* Currently we simply disable dv timings when this is not defined */
#ifndef VIDIOC_ENUM_DV_TIMINGS
#define V4L2_IN_CAP_DV_TIMINGS 0
#endif
#define V4L2_DATA(voidptr) struct v4l2_data *data = voidptr;
#define timeval2ns(tv) \
@ -298,9 +304,14 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
continue;
}
#ifndef V4L2_CAP_DEVICE_CAPS
caps = video_cap.capabilities;
#else
/* ... since Linux 3.3 */
caps = (video_cap.capabilities & V4L2_CAP_DEVICE_CAPS)
? video_cap.device_caps
: video_cap.capabilities;
#endif
if (!(caps & V4L2_CAP_VIDEO_CAPTURE)) {
blog(LOG_INFO, "%s seems to not support video capture",
@ -924,6 +935,14 @@ static void *v4l2_create(obs_data_t *settings, obs_source_t *source)
data->dev = -1;
data->source = source;
/* Bitch about build problems ... */
#ifndef V4L2_CAP_DEVICE_CAPS
blog(LOG_WARNING, "Plugin built without device caps support!");
#endif
#ifndef VIDIOC_ENUM_DV_TIMINGS
blog(LOG_WARNING, "Plugin built without dv-timing support!");
#endif
v4l2_update(data, settings);
#if HAVE_UDEV