2015-07-10 23:42:45 +02:00
|
|
|
/* video_device.h
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Toxic All Rights Reserved.
|
|
|
|
*
|
|
|
|
* This file is part of Toxic.
|
|
|
|
*
|
|
|
|
* Toxic is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Toxic is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Toxic. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
2015-07-11 03:54:06 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VIDEO_DEVICE_H
|
|
|
|
#define VIDEO_DEVICE_H
|
|
|
|
|
|
|
|
#define MAX_DEVICES 32
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "windows.h"
|
|
|
|
|
|
|
|
typedef enum VideoDeviceType {
|
2015-07-24 20:10:13 +02:00
|
|
|
vdt_input,
|
|
|
|
vdt_output,
|
2015-07-11 03:54:06 +02:00
|
|
|
} VideoDeviceType;
|
|
|
|
|
|
|
|
typedef enum VideoDeviceError {
|
|
|
|
vde_None,
|
|
|
|
vde_InternalError = -1,
|
|
|
|
vde_InvalidSelection = -2,
|
|
|
|
vde_FailedStart = -3,
|
|
|
|
vde_Busy = -4,
|
|
|
|
vde_AllDevicesBusy = -5,
|
|
|
|
vde_DeviceNotActive = -6,
|
|
|
|
vde_BufferError = -7,
|
|
|
|
vde_UnsupportedMode = -8,
|
|
|
|
vde_CaptureError = -9,
|
|
|
|
} VideoDeviceError;
|
|
|
|
|
2018-07-18 17:33:16 +02:00
|
|
|
typedef void (*VideoDataHandleCallback)(int16_t width, int16_t height, const uint8_t *y, const uint8_t *u,
|
|
|
|
const uint8_t *v, void *data);
|
2015-07-11 03:54:06 +02:00
|
|
|
|
|
|
|
#ifdef VIDEO
|
2016-09-25 03:07:04 +02:00
|
|
|
VideoDeviceError init_video_devices(ToxAV *av);
|
2015-07-11 03:54:06 +02:00
|
|
|
#else
|
2018-09-14 01:47:47 +02:00
|
|
|
VideoDeviceError init_video_devices(void);
|
2015-07-11 03:54:06 +02:00
|
|
|
#endif /* VIDEO */
|
|
|
|
|
2018-09-14 01:47:47 +02:00
|
|
|
VideoDeviceError terminate_video_devices(void);
|
2015-07-11 03:54:06 +02:00
|
|
|
|
|
|
|
/* Callback handles ready data from INPUT device */
|
2016-09-25 03:07:04 +02:00
|
|
|
VideoDeviceError register_video_device_callback(int32_t call_idx, uint32_t device_idx, VideoDataHandleCallback callback,
|
|
|
|
void *data);
|
|
|
|
void *get_video_device_callback_data(uint32_t device_idx);
|
2015-07-11 03:54:06 +02:00
|
|
|
|
|
|
|
VideoDeviceError set_primary_video_device(VideoDeviceType type, int32_t selection);
|
2016-09-25 03:07:04 +02:00
|
|
|
VideoDeviceError open_primary_video_device(VideoDeviceType type, uint32_t *device_idx);
|
2015-07-11 03:54:06 +02:00
|
|
|
/* Start device */
|
2016-09-25 03:07:04 +02:00
|
|
|
VideoDeviceError open_video_device(VideoDeviceType type, int32_t selection, uint32_t *device_idx);
|
2015-07-11 03:54:06 +02:00
|
|
|
/* Stop device */
|
|
|
|
VideoDeviceError close_video_device(VideoDeviceType type, uint32_t device_idx);
|
|
|
|
|
|
|
|
/* Write data to device */
|
2016-09-25 03:07:04 +02:00
|
|
|
VideoDeviceError write_video_out(uint16_t width, uint16_t height, uint8_t const *y, uint8_t const *u, uint8_t const *v,
|
|
|
|
int32_t ystride, int32_t ustride, int32_t vstride, void *user_data);
|
2015-07-11 03:54:06 +02:00
|
|
|
|
2016-09-25 03:07:04 +02:00
|
|
|
void print_video_devices(ToxWindow *self, VideoDeviceType type);
|
2015-07-19 16:51:35 +02:00
|
|
|
void get_primary_video_device_name(VideoDeviceType type, char *buf, int size);
|
2015-07-11 03:54:06 +02:00
|
|
|
|
2015-07-24 20:10:13 +02:00
|
|
|
VideoDeviceError video_selection_valid(VideoDeviceType type, int32_t selection);
|
2018-09-14 01:47:47 +02:00
|
|
|
#endif /* VIDEO_DEVICE_H */
|