~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to src/job.h

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-25 15:47:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080225154712-qvr11ekcea4c9ry8
Tags: 1.1.6-0.1ubuntu1
* Merge from debian-multimedia (LP: #120003), Ubuntu Changes:
 - For ffmpeg-related build-deps, remove cvs from package names.
 - Standards-Version 3.7.3
 - Maintainer Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file job.h
 
3
 *
 
4
 * \todo rename the Job struct to XVC_Job
 
5
 */
1
6
/*
2
 
 * job.h
3
 
 *
4
7
 * Copyright (C) 1997-98 Rasca, Berlin
5
 
 * Copyright (C) 2003,04 Karl, Frankfurt
 
8
 * Copyright (C) 2003-07 Karl, Frankfurt
6
9
 *
7
10
 * This program is free software; you can redistribute it and/or modify
8
11
 * it under the terms of the GNU General Public License as published by
11
14
 *
12
15
 * This program is distributed in the hope that it will be useful,
13
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
18
 * GNU General Public License for more details.
16
19
 *
17
20
 * You should have received a copy of the GNU General Public License
18
21
 * along with this program; if not, write to the Free Software
19
22
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
23
 */
 
24
 
 
25
#ifndef __JOB_H__
 
26
#define __JOB_H__
 
27
 
 
28
#ifndef DOXYGEN_SHOULD_SKIP_THIS
21
29
#include <X11/Intrinsic.h>
22
 
 
23
 
#ifndef _JOB_H_
24
 
#define _JOB_H_
25
 
 
26
 
/*
27
 
 */
28
 
typedef struct _Job {
29
 
        float fps;                      /* frames per second */
30
 
        char *file;                     /* filename */
31
 
        int flags;                      /* different flags .. see app_data.h */
32
 
        int state;                      /* state flags */
33
 
        int start_no;           /* start number */
34
 
        int pic_no;                     /* current pic number */
35
 
        int movie_no;           /* current movie number */
36
 
        int step;                       /* number to use for increasing pic number */
37
 
        int time_per_frame; /* time per frame in milli secs */
38
 
        int max_frames;         /* max number of frames to record */
39
 
        float max_time;
40
 
        int compress;           /* for zlib and png */
41
 
        int quality;            /* needed for jpeg */
42
 
        char open_flags[8];
43
 
        int bpp;                        /* for video4linux */
44
 
        int vid_dev;            /* file descriptor for video device */
45
 
        int snd_dev;            /* file descriptor for sound device */
46
 
        int snd_rate;
47
 
        int snd_smplsize;
48
 
        int snd_channels;
49
 
        int mouseWanted;        /* 0 none , 1 white , 2 black */
50
 
        char *video_dev;        /* video device */
51
 
        char *snd_device;       /* sound device */
52
 
 
53
 
        /* some function pointers
54
 
         */
55
 
        void *(*get_colors)(XColor *, int);
56
 
        void *(*open)(char *, char *);
57
 
        int   (*write)(void *, unsigned int, unsigned int, void *);
58
 
        int   (*close)(void *);
59
 
        void  (*save)(FILE *, XImage *, struct _Job *);
60
 
        void  (*clean)(struct _Job *);
61
 
        Boolean  (*capture)(void *, unsigned long *);
62
 
 
63
 
        /* target format, e.g. CAP_XWD
64
 
         */
65
 
        int target;
66
 
        int targetCodec;
67
 
        unsigned long crc;
68
 
        int ncolors;
69
 
 
70
 
        /* color table for the output file
71
 
         */
72
 
        void *color_table;
73
 
        XColor *colors;
74
 
        XWindowAttributes win_attr;
75
 
//      Widget toplevel;
76
 
        XRectangle *area;
 
30
#include <stdio.h>
 
31
#include "app_data.h"
 
32
#include "colors.h"
 
33
 
 
34
#ifdef USE_XDAMAGE
 
35
#include <X11/extensions/Xfixes.h>
 
36
#include <X11/extensions/Xdamage.h>
 
37
#endif     // USE_XDAMAGE
 
38
 
 
39
#ifdef HAVE_CONFIG_H
 
40
# include <config.h>
 
41
#endif
 
42
#endif     // DOXYGEN_SHOULD_SKIP_THIS
 
43
 
 
44
/**
 
45
 * \brief state flags for the recording state machine
 
46
 */
 
47
enum JobStates
 
48
{
 
49
    VC_STOP = 1,
 
50
    VC_START = 2,
 
51
    VC_REC = 4,
 
52
    VC_PAUSE = 8,
 
53
    VC_STEP = 16,
 
54
    VC_READY = 32,
 
55
    VC_CONTINUE = 64
 
56
};
 
57
 
 
58
/**
 
59
 * \brief keeps data about the current recording job
 
60
 *
 
61
 * The stuff here is partly volatile information augmenting the preferences
 
62
 * set in an XVC_AppData struct, partly settings which are derived from
 
63
 * the preferences. For example, target may be set to autodetect in the
 
64
 * preferences, but here we need the final (potentially autodetected)
 
65
 * target.
 
66
 */
 
67
typedef struct _Job
 
68
{
 
69
    /** \brief filename */
 
70
    char *file;
 
71
    /**
 
72
     * \brief various flags
 
73
     *
 
74
     * @see app_data.h
 
75
     */
 
76
    int flags;
 
77
    /** \brief state flags */
 
78
    int state;
 
79
    /** \brief current pic number */
 
80
    int pic_no;
 
81
    /** \brief current movie number */
 
82
    int movie_no;
 
83
    /** \brief time per frame in milli secs */
 
84
    int time_per_frame;
 
85
#ifdef HAVE_FFMPEG_AUDIO
 
86
    /** \brief sound device */
 
87
    char *snd_device;
 
88
#endif     // HAVE_FFMPEG_AUDIO
 
89
 
 
90
    /*
 
91
     * some function pointers
 
92
     */
 
93
    /** \brief function to retrieve color information */
 
94
    void *(*get_colors) (XColor *, int);
 
95
    /** \brief function used to save a captured frame */
 
96
    void (*save) (FILE *, XImage *);
 
97
    /** \brief function used to cleanup after a recording session */
 
98
    void (*clean) ();
 
99
    /** \brief function to capture the frames */
 
100
    long (*capture) ();
 
101
 
 
102
    /*
 
103
     * target format, e.g. CAP_XWD
 
104
     */
 
105
    /**
 
106
     * \brief target format
 
107
     *
 
108
     * @see app_data.h
 
109
     */
 
110
    int target;
 
111
    /**
 
112
     * \brief target video codec
 
113
     *
 
114
     * @see app_data.h
 
115
     */
 
116
    int targetCodec;
 
117
    /**
 
118
     * \brief target audio codec
 
119
     *
 
120
     * @see app_data.h
 
121
     */
 
122
    int au_targetCodec;
 
123
 
 
124
    /*
 
125
     * color information for the output file
 
126
     */
 
127
    /** \brief the number of colors in the pseudo color color table */
 
128
    int ncolors;
 
129
    /** \brief the color table as the output API requires it */
 
130
    void *color_table;
 
131
    /** \brief the colors as X11 sends them with the captured image */
 
132
    XColor *colors;
 
133
    /** \brief color information retrieved from first XImage */
 
134
    ColorInfo *c_info;
 
135
 
 
136
#ifdef USE_XDAMAGE
 
137
    XserverRegion dmg_region;
 
138
#endif     // USE_XDAMAGE
 
139
 
77
140
} Job;
78
141
 
79
 
/*
80
 
 * state flags
81
 
 */
82
 
#define VC_STOP         1
83
 
#define VC_START        2
84
 
#define VC_REC          4
85
 
#define VC_PAUSE        8
86
 
#define VC_STEP         16
87
 
#define VC_READY        32
88
 
#define VC_CONTINUE     64
89
 
 
90
 
/*
91
 
 * capture output formats
92
 
 */
93
 
#define CAP_XWD 1
94
 
#define CAP_PNM 2
95
 
#define CAP_PNG 3
96
 
#define CAP_MNG 4
97
 
#define CAP_JPG 5
98
 
#define CAP_QTR 6
99
 
#define CAP_QTJ 7
100
 
#define CAP_QTP 8
101
 
#define CAP_FFM 9
102
 
#define CAP_AVI 9
103
 
#define CAP_ASF 10
104
 
#define CAP_FLV 11
105
 
 
106
 
Job *job_init (int flags);
107
 
Job *job_ptr (void);
108
 
int  job_set_sound_dev (char *, int, int, int);
109
 
void  job_set_fps (float fps);
110
 
float job_fps (void);
111
 
void  job_set_file (char *file);
112
 
char *job_file (void);
113
 
void job_set_compression (int comp);
114
 
int  job_compression (void);
115
 
void job_set_shm (int shm);
116
 
void job_set_capture (void);
117
 
int  job_shm (void);
118
 
void job_set_quality (int quality);
119
 
int  job_quality (void);
120
 
void job_set_save_function (Visual *vis, int type, Job *jobp);
121
 
Boolean is_filename_mutable(char*);
122
 
#endif
 
142
void xvc_job_free ();
 
143
void xvc_job_set_from_app_data (XVC_AppData * app);
 
144
Job *xvc_job_ptr (void);
 
145
void xvc_job_dump ();
 
146
void xvc_job_set_save_function (XVC_FFormatID type);
 
147
void xvc_job_set_colors ();
 
148
 
 
149
void xvc_job_set_state (int state);
 
150
void xvc_job_merge_state (int state);
 
151
void xvc_job_remove_state (int state);
 
152
void xvc_job_merge_and_remove_state (int merge_state, int remove_state);
 
153
void xvc_job_keep_state (int state);
 
154
void xvc_job_keep_and_merge_state (int merge_state, int remove_state);
 
155
 
 
156
#ifdef USE_XDAMAGE
 
157
XserverRegion xvc_get_damage_region ();
 
158
#endif     // USE_XDAMAGE
 
159
#endif     // __JOB_H__