File: PsychVideoCaptureSupport.h

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (102 lines) | stat: -rw-r--r-- 5,198 bytes parent folder | download | duplicates (3)
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
/*
    PsychToolbox3/Source/Common/Screen/PsychVideoCaptureSupport.h

    PLATFORMS:	This is the OS independent version.

    AUTHORS:
        Mario Kleiner   mk  mario.kleiner at tuebingen.mpg.de

    HISTORY:
    02/07/06		mk		Wrote it.

    DESCRIPTION:

    Psychtoolbox functions for dealing with video capture devices.

*/




//include once
#ifndef PSYCH_IS_INCLUDED_PsychVideoCaptureSupport
#define PSYCH_IS_INCLUDED_PsychVideoCaptureSupport

// Maximum number of allowed simultaneously open capture devices. As structures are allocated
// statically, this should not be increased beyond reasonable limits. 100 is always a nice number:
#define PSYCH_MAX_CAPTUREDEVICES 100

#include "Screen.h"

typedef struct rawcapimgdata {
    int w;
    int h;
    int depth;
    int bitdepth;
    void* data;
} rawcapimgdata;

// These are the generic entry points, to be called by SCREENxxxx videocapture functions and
// other parts of screen. They dispatch into API specific versions, depending on users choice
// of capture system and support by OS:
void PsychVideoCaptureInit(void);
psych_bool PsychOpenVideoCaptureDevice(int engineId, PsychWindowRecordType *win, int deviceIndex, int* capturehandle, double* capturerectangle, int reqdepth, int num_dmabuffers, int allow_lowperf_fallback, char* targetmoviefilename, unsigned int recordingflags, int bitdepth);
void PsychCloseVideoCaptureDevice(int capturehandle);
int PsychGetTextureFromCapture(PsychWindowRecordType *win, int capturehandle, int checkForImage, double timeindex, PsychWindowRecordType *out_texture, double *presentation_timestamp, double* summed_intensity, rawcapimgdata* outrawbuffer);
int PsychVideoCaptureRate(int capturehandle, double capturerate, int dropframes, double* startattime);
double PsychVideoCaptureSetParameter(int capturehandle, const char* pname, double value);
void PsychEnumerateVideoSources(int engineId, int outPos);
void PsychExitVideoCapture(void);

// These are the prototypes for LibDC1394 V2 versions, supported on GNU/Linx, OS/X and in a experimental version on MS-Windows:
#ifdef PTBVIDEOCAPTURE_LIBDC
void PsychDCVideoCaptureInit(void);
psych_bool PsychDCOpenVideoCaptureDevice(int slotid, PsychWindowRecordType *win, int deviceIndex, int* capturehandle, double* capturerectangle, int reqdepth, int num_dmabuffers, int allow_lowperf_fallback, char* targetmoviefilename, unsigned int recordingflags, int bitdepth);
void PsychDCCloseVideoCaptureDevice(int capturehandle);
int PsychDCGetTextureFromCapture(PsychWindowRecordType *win, int capturehandle, int checkForImage, double timeindex, PsychWindowRecordType *out_texture, double *presentation_timestamp, double* summed_intensity, rawcapimgdata* outrawbuffer);
int PsychDCVideoCaptureRate(int capturehandle, double capturerate, int dropframes, double* startattime);
double PsychDCVideoCaptureSetParameter(int capturehandle, const char* pname, double value);
void PsychDCEnumerateVideoSources(int outPos);
void PsychDCExitVideoCapture(void);

// Helper for GStreamer movie playback: Debayers a raw bayer input image into a RGB output image: Caller has to free() outRGBImage after use!
unsigned char* PsychDCDebayerFrame(unsigned char* inBayerImage, unsigned int width, unsigned int height, unsigned int bitdepth);
#endif

// These are the prototypes for the GStreamer capture library, supported on GNU/Linx, OS/X and MS-Windows:
#ifdef PTB_USE_GSTREAMER
#include <gst/gst.h>

typedef struct PsychVideosourceRecordType {
    int deviceIndex;
    int classIndex;
    int inputIndex;
    psych_uint64 deviceURI;
    unsigned int flags;
    char deviceClassName[100];
    char deviceSelectorProperty[100];
    char deviceVideoPlugin[100];
    char deviceHandle[1000];
    char devicePath[1000];
    char deviceName[1000];
    char device[1000];
    void* gstdevice; // GstDevice* for this device as enumerated by GstDeviceProvider/GstDeviceMonitor if using GStreamer 1.4.0+
} PsychVideosourceRecordType;

void PsychGSCheckInit(const char* engineName);
void PsychGSVideoCaptureInit(void);
psych_bool PsychGSOpenVideoCaptureDevice(int slotid, PsychWindowRecordType *win, int deviceIndex, int* capturehandle, double* capturerectangle, int reqdepth, int num_dmabuffers, int allow_lowperf_fallback, char* targetmoviefilename, unsigned int recordingflags, int bitdepth);
void PsychGSCloseVideoCaptureDevice(int capturehandle);
int PsychGSGetTextureFromCapture(PsychWindowRecordType *win, int capturehandle, int checkForImage, double timeindex, PsychWindowRecordType *out_texture, double *presentation_timestamp, double* summed_intensity, rawcapimgdata* outrawbuffer);
int PsychGSVideoCaptureRate(int capturehandle, double capturerate, int dropframes, double* startattime);
double PsychGSVideoCaptureSetParameter(int capturehandle, const char* pname, double value);
PsychVideosourceRecordType* PsychGSEnumerateVideoSources(int outPos, int deviceIndex, GstElement **videocaptureplugin, GstElement **videocapturebin);
void PsychGSExitVideoCapture(void);

// PsychGetCodecLaunchLineFromString() - Helper function for GStreamer based movie writing.
psych_bool PsychGetCodecLaunchLineFromString(char* codecSpec, char* launchString);

#endif

//end include once
#endif