mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 01:40:28 +00:00
Video capture: pass init structure to driver
This commit is contained in:
@@ -41,7 +41,7 @@ extern struct vidcap_type *(*vidcap_get_device_details_extrn)(int i);
|
||||
extern void (*display_free_devices_extrn)(void);
|
||||
extern vidcap_id_t (*vidcap_get_null_device_id_extrn)();
|
||||
extern display_id_t (*display_get_null_device_id_extrn)();
|
||||
extern int (*vidcap_init_extrn)(vidcap_id_t id, char *fmt, unsigned int flags, struct vidcap **);
|
||||
extern int (*vidcap_init_extrn)(vidcap_id_t id, const struct vidcap_params *, struct vidcap **);
|
||||
extern int (*display_init_extrn)(display_id_t id, char *fmt, unsigned int flags, struct display **);
|
||||
extern int (*vidcap_get_device_count_extrn)(void);
|
||||
extern int (*display_get_device_count_extrn)(void);
|
||||
@@ -49,8 +49,8 @@ extern int (*vidcap_init_devices_extrn)(void);
|
||||
extern int (*display_init_devices_extrn)(void);
|
||||
|
||||
int initialize_video_capture(const char *requested_capture,
|
||||
char *fmt, unsigned int flags,
|
||||
struct vidcap **state)
|
||||
const struct vidcap_params *params,
|
||||
struct vidcap **state)
|
||||
{
|
||||
struct vidcap_type *vt;
|
||||
vidcap_id_t id = 0;
|
||||
@@ -80,7 +80,7 @@ int initialize_video_capture(const char *requested_capture,
|
||||
pthread_mutex_unlock(vidcap_lock);
|
||||
rm_release_shared_lock("VIDCAP_LOCK");
|
||||
|
||||
return vidcap_init_extrn(id, fmt, flags, state);
|
||||
return vidcap_init_extrn(id, params, state);
|
||||
}
|
||||
|
||||
int initialize_video_display(const char *requested_display,
|
||||
|
||||
@@ -60,6 +60,7 @@ extern "C" {
|
||||
struct rtp;
|
||||
struct state_uv;
|
||||
struct video_frame;
|
||||
struct vidcap_params;
|
||||
|
||||
extern int uv_argc;
|
||||
extern char **uv_argv;
|
||||
@@ -95,8 +96,8 @@ int initialize_video_display(const char *requested_display,
|
||||
char *fmt, unsigned int flags,
|
||||
struct display **);
|
||||
int initialize_video_capture(const char *requested_capture,
|
||||
char *fmt, unsigned int flags,
|
||||
struct vidcap **);
|
||||
const struct vidcap_params *params,
|
||||
struct vidcap **);
|
||||
|
||||
void *ultragrid_rtp_receiver_thread(void *arg);
|
||||
void destroy_rtp_devices(struct rtp ** network_devices);
|
||||
|
||||
@@ -1320,7 +1320,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
printf("Display initialized-%s\n", uv->requested_display);
|
||||
|
||||
ret = initialize_video_capture(uv->requested_capture, capture_cfg, vidcap_flags, &uv->capture_device);
|
||||
struct vidcap_params params;
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.fmt = capture_cfg;
|
||||
params.flags = vidcap_flags;
|
||||
ret = initialize_video_capture(uv->requested_capture, ¶ms, &uv->capture_device);
|
||||
if (ret < 0) {
|
||||
printf("Unable to open capture device: %s\n",
|
||||
uv->requested_capture);
|
||||
|
||||
@@ -169,6 +169,8 @@ enum tx_media_type {
|
||||
TX_MEDIA_VIDEO
|
||||
};
|
||||
|
||||
struct vidcap_params;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -87,7 +87,7 @@ void (*vidcap_free_devices_extrn)() = vidcap_free_devices;
|
||||
void (*vidcap_done_extrn)(struct vidcap *) = vidcap_done;
|
||||
vidcap_id_t (*vidcap_get_null_device_id_extrn)(void) = vidcap_get_null_device_id;
|
||||
struct vidcap_type *(*vidcap_get_device_details_extrn)(int index) = vidcap_get_device_details;
|
||||
int (*vidcap_init_extrn)(vidcap_id_t id, char *fmt, unsigned int flags, struct vidcap **) = vidcap_init;
|
||||
int (*vidcap_init_extrn)(vidcap_id_t id, const struct vidcap_params *, struct vidcap **) = vidcap_init;
|
||||
struct video_frame *(*vidcap_grab_extrn)(struct vidcap *state, struct audio_frame **audio) = vidcap_grab;
|
||||
int (*vidcap_get_device_count_extrn)(void) = vidcap_get_device_count;
|
||||
int (*vidcap_init_devices_extrn)(void) = vidcap_init_devices;
|
||||
@@ -116,7 +116,7 @@ struct vidcap_device_api {
|
||||
|
||||
struct vidcap_type *(*func_probe) (void);
|
||||
const char *func_probe_str;
|
||||
void *(*func_init) (char *fmt, unsigned int flags);
|
||||
void *(*func_init) (const struct vidcap_params *param);
|
||||
const char *func_init_str;
|
||||
void (*func_done) (void *state);
|
||||
const char *func_done_str;
|
||||
@@ -126,7 +126,7 @@ struct vidcap_device_api {
|
||||
void *handle; ///< @copydoc decoder_table_t::handle
|
||||
/** @var func_init
|
||||
* @param[in] driver configuration string
|
||||
* @param[in] flags one of @ref vidcap_flags
|
||||
* @param[in] param driver parameters
|
||||
* @retval NULL if initialization failed
|
||||
* @retval &vidcap_init_noerr if initialization succeeded but a state was not returned (eg. help)
|
||||
* @retval other_ptr if initialization succeeded, contains pointer to state
|
||||
@@ -345,7 +345,7 @@ static int vidcap_fill_symbols(struct vidcap_device_api *device)
|
||||
|
||||
device->func_probe = (struct vidcap_type *(*) (void))
|
||||
dlsym(handle, device->func_probe_str);
|
||||
device->func_init = (void *(*) (char *, unsigned int))
|
||||
device->func_init = (void *(*) (const struct vidcap_params *))
|
||||
dlsym(handle, device->func_init_str);
|
||||
device->func_done = (void (*) (void *))
|
||||
dlsym(handle, device->func_done_str);
|
||||
@@ -435,14 +435,13 @@ vidcap_id_t vidcap_get_null_device_id(void)
|
||||
|
||||
/** @brief Initializes video capture
|
||||
* @param[in] id index of selected video capture driver
|
||||
* @param[in] fmt driver options
|
||||
* @param[in] flags one of @ref vidcap_flags
|
||||
* @param[in] param driver parameters
|
||||
* @param[out] state returned state
|
||||
* @retval 0 if initialization was successful
|
||||
* @retval <0 if initialization failed
|
||||
* @retval >0 if initialization was successful but no state was returned (eg. only having shown help).
|
||||
*/
|
||||
int vidcap_init(vidcap_id_t id, char *fmt, unsigned int flags, struct vidcap **state)
|
||||
int vidcap_init(vidcap_id_t id, const struct vidcap_params *param, struct vidcap **state)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
@@ -451,7 +450,7 @@ int vidcap_init(vidcap_id_t id, char *fmt, unsigned int flags, struct vidcap **s
|
||||
struct vidcap *d =
|
||||
(struct vidcap *)malloc(sizeof(struct vidcap));
|
||||
d->magic = VIDCAP_MAGIC;
|
||||
d->state = vidcap_device_table[i].func_init(fmt, flags);
|
||||
d->state = vidcap_device_table[i].func_init(param);
|
||||
d->index = i;
|
||||
if (d->state == NULL) {
|
||||
debug_msg
|
||||
|
||||
@@ -110,6 +110,12 @@ struct vidcap_type {
|
||||
//video_colour_mode_t colour_mode;
|
||||
};
|
||||
|
||||
/** Defines parameters passed to video capture driver. */
|
||||
struct vidcap_params {
|
||||
const char *fmt; ///< driver options
|
||||
unsigned int flags; ///< one of @ref vidcap_flags
|
||||
};
|
||||
|
||||
int vidcap_init_devices(void);
|
||||
void vidcap_free_devices(void);
|
||||
int vidcap_get_device_count(void);
|
||||
@@ -118,7 +124,7 @@ vidcap_id_t vidcap_get_null_device_id(void);
|
||||
|
||||
struct vidcap;
|
||||
|
||||
int vidcap_init(vidcap_id_t id, char *fmt, unsigned int flags, struct vidcap **);
|
||||
int vidcap_init(vidcap_id_t id, const struct vidcap_params *param, struct vidcap **);
|
||||
void vidcap_done(struct vidcap *state);
|
||||
struct video_frame *vidcap_grab(struct vidcap *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -650,7 +650,7 @@ HRESULT GetPinCategory(IPin *pPin, GUID *pPinCategory)
|
||||
return hr;
|
||||
}
|
||||
|
||||
void * vidcap_dshow_init(char *init_fmt, unsigned int flags) {
|
||||
void * vidcap_dshow_init(const struct vidcap_params *params) {
|
||||
struct vidcap_dshow_state *s;
|
||||
HRESULT res;
|
||||
|
||||
@@ -660,7 +660,7 @@ void * vidcap_dshow_init(char *init_fmt, unsigned int flags) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (init_fmt && strcmp(init_fmt, "help") == 0) {
|
||||
if (params->fmt && strcmp(params_fmt, "help") == 0) {
|
||||
show_help(s);
|
||||
cleanup(s);
|
||||
return &vidcap_init_noerr;
|
||||
@@ -670,8 +670,10 @@ void * vidcap_dshow_init(char *init_fmt, unsigned int flags) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (init_fmt != NULL) {
|
||||
if (params->fmt != NULL) {
|
||||
char *init_fmt = strdup(params->fmt);
|
||||
if (!process_args(s, init_fmt)) goto error;
|
||||
free(init_fmt);
|
||||
}
|
||||
|
||||
InitializeConditionVariable(&s->grabWaitCV);
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
DIRECTSHOWGRABBER_API struct vidcap_type * vidcap_dshow_probe(void);
|
||||
DIRECTSHOWGRABBER_API void * vidcap_dshow_init(char *init_fmt, unsigned int flags);
|
||||
DIRECTSHOWGRABBER_API void * vidcap_dshow_init(const struct vidcap_params *params);
|
||||
DIRECTSHOWGRABBER_API void vidcap_dshow_done(void *state);
|
||||
DIRECTSHOWGRABBER_API struct video_frame * vidcap_dshow_grab(void *state, struct audio_frame **audio);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ vidcap_aggregate_probe(void)
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_aggregate_init(char *init_fmt, unsigned int flags)
|
||||
vidcap_aggregate_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_aggregate_state *s;
|
||||
char *save_ptr = NULL;
|
||||
@@ -123,14 +123,14 @@ vidcap_aggregate_init(char *init_fmt, unsigned int flags)
|
||||
s->frames = 0;
|
||||
gettimeofday(&s->t0, NULL);
|
||||
|
||||
if(!init_fmt || strcmp(init_fmt, "help") == 0) {
|
||||
if(!params->fmt || strcmp(params->fmt, "help") == 0) {
|
||||
show_help();
|
||||
return &vidcap_init_noerr;
|
||||
}
|
||||
|
||||
|
||||
s->devices_cnt = 0;
|
||||
tmp = parse_string = strdup(init_fmt);
|
||||
tmp = parse_string = strdup(params->fmt);
|
||||
while(strtok_r(tmp, "#", &save_ptr)) {
|
||||
s->devices_cnt++;
|
||||
tmp = NULL;
|
||||
@@ -139,30 +139,31 @@ vidcap_aggregate_init(char *init_fmt, unsigned int flags)
|
||||
|
||||
s->devices = calloc(1, s->devices_cnt * sizeof(struct vidcap *));
|
||||
i = 0;
|
||||
tmp = parse_string = strdup(init_fmt);
|
||||
tmp = parse_string = strdup(params->fmt);
|
||||
while((item = strtok_r(tmp, "#", &save_ptr))) {
|
||||
struct vidcap_params dev_params;
|
||||
memset(&dev_params, 0, sizeof(dev_params));
|
||||
|
||||
char *device;
|
||||
char *config = strdup(item);
|
||||
char *device_cfg = NULL;
|
||||
unsigned int dev_flags = 0u;
|
||||
device = config;
|
||||
if(strchr(config, ':')) {
|
||||
char *delim = strchr(config, ':');
|
||||
*delim = '\0';
|
||||
device_cfg = delim + 1;
|
||||
dev_params.fmt = delim + 1;
|
||||
}
|
||||
|
||||
if(i == 0) {
|
||||
dev_flags = flags;
|
||||
dev_params.flags = params->flags;
|
||||
} else { // do not grab from second and other devices
|
||||
dev_flags = flags & ~(VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG);
|
||||
dev_params.flags = params->flags & ~(VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG);
|
||||
}
|
||||
|
||||
int ret = initialize_video_capture(device,
|
||||
device_cfg, dev_flags, &s->devices[i]);
|
||||
int ret = initialize_video_capture(device, &dev_params, &s->devices[i]);
|
||||
free(config);
|
||||
if(ret != 0) {
|
||||
fprintf(stderr, "[aggregate] Unable to initialize device %d (%s:%s).\n", i, device, device_cfg);
|
||||
fprintf(stderr, "[aggregate] Unable to initialize device %d (%s:%s).\n",
|
||||
i, device, dev_params.fmt);
|
||||
goto error;
|
||||
}
|
||||
++i;
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define VIDCAP_AGGREGATE_ID 0x34543406
|
||||
|
||||
struct vidcap_type *vidcap_aggregate_probe(void);
|
||||
void *vidcap_aggregate_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_aggregate_init(const struct vidcap_params *params);
|
||||
void vidcap_aggregate_done(void *state);
|
||||
struct video_frame *vidcap_aggregate_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -755,7 +755,7 @@ static void parse_fmt(struct vidcap_bluefish444_state *s, char *fmt) {
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_bluefish444_init(char *init_fmt, unsigned int flags)
|
||||
vidcap_bluefish444_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_bluefish444_state *s;
|
||||
ULONG InputChannels[4] = {
|
||||
@@ -775,7 +775,7 @@ vidcap_bluefish444_init(char *init_fmt, unsigned int flags)
|
||||
EPOCH_DEST_INPUT_MEM_INTERFACE_CHD
|
||||
};
|
||||
|
||||
if(init_fmt && strcmp(init_fmt, "help") == 0) {
|
||||
if(params->fmt && strcmp(params->fmt, "help") == 0) {
|
||||
show_help();
|
||||
return &vidcap_init_noerr;
|
||||
}
|
||||
@@ -796,7 +796,9 @@ vidcap_bluefish444_init(char *init_fmt, unsigned int flags)
|
||||
s->iDeviceId = 1;
|
||||
s->is4K = false;
|
||||
|
||||
parse_fmt(s, init_fmt);
|
||||
char *tmp_fmt = strdup(params->fmt);
|
||||
parse_fmt(s, tmp_fmt);
|
||||
free(tmp_fmt);
|
||||
|
||||
#ifdef WIN32
|
||||
memset(&s->OverlapChA, 0, sizeof(s->OverlapChA));
|
||||
@@ -905,12 +907,12 @@ vidcap_bluefish444_init(char *init_fmt, unsigned int flags)
|
||||
s->audio.max_size = 0;
|
||||
s->hanc_buffer = NULL;
|
||||
#ifdef HAVE_BLUE_AUDIO
|
||||
if(flags) {
|
||||
if(params->flags) {
|
||||
if(s->SubField) {
|
||||
cerr << "[Blue cap] Unable to grab audio in sub-field mode." << endl;
|
||||
goto error;
|
||||
}
|
||||
bool ret = setup_audio(s, flags);
|
||||
bool ret = setup_audio(s, params->flags);
|
||||
if(ret == false) {
|
||||
cerr << "[Blue cap] Unable to setup audio." << endl;
|
||||
goto error;
|
||||
@@ -919,7 +921,7 @@ vidcap_bluefish444_init(char *init_fmt, unsigned int flags)
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(flags) {
|
||||
if(params->flags) {
|
||||
cerr << "[Blue cap] Unable to capture audio. Support isn't compiled in." << endl;
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct vidcap_type *vidcap_bluefish444_probe(void);
|
||||
void *vidcap_bluefish444_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_bluefish444_init(const struct vidcap_params *params);
|
||||
void vidcap_bluefish444_done(void *state);
|
||||
struct video_frame *vidcap_bluefish444_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -722,7 +722,7 @@ static HRESULT set_display_mode_properties(struct vidcap_decklink_state *s, stru
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_decklink_init(char *fmt, unsigned int flags)
|
||||
vidcap_decklink_init(const struct vidcap_params *params)
|
||||
{
|
||||
debug_msg("vidcap_decklink_init\n"); /* TOREMOVE */
|
||||
|
||||
@@ -797,7 +797,9 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
|
||||
s->flags = 0;
|
||||
|
||||
// SET UP device and mode
|
||||
int ret = settings_init(s, fmt);
|
||||
char *tmp_fmt = strdup(params->fmt);
|
||||
int ret = settings_init(s, tmp_fmt);
|
||||
free(tmp_fmt);
|
||||
if(ret == 0) {
|
||||
free(s);
|
||||
return NULL;
|
||||
@@ -807,9 +809,9 @@ vidcap_decklink_init(char *fmt, unsigned int flags)
|
||||
return &vidcap_init_noerr;
|
||||
}
|
||||
|
||||
if(flags & (VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG)) {
|
||||
if(params->flags & (VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG)) {
|
||||
s->grab_audio = TRUE;
|
||||
switch(flags & (VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG)) {
|
||||
switch(params->flags & (VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG)) {
|
||||
case VIDCAP_FLAG_AUDIO_EMBEDDED:
|
||||
audioConnection = bmdAudioConnectionEmbedded;
|
||||
break;
|
||||
|
||||
@@ -51,10 +51,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct vidcap_type *vidcap_decklink_probe(void);
|
||||
void *vidcap_decklink_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_decklink_init(const struct vidcap_params *params);
|
||||
void vidcap_decklink_done(void *state);
|
||||
struct video_frame *vidcap_decklink_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // END extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ static bool wait_for_channel(struct vidcap_deltacast_state *s)
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_deltacast_init(char *init_fmt, unsigned int flags)
|
||||
vidcap_deltacast_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_deltacast_state *s;
|
||||
ULONG Result,DllVersion,NbBoards,ChnType;
|
||||
@@ -353,6 +353,7 @@ vidcap_deltacast_init(char *init_fmt, unsigned int flags)
|
||||
|
||||
s->BoardHandle = s->StreamHandle = s->SlotHandle = NULL;
|
||||
|
||||
char *init_fmt = strdup(params->fmt);
|
||||
if(init_fmt && strcmp(init_fmt, "help") == 0) {
|
||||
usage();
|
||||
return &vidcap_init_noerr;
|
||||
@@ -398,6 +399,7 @@ vidcap_deltacast_init(char *init_fmt, unsigned int flags)
|
||||
BrdId = 0;
|
||||
printf("[DELTACAST] Automatically choosen device nr. 0\n");
|
||||
}
|
||||
free(init_fmt);
|
||||
|
||||
if(s->autodetect_format) {
|
||||
printf("DELTACAST] We will try to autodetect incoming video format.\n");
|
||||
@@ -437,7 +439,7 @@ vidcap_deltacast_init(char *init_fmt, unsigned int flags)
|
||||
/* Disable RX0-TX0 by-pass relay loopthrough */
|
||||
VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_0,FALSE);
|
||||
|
||||
s->initialize_flags = flags;
|
||||
s->initialize_flags = params->flags;
|
||||
printf("\nWaiting for channel locked...\n");
|
||||
try {
|
||||
if(wait_for_channel(s)) {
|
||||
|
||||
@@ -51,10 +51,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct vidcap_type *vidcap_deltacast_probe(void);
|
||||
void *vidcap_deltacast_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_deltacast_init(const struct vidcap_params *params);
|
||||
void vidcap_deltacast_done(void *state);
|
||||
struct video_frame *vidcap_deltacast_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // END extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -437,9 +437,8 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_deltacast_dvi_init(char *init_fmt, unsigned int flags)
|
||||
vidcap_deltacast_dvi_init(const struct vidcap_params *params)
|
||||
{
|
||||
UNUSED(flags); // DVI doesn't support audio
|
||||
struct vidcap_deltacast_dvi_state *s;
|
||||
ULONG Width = 0, Height = 0, RefreshRate = 0;
|
||||
ULONG Result = VHDERR_NOERROR,DllVersion,NbBoards,BoardType;
|
||||
@@ -468,6 +467,7 @@ vidcap_deltacast_dvi_init(char *init_fmt, unsigned int flags)
|
||||
|
||||
s->BoardHandle = s->StreamHandle = s->SlotHandle = NULL;
|
||||
|
||||
char *init_fmt = strdup(params->fmt);
|
||||
if(init_fmt && strcmp(init_fmt, "help") == 0) {
|
||||
usage();
|
||||
return &vidcap_init_noerr;
|
||||
@@ -530,6 +530,7 @@ vidcap_deltacast_dvi_init(char *init_fmt, unsigned int flags)
|
||||
BrdId = 0;
|
||||
printf("[DELTACAST] Automatically choosen device nr. 0\n");
|
||||
}
|
||||
free(init_fmt);
|
||||
|
||||
/* Query VideoMasterHD information */
|
||||
Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
|
||||
|
||||
@@ -51,7 +51,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct vidcap_type *vidcap_deltacast_dvi_probe(void);
|
||||
void *vidcap_deltacast_dvi_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_deltacast_dvi_init(const struct vidcap_params *params);
|
||||
void vidcap_deltacast_dvi_done(void *state);
|
||||
struct video_frame *vidcap_deltacast_dvi_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ static void show_help(void)
|
||||
|
||||
/* External API ***********************************************************************************/
|
||||
|
||||
void *vidcap_dvs_init(char *fmt, unsigned int flags)
|
||||
void *vidcap_dvs_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_dvs_state *s;
|
||||
int i;
|
||||
@@ -247,12 +247,13 @@ void *vidcap_dvs_init(char *fmt, unsigned int flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fmt != NULL) {
|
||||
if (strcmp(fmt, "help") == 0) {
|
||||
if (params->fmt != NULL) {
|
||||
if (strcmp(params->fmt, "help") == 0) {
|
||||
show_help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *fmt = strdup(params->fmt);
|
||||
char *tmp;
|
||||
|
||||
if(strncmp(fmt, "PCI", 3) == 0) {
|
||||
@@ -304,6 +305,8 @@ void *vidcap_dvs_init(char *fmt, unsigned int flags)
|
||||
printf("[DVS] Choosen card: %s.\n", card_name);
|
||||
}
|
||||
}
|
||||
|
||||
free(fmt);
|
||||
} else {
|
||||
s->detect_mode = TRUE;
|
||||
}
|
||||
@@ -319,7 +322,7 @@ void *vidcap_dvs_init(char *fmt, unsigned int flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
if(params->flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
s->grab_audio = TRUE;
|
||||
} else {
|
||||
s->grab_audio = FALSE;
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
struct audio_frame;
|
||||
|
||||
struct vidcap_type *vidcap_dvs_probe(void);
|
||||
void *vidcap_dvs_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_dvs_init(const struct vidcap_params *params);
|
||||
void vidcap_dvs_done(void *state);
|
||||
struct video_frame *vidcap_dvs_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -275,9 +275,10 @@ error_opening:
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_import_init(char *directory, unsigned int flags)
|
||||
vidcap_import_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_import_state *s;
|
||||
const char *directory = params->fmt;
|
||||
|
||||
printf("vidcap_import_init\n");
|
||||
|
||||
@@ -303,7 +304,7 @@ vidcap_import_init(char *directory, unsigned int flags)
|
||||
assert(audio_filename != NULL);
|
||||
strcpy(audio_filename, directory);
|
||||
strcat(audio_filename, "/sound.wav");
|
||||
if((flags & VIDCAP_FLAG_AUDIO_EMBEDDED) && init_audio(s, audio_filename)) {
|
||||
if((params->flags & VIDCAP_FLAG_AUDIO_EMBEDDED) && init_audio(s, audio_filename)) {
|
||||
s->audio_state.has_audio = true;
|
||||
if(pthread_create(&s->audio_state.thread_id, NULL, audio_reading_thread, (void *) s) != 0) {
|
||||
fprintf(stderr, "Unable to create thread.\n");
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
*/
|
||||
|
||||
struct vidcap_type *vidcap_import_probe(void);
|
||||
void *vidcap_import_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_import_init(const struct vidcap_params *params);
|
||||
void vidcap_import_done(void *state);
|
||||
struct video_frame *vidcap_import_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ static int open_audio(struct vidcap_linsys_state *s) {
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_linsys_init(char *init_fmt, unsigned int flags)
|
||||
vidcap_linsys_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_linsys_state *s;
|
||||
|
||||
@@ -376,12 +376,12 @@ vidcap_linsys_init(char *init_fmt, unsigned int flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!init_fmt || strcmp(init_fmt, "help") == 0) {
|
||||
if(!params->fmt || strcmp(params->fmt, "help") == 0) {
|
||||
print_output_modes();
|
||||
return &vidcap_init_noerr;
|
||||
}
|
||||
|
||||
if(flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
if(params->flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
s->grab_audio = TRUE;
|
||||
|
||||
s->audio.bps = LINSYS_AUDIO_BPS;
|
||||
@@ -405,7 +405,7 @@ vidcap_linsys_init(char *init_fmt, unsigned int flags)
|
||||
s->grab_audio = FALSE;
|
||||
}
|
||||
|
||||
fmt_dup = strdup(init_fmt);
|
||||
fmt_dup = strdup(params->fmt);
|
||||
|
||||
item = strtok_r(fmt_dup, ":", &save_ptr);
|
||||
if(item == NULL) {
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define VIDCAP_LINSYS_ID 0x10203044
|
||||
|
||||
struct vidcap_type *vidcap_linsys_probe(void);
|
||||
void *vidcap_linsys_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_linsys_init(const struct vidcap_params *params);
|
||||
void vidcap_linsys_done(void *state);
|
||||
struct video_frame *vidcap_linsys_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -58,10 +58,9 @@
|
||||
|
||||
static int capture_state = 0;
|
||||
|
||||
void *vidcap_null_init(char *fmt, unsigned int flags)
|
||||
void *vidcap_null_init(const struct vidcap_params *params)
|
||||
{
|
||||
UNUSED(fmt);
|
||||
UNUSED(flags);
|
||||
UNUSED(params);
|
||||
capture_state = 0;
|
||||
return &capture_state;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
struct audio_frame;
|
||||
|
||||
struct vidcap_type *vidcap_null_probe(void);
|
||||
void *vidcap_null_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_null_init(const struct vidcap_params *params);
|
||||
void vidcap_null_done(void *state);
|
||||
struct video_frame *vidcap_null_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -946,7 +946,7 @@ struct vidcap_type *vidcap_quicktime_probe(void)
|
||||
}
|
||||
|
||||
/* Initialize the QuickTime grabbing system */
|
||||
void *vidcap_quicktime_init(char *fmt, unsigned int flags)
|
||||
void *vidcap_quicktime_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct qt_grabber_state *s;
|
||||
|
||||
@@ -966,7 +966,7 @@ void *vidcap_quicktime_init(char *fmt, unsigned int flags)
|
||||
s->frame->color_spec = 0xffffffff;
|
||||
|
||||
s->grab_audio = FALSE;
|
||||
if(flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
if(params->flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
#ifdef QT_ENABLE_AUDIO
|
||||
s->grab_audio = TRUE;
|
||||
#else
|
||||
@@ -976,7 +976,9 @@ void *vidcap_quicktime_init(char *fmt, unsigned int flags)
|
||||
#endif
|
||||
}
|
||||
|
||||
char *fmt = strdup(params->fmt);
|
||||
int ret = qt_open_grabber(s, fmt);
|
||||
free(fmt);
|
||||
|
||||
if (ret != 1) {
|
||||
free(s);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
struct audio_frame;
|
||||
|
||||
struct vidcap_type *vidcap_quicktime_probe(void);
|
||||
void *vidcap_quicktime_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_quicktime_init(const struct vidcap_params *params);
|
||||
void vidcap_quicktime_done(void *state);
|
||||
struct video_frame *vidcap_quicktime_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -303,14 +303,12 @@ struct vidcap_type * vidcap_screen_probe(void)
|
||||
return vt;
|
||||
}
|
||||
|
||||
void * vidcap_screen_init(char *init_fmt, unsigned int flags)
|
||||
void * vidcap_screen_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_screen_state *s;
|
||||
|
||||
printf("vidcap_screen_init\n");
|
||||
|
||||
UNUSED(flags);
|
||||
|
||||
state = s = (struct vidcap_screen_state *) malloc(sizeof(struct vidcap_screen_state));
|
||||
if(s == NULL) {
|
||||
printf("Unable to allocate screen capture state\n");
|
||||
@@ -337,12 +335,12 @@ void * vidcap_screen_init(char *init_fmt, unsigned int flags)
|
||||
|
||||
s->frames = 0;
|
||||
|
||||
if(init_fmt) {
|
||||
if (strcmp(init_fmt, "help") == 0) {
|
||||
if(params->fmt) {
|
||||
if (strcmp(params->fmt, "help") == 0) {
|
||||
show_help();
|
||||
return &vidcap_init_noerr;
|
||||
} else if (strncasecmp(init_fmt, "fps=", strlen("fps=")) == 0) {
|
||||
s->fps = atoi(init_fmt + strlen("fps="));
|
||||
} else if (strncasecmp(params->fmt, "fps=", strlen("fps=")) == 0) {
|
||||
s->fps = atoi(params->fmt + strlen("fps="));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define VIDCAP_SCREEN_ID 0x5645ba22
|
||||
|
||||
struct vidcap_type *vidcap_screen_probe(void);
|
||||
void *vidcap_screen_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_screen_init(const struct vidcap_params *params);
|
||||
void vidcap_screen_done(void *state);
|
||||
struct video_frame *vidcap_screen_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -462,3 +462,4 @@ unsigned char song1[] =
|
||||
0x3e, 0x40, 0x4c, 0x99, 0x3e, 0x56, 0x13, 0x89, 0x3e, 0x40, 0x1c, 0x99, 0x40, 0x52, 0x10, 0x89,
|
||||
0x40, 0x40, 0x21, 0x99, 0x40, 0x56, 0x10, 0x89, 0x40, 0x40, 0x00, 0xff, 0x2f, 0x00
|
||||
};
|
||||
|
||||
|
||||
@@ -216,8 +216,7 @@ struct state_slave {
|
||||
pthread_mutex_t lock;
|
||||
char *name;
|
||||
char *device_vendor;
|
||||
char *device_cfg;
|
||||
unsigned int vidcap_flags;
|
||||
struct vidcap_params device_params;
|
||||
|
||||
struct video_frame *captured_frame;
|
||||
struct video_frame *done_frame;
|
||||
@@ -739,10 +738,10 @@ static void *slave_worker(void *arg)
|
||||
|
||||
struct vidcap *device;
|
||||
int ret =
|
||||
initialize_video_capture(s->device_vendor, s->device_cfg, s->vidcap_flags, &device);
|
||||
initialize_video_capture(s->device_vendor, &s->device_params, &device);
|
||||
if(ret != 0) {
|
||||
fprintf(stderr, "[swmix] Unable to initialize device %s (%s:%s).\n",
|
||||
s->name, s->device_vendor, s->device_cfg);
|
||||
s->name, s->device_vendor, s->device_params.fmt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -975,10 +974,10 @@ static bool parse(struct vidcap_swmix_state *s, struct video_desc *desc, char *f
|
||||
s->slaves[i].audio_frame.data = (char *)
|
||||
malloc(s->slaves[i].audio_frame.max_size);
|
||||
s->slaves[i].audio_frame.data_len = 0;
|
||||
s->slaves[i].vidcap_flags = vidcap_flags;
|
||||
s->slaves[i].device_params.flags = vidcap_flags;
|
||||
} else {
|
||||
s->slaves[i].capture_audio = false;
|
||||
s->slaves[i].vidcap_flags = 0;
|
||||
s->slaves[i].device_params.flags = 0;
|
||||
}
|
||||
|
||||
if(s->use_config_file == true) {
|
||||
@@ -1007,11 +1006,12 @@ static bool parse(struct vidcap_swmix_state *s, struct video_desc *desc, char *f
|
||||
device_cfg = delim + 1;
|
||||
}
|
||||
|
||||
memset(&s->slaves[i].device_params, 0, sizeof(s->slaves[i].device_params));
|
||||
s->slaves[i].device_vendor = strdup(device);
|
||||
if(device_cfg) {
|
||||
s->slaves[i].device_cfg = strdup(device_cfg);
|
||||
s->slaves[i].device_params.fmt = strdup(device_cfg);
|
||||
} else {
|
||||
s->slaves[i].device_cfg = NULL;
|
||||
s->slaves[i].device_params.fmt = NULL;
|
||||
}
|
||||
if(name) {
|
||||
s->slaves[i].name = strdup(name);
|
||||
@@ -1028,7 +1028,7 @@ static bool parse(struct vidcap_swmix_state *s, struct video_desc *desc, char *f
|
||||
}
|
||||
|
||||
void *
|
||||
vidcap_swmix_init(char *init_fmt, unsigned int flags)
|
||||
vidcap_swmix_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_swmix_state *s;
|
||||
struct video_desc desc;
|
||||
@@ -1050,7 +1050,7 @@ vidcap_swmix_init(char *init_fmt, unsigned int flags)
|
||||
s->bicubic_algo = strdup("BSpline");
|
||||
gettimeofday(&s->t0, NULL);
|
||||
|
||||
if(!init_fmt || strcmp(init_fmt, "help") == 0) {
|
||||
if(!params->fmt || strcmp(params->fmt, "help") == 0) {
|
||||
show_help();
|
||||
return &vidcap_init_noerr;
|
||||
}
|
||||
@@ -1062,9 +1062,11 @@ vidcap_swmix_init(char *init_fmt, unsigned int flags)
|
||||
s->interpolation = BICUBIC;
|
||||
FILE *config_file = NULL;
|
||||
|
||||
if(!parse(s, &desc, init_fmt, &config_file, &s->interpolation, flags)) {
|
||||
char *init_fmt = strdup(params->fmt);
|
||||
if(!parse(s, &desc, init_fmt, &config_file, &s->interpolation, params->flags)) {
|
||||
goto error;
|
||||
}
|
||||
free(init_fmt);
|
||||
|
||||
s->frame = vf_alloc_desc(desc);
|
||||
|
||||
@@ -1200,7 +1202,7 @@ vidcap_swmix_done(void *state)
|
||||
pthread_mutex_destroy(&s->slaves[i].lock);
|
||||
vf_free_data(s->slaves[i].captured_frame);
|
||||
vf_free_data(s->slaves[i].done_frame);
|
||||
free(s->slaves[i].device_cfg);
|
||||
free((void *) s->slaves[i].device_params.fmt);
|
||||
free(s->slaves[i].device_vendor);
|
||||
free(s->slaves[i].name);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ struct vidcap_type;
|
||||
struct video_frame;
|
||||
|
||||
struct vidcap_type *vidcap_swmix_probe(void);
|
||||
void *vidcap_swmix_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_swmix_init(const struct vidcap_params *params);
|
||||
void vidcap_swmix_done(void *state);
|
||||
struct video_frame *vidcap_swmix_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "video.h"
|
||||
#include "video_capture.h"
|
||||
#include "video_capture/testcard.h"
|
||||
#include "video_capture/testcard_common.h"
|
||||
#include "song1.h"
|
||||
#include "vf_split.h"
|
||||
#include <stdio.h>
|
||||
@@ -280,7 +281,7 @@ static int configure_tiling(struct testcard_state *s, const char *fmt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *vidcap_testcard_init(char *fmt, unsigned int flags)
|
||||
void *vidcap_testcard_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct testcard_state *s;
|
||||
char *filename;
|
||||
@@ -293,7 +294,7 @@ void *vidcap_testcard_init(char *fmt, unsigned int flags)
|
||||
int aligned_x;
|
||||
char *save_ptr = NULL;
|
||||
|
||||
if (fmt == NULL || strcmp(fmt, "help") == 0) {
|
||||
if (params->fmt == NULL || strcmp(params->fmt, "help") == 0) {
|
||||
printf("testcard options:\n");
|
||||
printf("\t-t testcard:<width>:<height>:<fps>:<codec>[:<filename>][:p][:s=<X>x<Y>][:i|:sf]:still\n");
|
||||
printf("\tp - pan with frame\n");
|
||||
@@ -310,6 +311,7 @@ void *vidcap_testcard_init(char *fmt, unsigned int flags)
|
||||
|
||||
s->frame = vf_alloc(1);
|
||||
|
||||
char *fmt = strdup(params->fmt);
|
||||
char *tmp;
|
||||
|
||||
tmp = strtok_r(fmt, ":", &save_ptr);
|
||||
@@ -514,7 +516,7 @@ void *vidcap_testcard_init(char *fmt, unsigned int flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
if(params->flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
s->grab_audio = TRUE;
|
||||
if(configure_audio(s) != 0) {
|
||||
s->grab_audio = FALSE;
|
||||
@@ -525,6 +527,8 @@ void *vidcap_testcard_init(char *fmt, unsigned int flags)
|
||||
s->grab_audio = FALSE;
|
||||
}
|
||||
|
||||
free(fmt);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,13 +47,7 @@
|
||||
#define VIDCAP_TESTCARD_ID 0xb06ba92a
|
||||
|
||||
struct vidcap_type *vidcap_testcard_probe(void);
|
||||
void *vidcap_testcard_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_testcard_init(const struct vidcap_params *params);
|
||||
void vidcap_testcard_done(void *state);
|
||||
struct video_frame *vidcap_testcard_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
// for testcard2.c
|
||||
void rgb2yuv422(unsigned char *in, unsigned int width, unsigned int height);
|
||||
unsigned char *tov210(unsigned char *in, unsigned int width, unsigned int align_x,
|
||||
unsigned int height, double bpp);
|
||||
void toR10k(unsigned char *in, unsigned int width, unsigned int height);
|
||||
char * toRGB(unsigned char *in, unsigned int width, unsigned int height);
|
||||
|
||||
@@ -140,7 +140,7 @@ static int configure_audio(struct testcard_state2 *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *vidcap_testcard2_init(char *fmt, unsigned int flags)
|
||||
void *vidcap_testcard2_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct testcard_state2 *s;
|
||||
const char *strip_fmt = NULL;
|
||||
@@ -148,7 +148,7 @@ void *vidcap_testcard2_init(char *fmt, unsigned int flags)
|
||||
unsigned int rect_size = COL_NUM;
|
||||
codec_t codec=0;
|
||||
|
||||
if (fmt == NULL || strcmp(fmt, "help") == 0) {
|
||||
if (params->fmt == NULL || strcmp(params->fmt, "help") == 0) {
|
||||
printf("testcard2 options:\n");
|
||||
printf("\t-t testcard2:<width>:<height>:<fps>:<codec>\n");
|
||||
show_codec_help("testcard");
|
||||
@@ -159,6 +159,7 @@ void *vidcap_testcard2_init(char *fmt, unsigned int flags)
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
char *fmt = strdup(params->fmt);
|
||||
char *tmp;
|
||||
|
||||
s->frame = vf_alloc(1);
|
||||
@@ -277,7 +278,7 @@ void *vidcap_testcard2_init(char *fmt, unsigned int flags)
|
||||
// we cannot generate tiles by now
|
||||
UNUSED(strip_fmt);
|
||||
|
||||
if(flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
if(params->flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
s->grab_audio = TRUE;
|
||||
if(configure_audio(s) != 0) {
|
||||
s->grab_audio = FALSE;
|
||||
@@ -298,7 +299,7 @@ void *vidcap_testcard2_init(char *fmt, unsigned int flags)
|
||||
|
||||
s->tile->data_len = s->size;
|
||||
|
||||
if(flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
if(params->flags & VIDCAP_FLAG_AUDIO_EMBEDDED) {
|
||||
s->grab_audio = TRUE;
|
||||
if(configure_audio(s) != 0) {
|
||||
s->grab_audio = FALSE;
|
||||
@@ -318,6 +319,8 @@ void *vidcap_testcard2_init(char *fmt, unsigned int flags)
|
||||
|
||||
pthread_create(&s->thread_id, NULL, vidcap_testcard2_thread, s);
|
||||
|
||||
free(fmt);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#define VIDCAP_TESTCARD2_ID 0xb06ba92b
|
||||
|
||||
struct vidcap_type *vidcap_testcard2_probe(void);
|
||||
void *vidcap_testcard2_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_testcard2_init(const struct vidcap_params *params);
|
||||
void vidcap_testcard2_done(void *state);
|
||||
struct video_frame *vidcap_testcard2_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
@@ -48,3 +48,4 @@ unsigned char *tov210(unsigned char *in, unsigned int width, unsigned int align_
|
||||
unsigned int height, double bpp);
|
||||
void toR10k(unsigned char *in, unsigned int width, unsigned int height);
|
||||
char * toRGB(unsigned char *in, unsigned int width, unsigned int height);
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "config_win32.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "video_capture.h"
|
||||
#include "video_capture/v4l2.h"
|
||||
|
||||
#include <arpa/inet.h> // ntohl
|
||||
@@ -69,7 +70,6 @@
|
||||
#include "host.h"
|
||||
#include "tv.h"
|
||||
#include "video.h"
|
||||
#include "video_capture.h"
|
||||
|
||||
|
||||
/* prototypes of functions defined in this module */
|
||||
@@ -245,7 +245,7 @@ struct vidcap_type * vidcap_v4l2_probe(void)
|
||||
return vt;
|
||||
}
|
||||
|
||||
void * vidcap_v4l2_init(char *init_fmt, unsigned int flags)
|
||||
void * vidcap_v4l2_init(const struct vidcap_params *params)
|
||||
{
|
||||
struct vidcap_v4l2_state *s;
|
||||
char *dev_name = DEFAULT_DEVICE;
|
||||
@@ -255,11 +255,9 @@ void * vidcap_v4l2_init(char *init_fmt, unsigned int flags)
|
||||
uint32_t numerator = 0,
|
||||
denominator = 0;
|
||||
|
||||
UNUSED(flags);
|
||||
|
||||
printf("vidcap_v4l2_init\n");
|
||||
|
||||
if(init_fmt && strcmp(init_fmt, "help") == 0) {
|
||||
if(params->fmt && strcmp(params->fmt, "help") == 0) {
|
||||
show_help();
|
||||
return &vidcap_init_noerr;
|
||||
}
|
||||
@@ -271,7 +269,9 @@ void * vidcap_v4l2_init(char *init_fmt, unsigned int flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(init_fmt) {
|
||||
if(params->fmt) {
|
||||
char *tmp = strdup(params->fmt);
|
||||
char *init_fmt = tmp;
|
||||
char *save_ptr = NULL;
|
||||
char *item;
|
||||
int i = 0;
|
||||
@@ -312,6 +312,7 @@ void * vidcap_v4l2_init(char *init_fmt, unsigned int flags)
|
||||
init_fmt = NULL;
|
||||
++i;
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
s->frame = NULL;
|
||||
|
||||
@@ -58,7 +58,7 @@ struct vidcap_type;
|
||||
struct video_frame;
|
||||
|
||||
struct vidcap_type *vidcap_v4l2_probe(void);
|
||||
void *vidcap_v4l2_init(char *fmt, unsigned int flags);
|
||||
void *vidcap_v4l2_init(const struct vidcap_params *params);
|
||||
void vidcap_v4l2_done(void *state);
|
||||
struct video_frame *vidcap_v4l2_grab(void *state, struct audio_frame **audio);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user