2 * iaxclient: a cross-platform IAX softphone library
5 * Copyright (C) 2003 HorizonLive.com, (c) 2004, Horizon Wimba, Inc.
8 * Steve Kann <stevek@stevek.com>
10 * This program is free software, distributed under the terms of
11 * the GNU Lesser (Library) General Public License
13 * Module: video_portvideo
14 * Purpose: Video code to provide portvideo driver support for IAX library
15 * Developed by: Steve Kann
16 * Creation Date: April 7, 2005
21 #include "iaxclient_lib.h"
22 #include "PortVideoSDL/common/cameraEngine.h"
23 #include "PortVideoSDL/common/cameraTool.h"
25 static cameraEngine *engine;
29 int pv_start (struct iaxc_video_driver *d ) {
31 if(!engine->startCamera()) {
32 fprintf(stderr, "pv: couldn't start camera\n");
40 int pv_stop (struct iaxc_video_driver *d ) {
47 int pv_input(struct iaxc_video_driver *d, unsigned char **in) {
48 unsigned char *data = NULL;
49 data = engine->getFrame();
51 if(!engine->stillRunning()) {
52 fprintf(stderr, "camera disconnected\n");
55 fprintf(stderr, "pv_input: no frame\n");
62 int pv_output(struct iaxc_video_driver *d, unsigned char *data) {
66 int pv_select_devices (struct iaxc_video_driver *d, int input, int output) {
70 int pv_selected_devices (struct iaxc_video_driver *d, int *input, int *output) {
74 int pv_destroy (struct iaxc_video_driver *d ) {
81 /* initialize video driver */
82 int pv_initialize (struct iaxc_video_driver *d, int w, int h, int framerate) {
84 d->initialize = pv_initialize;
85 d->destroy = pv_destroy;
86 d->select_devices = pv_select_devices;
87 d->selected_devices = pv_selected_devices;
90 d->output = pv_output;
93 engine = cameraTool::findCamera();
95 fprintf(stderr, "video_portvideo: can't find camera\n");
99 if(!engine->initCamera(w,h,true)) {
100 fprintf(stderr, "can't initialize camera");