File: video_dispatch.c

package info (click to toggle)
vips 8.14.1-3%2Bdeb12u2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 35,912 kB
  • sloc: ansic: 165,449; cpp: 10,987; python: 4,462; xml: 4,212; sh: 471; perl: 40; makefile: 23
file content (123 lines) | stat: -rw-r--r-- 3,499 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* function dispatch tables for video
 */

/*

    This file is part of VIPS.
    
    VIPS is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program 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 Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301  USA

 */

/*

    These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk

 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <glib/gi18n-lib.h>

#include <stdio.h>

#include <vips/vips.h>
#include <vips/vips7compat.h>

/** 
 * SECTION: video
 * @short_description: various video grabbers
 * @see_also: <link linkend="libvips-image">image</link>
 * @stability: Stable
 * @include: vips/vips.h
 *
 * Read an image from a video source.
 */

static int
video_v4l1_vec( im_object *argv )
{
        IMAGE *out = argv[0];
        char *device = (char *) argv[1];
        int channel = *((int*)argv[2]);
        int brightness = *((int*)argv[3]);
        int colour = *((int*)argv[4]);
        int contrast = *((int*)argv[5]);
        int hue = *((int*)argv[6]);
        int ngrabs = *((int*)argv[7]);

        return( im_video_v4l1( out, device, 
		channel, brightness, colour, contrast, hue, ngrabs ) );
}

static im_arg_desc video_v4l1_arg_types[] = {
        IM_OUTPUT_IMAGE( "out" ),
        IM_INPUT_STRING( "device" ),
        IM_INPUT_INT( "channel" ),
        IM_INPUT_INT( "brightness" ),
        IM_INPUT_INT( "colour" ),
        IM_INPUT_INT( "contrast" ),
        IM_INPUT_INT( "hue" ),
        IM_INPUT_INT( "ngrabs" )
};

static im_function video_v4l1_desc = {
        "im_video_v4l1",                /* Name */
        "grab a video frame with v4l1",	/* Description */
        IM_FN_NOCACHE,                  /* Flags */
        video_v4l1_vec,                 /* Dispatch function */
        IM_NUMBER( video_v4l1_arg_types ), /* Size of arg list */
        video_v4l1_arg_types            /* Arg list */
};

static int
video_test_vec( im_object *argv )
{
        IMAGE *out = argv[0];
        int brightness = *((int*)argv[1]);
        int error = *((int*)argv[2]);

        return( im_video_test( out, brightness, error ) );
}

static im_arg_desc video_test_arg_types[] = {
        IM_OUTPUT_IMAGE( "out" ),
        IM_INPUT_INT( "brightness" ),
        IM_INPUT_INT( "error" )
};

static im_function video_test_desc = {
        "im_video_test",                /* Name */
        "test video grabber",		/* Description */
        IM_FN_NOCACHE,                  /* Flags */
        video_test_vec,                 /* Dispatch function */
        IM_NUMBER( video_test_arg_types ), /* Size of arg list */
        video_test_arg_types            /* Arg list */
};

static im_function *video_list[] = {
        &video_test_desc,
        &video_v4l1_desc
};

im_package im__video = {
        "video",                        /* Package name */
        IM_NUMBER( video_list ),       	/* Function list */
        video_list
};