~ubuntu-branches/debian/sid/v4l-utils/sid

« back to all changes in this revision

Viewing changes to lib/libv4l2/libv4l2-priv.h

  • Committer: Bazaar Package Importer
  • Author(s): Gregor Jasny
  • Date: 2010-05-07 20:48:34 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100507204834-ga01cxhz3fekk47r
Tags: 0.8.0-1
* New upstream version
* Switch to 3.0 (quilt) source format
* Re-enable pristine-tar
* Split utils package into command line and the Qt based qv4l2
  (Closes: #576422)
* Update upstream URL

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# You should have received a copy of the GNU Lesser General Public License
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 
*/
 
17
 */
18
18
 
19
19
#ifndef __LIBV4L2_PRIV_H
20
20
#define __LIBV4L2_PRIV_H
34
34
#define V4L2_FRAME_BUF_SIZE (4096 * 4096)
35
35
#define V4L2_IGNORE_FIRST_FRAME_ERRORS 3
36
36
 
37
 
#define V4L2_LOG_ERR(...) \
38
 
  do { \
39
 
    if (v4l2_log_file) { \
40
 
      fprintf(v4l2_log_file, "libv4l2: error " __VA_ARGS__); \
41
 
      fflush(v4l2_log_file); \
42
 
    } else \
43
 
      fprintf(stderr, "libv4l2: error " __VA_ARGS__); \
44
 
  } while(0)
45
 
 
46
 
#define V4L2_LOG_WARN(...) \
47
 
  do { \
48
 
    if (v4l2_log_file) { \
49
 
      fprintf(v4l2_log_file, "libv4l2: warning " __VA_ARGS__); \
50
 
      fflush(v4l2_log_file); \
51
 
    } else \
52
 
      fprintf(stderr, "libv4l2: warning " __VA_ARGS__); \
53
 
  } while(0)
54
 
 
55
 
#define V4L2_LOG(...) \
56
 
  do { \
57
 
    if (v4l2_log_file) { \
58
 
      fprintf(v4l2_log_file, "libv4l2: " __VA_ARGS__); \
59
 
      fflush(v4l2_log_file); \
60
 
    } \
61
 
  } while(0)
62
 
 
63
 
#define MIN(a,b) (((a)<(b))?(a):(b))
 
37
#define V4L2_LOG_ERR(...)                       \
 
38
        do {                                    \
 
39
                if (v4l2_log_file) {            \
 
40
                        fprintf(v4l2_log_file, "libv4l2: error " __VA_ARGS__); \
 
41
                        fflush(v4l2_log_file);  \
 
42
                } else                          \
 
43
                fprintf(stderr, "libv4l2: error " __VA_ARGS__); \
 
44
        } while (0)
 
45
 
 
46
#define V4L2_LOG_WARN(...)                      \
 
47
        do {                                    \
 
48
                if (v4l2_log_file) {            \
 
49
                        fprintf(v4l2_log_file, "libv4l2: warning " __VA_ARGS__); \
 
50
                        fflush(v4l2_log_file);  \
 
51
                } else                          \
 
52
                fprintf(stderr, "libv4l2: warning " __VA_ARGS__); \
 
53
        } while (0)
 
54
 
 
55
#define V4L2_LOG(...)                           \
 
56
        do {                                    \
 
57
                if (v4l2_log_file) {            \
 
58
                        fprintf(v4l2_log_file, "libv4l2: " __VA_ARGS__); \
 
59
                        fflush(v4l2_log_file);  \
 
60
                }                               \
 
61
        } while (0)
 
62
 
 
63
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
64
64
 
65
65
struct v4l2_dev_info {
66
 
  int fd;
67
 
  int flags;
68
 
  int open_count;
69
 
  /* actually format of the cam */
70
 
  struct v4l2_format src_fmt;
71
 
  /* fmt as seen by the application (iow after conversion) */
72
 
  struct v4l2_format dest_fmt;
73
 
  pthread_mutex_t stream_lock;
74
 
  unsigned int no_frames;
75
 
  unsigned int nreadbuffers;
76
 
  int first_frame;
77
 
  struct v4lconvert_data *convert;
78
 
  unsigned char *convert_mmap_buf;
79
 
  /* Frame bookkeeping is only done when in read or mmap-conversion mode */
80
 
  unsigned char *frame_pointers[V4L2_MAX_NO_FRAMES];
81
 
  int frame_sizes[V4L2_MAX_NO_FRAMES];
82
 
  int frame_queued; /* 1 status bit per frame */
83
 
  /* mapping tracking of our fake (converting mmap) frame buffers */
84
 
  unsigned char frame_map_count[V4L2_MAX_NO_FRAMES];
85
 
  /* buffer when doing conversion and using read() for read() */
86
 
  int readbuf_size;
87
 
  unsigned char *readbuf;
 
66
        int fd;
 
67
        int flags;
 
68
        int open_count;
 
69
        /* actually format of the cam */
 
70
        struct v4l2_format src_fmt;
 
71
        /* fmt as seen by the application (iow after conversion) */
 
72
        struct v4l2_format dest_fmt;
 
73
        pthread_mutex_t stream_lock;
 
74
        unsigned int no_frames;
 
75
        unsigned int nreadbuffers;
 
76
        int first_frame;
 
77
        struct v4lconvert_data *convert;
 
78
        unsigned char *convert_mmap_buf;
 
79
        /* Frame bookkeeping is only done when in read or mmap-conversion mode */
 
80
        unsigned char *frame_pointers[V4L2_MAX_NO_FRAMES];
 
81
        int frame_sizes[V4L2_MAX_NO_FRAMES];
 
82
        int frame_queued; /* 1 status bit per frame */
 
83
        /* mapping tracking of our fake (converting mmap) frame buffers */
 
84
        unsigned char frame_map_count[V4L2_MAX_NO_FRAMES];
 
85
        /* buffer when doing conversion and using read() for read() */
 
86
        int readbuf_size;
 
87
        unsigned char *readbuf;
88
88
};
89
89
 
90
90
/* From log.c */