?? grab-ng.h
字號:
/* --------------------------------------------------------------------- */void ng_ratio_fixup(int *width, int *height, int *xoff, int *yoff);void ng_ratio_fixup2(int *width, int *height, int *xoff, int *yoff, int ratio_x, int ratio_y, int up);/* --------------------------------------------------------------------- *//* capture/overlay + sound interface drivers */struct ng_vid_driver { const char *name; int priority; /* open/close */ struct ng_devinfo* (*probe)(int debug); void* (*init)(char *device); int (*open)(void *handle); int (*close)(void *handle); int (*fini)(void *handle); char* (*devname)(void *handle); char* (*busname)(void *handle); /* attributes */ int (*capabilities)(void *handle); struct ng_attribute* (*list_attrs)(void *handle);#if 0 /* overlay */ int (*setupfb)(void *handle, struct ng_video_fmt *fmt, void *base); int (*overlay)(void *handle, struct ng_video_fmt *fmt, int x, int y, struct OVERLAY_CLIP *oc, int count, int aspect);#else int (*overlay)(void *handle, int enable, int aspect, long window, int dw, int dh);#endif /* capture */ int (*setformat)(void *handle, struct ng_video_fmt *fmt); int (*startvideo)(void *handle, int fps, unsigned int buffers); void (*stopvideo)(void *handle); struct ng_video_buf* (*nextframe)(void *handle); /* video frame */ struct ng_video_buf* (*getimage)(void *handle); /* single image */ /* read MPEG stream */ char* (*setup_mpeg)(void *handle, int flags); /* tuner */ unsigned long (*getfreq)(void *handle); void (*setfreq)(void *handle, unsigned long freq); int (*is_tuned)(void *handle); struct list_head list;};struct ng_dsp_driver { const char *name; int priority; /* open/close */ struct ng_devinfo* (*probe)(int record, int debug); void* (*init)(char *device, int record); int (*open)(void *handle); int (*close)(void *handle); int (*fini)(void *handle); char* (*devname)(void *handle); /* record/playback */ int (*setformat)(void *handle, struct ng_audio_fmt *fmt); int (*fd)(void *handle); int (*startrec)(void *handle); int (*startplay)(void *handle); struct ng_audio_buf* (*read)(void *handle, int64_t stopby); struct ng_audio_buf* (*write)(void *handle, struct ng_audio_buf *buf); int64_t (*latency)(void *handle); struct list_head list;};struct ng_mix_driver { const char *name; int priority; struct ng_devinfo* (*probe)(int debug); struct ng_devinfo* (*channels)(char *device); void* (*init)(char *device, char *control); int (*open)(void *handle); int (*close)(void *handle); int (*fini)(void *handle); char* (*devname)(void *handle); struct ng_attribute* (*list_attrs)(void *handle); struct list_head list;};struct ng_devinfo { char device[32]; char name[32]; char bus[32]; int flags;};struct ng_devstate { enum { NG_DEV_NONE = 0, NG_DEV_VIDEO = 1, NG_DEV_DSP = 2, NG_DEV_MIX = 3, } type; union { struct ng_vid_driver *v; struct ng_dsp_driver *a; struct ng_mix_driver *m; }; char *device; void *handle; struct list_head attrs; int flags; int refcount;};/* --------------------------------------------------------------------- *//* frame processing (color space conversion / compression / filtering) */typedef struct ng_video_buf* (*ng_get_video_buf) (void *handle, struct ng_video_fmt *fmt);typedef struct ng_audio_buf* (*ng_get_audio_buf) (void *handle);enum ng_process_mode { NG_MODE_UNDEF = 0, NG_MODE_TRIVIAL = 1, NG_MODE_COMPLEX = 2,};struct ng_video_process { enum ng_process_mode mode; /* trivial filters -- one frame in, one frame out */ void (*frame)(void *handle, struct ng_video_buf *out, struct ng_video_buf *in); /* complex filters -- anything trivial can't handle */ void (*setup)(void *handle, ng_get_video_buf get, void *ghandle); void (*put_frame)(void *handle, struct ng_video_buf* buf); struct ng_video_buf* (*get_frame)(void *handle); /* cleanup */ void (*fini)(void *handle);};struct ng_video_conv { void* (*init)(struct ng_video_fmt *out, void *priv); struct ng_video_process p; unsigned int fmtid_in; unsigned int fmtid_out; void *priv; struct list_head list;};struct ng_video_filter { void* (*init)(struct ng_video_fmt *fmt); struct ng_video_process p; char *name; int fmts; struct ng_attribute* attrs; struct list_head list;};struct ng_process_handle;struct ng_process_handle* ng_conv_init(struct ng_video_conv *conv, struct ng_video_fmt *i, struct ng_video_fmt *o);struct ng_process_handle* ng_filter_init(struct ng_video_filter *filter, struct ng_video_fmt *fmt);void ng_process_setup(struct ng_process_handle*, ng_get_video_buf get, void *ghandle);void ng_process_put_frame(struct ng_process_handle*, struct ng_video_buf*);struct ng_video_buf* ng_process_get_frame(struct ng_process_handle*);void ng_process_fini(struct ng_process_handle*);#if 0struct ng_convert_handle* ng_convert_alloc(struct ng_video_conv *conv, struct ng_video_fmt *i, struct ng_video_fmt *o);void ng_convert_init(struct ng_convert_handle *h);struct ng_video_buf* ng_convert_frame(struct ng_convert_handle *h, struct ng_video_buf *dest, struct ng_video_buf *buf);void ng_convert_fini(struct ng_convert_handle *h);struct ng_video_buf* ng_convert_single(struct ng_convert_handle *h, struct ng_video_buf *in);#endif/* --------------------------------------------------------------------- *//* audio converters */struct ng_audio_conv { unsigned int fmtid_in; unsigned int fmtid_out; void* (*init)(void *priv); struct ng_audio_buf* (*data)(void *handle, struct ng_audio_buf *in); void (*fini)(void *handle); void *priv; struct list_head list;};/* --------------------------------------------------------------------- *//* must be changed if we break compatibility */#define NG_PLUGIN_MAGIC 0x20041201#define __init __attribute__ ((constructor))#define __fini __attribute__ ((destructor))#ifndef __used#define __used __attribute__ ((used))#endifextern struct list_head ng_conv;extern struct list_head ng_aconv;extern struct list_head ng_filters;extern struct list_head ng_writers;extern struct list_head ng_readers;extern struct list_head ng_vid_drivers;extern struct list_head ng_dsp_drivers;extern struct list_head ng_mix_drivers;int ng_conv_register(int magic, char *plugname, struct ng_video_conv *list, int count);int ng_aconv_register(int magic, char *plugname, struct ng_audio_conv *list, int count);int ng_filter_register(int magic, char *plugname, struct ng_video_filter *filter);int ng_writer_register(int magic, char *plugname, struct ng_writer *writer);int ng_reader_register(int magic, char *plugname, struct ng_reader *reader);int ng_vid_driver_register(int magic, char *plugname, struct ng_vid_driver *driver);int ng_dsp_driver_register(int magic, char *plugname, struct ng_dsp_driver *driver);int ng_mix_driver_register(int magic, char *plugname, struct ng_mix_driver *driver);struct ng_video_conv* ng_conv_find_to(unsigned int out, int *i);struct ng_video_conv* ng_conv_find_from(unsigned int out, int *i);struct ng_video_conv* ng_conv_find_match(unsigned int in, unsigned int out);struct ng_devinfo* ng_vid_probe(char *driver);int ng_vid_init(struct ng_devstate *dev, char *device);int ng_dsp_init(struct ng_devstate *dev, char *device, int record);int ng_mix_init(struct ng_devstate *dev, char *device, char *control);int ng_dev_fini(struct ng_devstate *dev);int ng_dev_open(struct ng_devstate *dev);int ng_dev_close(struct ng_devstate *dev);int ng_dev_users(struct ng_devstate *dev);int ng_chardev_open(char *device, int flags, int major, int complain);struct ng_reader* ng_find_reader_magic(char *filename);struct ng_reader* ng_find_reader_name(char *name);struct ng_writer* ng_find_writer_name(char *name);int64_t ng_tofday_to_timestamp(struct timeval *tv);int64_t ng_get_timestamp(void);void ng_check_clipping(int width, int height, int xadjust, int yadjust, struct OVERLAY_CLIP *oc, int *count);struct ng_video_buf* ng_filter_single(struct ng_video_filter *filter, struct ng_video_buf *in);/* --------------------------------------------------------------------- */void ng_init(void);void ng_print_stacktrace(void);void ng_lut_init(unsigned long red_mask, unsigned long green_mask, unsigned long blue_mask, unsigned int fmtid, int swap);void ng_rgb24_to_lut2(unsigned char *dest, unsigned char *src, int p);void ng_rgb24_to_lut4(unsigned char *dest, unsigned char *src, int p);/* --------------------------------------------------------------------- *//* internal stuff starts here */#ifdef NG_PRIVATE/* for yuv2rgb using lookup tables (color_lut.c, color_yuv2rgb.c) */extern int32_t ng_lut_red[256];extern int32_t ng_lut_green[256];extern int32_t ng_lut_blue[256];void ng_yuv422_to_lut2(unsigned char *dest, unsigned char *s, int p);void ng_yuv422_to_lut4(unsigned char *dest, unsigned char *s, int p);void ng_yuv420p_to_lut2(void *h, struct ng_video_buf *out, struct ng_video_buf *in);void ng_yuv420p_to_lut4(void *h, struct ng_video_buf *out, struct ng_video_buf *in);void ng_yuv422p_to_lut2(void *h, struct ng_video_buf *out, struct ng_video_buf *in);void ng_yuv422p_to_lut4(void *h, struct ng_video_buf *out, struct ng_video_buf *in);void __init yuv2rgb_init(void);void __init packed_init(void);/* color_common.c stuff */void* ng_packed_init(struct ng_video_fmt *out, void *priv);void ng_packed_frame(void *handle, struct ng_video_buf *out, struct ng_video_buf *in);void* ng_conv_nop_init(struct ng_video_fmt *out, void *priv);void ng_conv_nop_fini(void *handle);#define NG_GENERIC_PACKED \ .init = ng_packed_init, \ .p.mode = NG_MODE_TRIVIAL, \ .p.frame = ng_packed_frame, \ .p.fini = ng_conv_nop_fini#endif /* NG_PRIVATE *//* --------------------------------------------------------------------- *//* * Local variables: * compile-command: "(cd ..; make)" * End: */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -