1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef VIDEOUTIL_H
- #define VIDEOUTIL_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define VIDEO_FORMAT_I420 0x01
- #define VIDEO_FORMAT_RGB24 0x02
- #define IP_UDP_HEADER_SIZE (20 + 8)
- #define RTP_HEADER_SIZE 12
- typedef struct video_frame {
- unsigned char *data[4];
- int linesize[4];
- int width;
- int height;
- int format; /* VIDEO_FORMAT_xxx */
- }video_frame;
- typedef union video_timestamp {
- struct {
- unsigned int lo;
- int hi;
- }u32;
- __int64 u64;
- }video_timestamp;
- typedef struct __video_frame_scale_t video_frame_scale_t;
- /**
- * alloc memory for a video frame, return 0 on success
- */
- int video_frame_alloc(int width, int height, int format, video_frame *frame);
- /**
- * free memory of a video frame
- */
- void video_frame_free(video_frame *frame);
- /**
- * copy src frame to dst frame, return 0 on success
- */
- int video_frame_copy(video_frame *dst, video_frame *src);
- int video_get_timestamp(video_timestamp *p_ts);
- int video_get_timestamp_freq(video_timestamp *p_freq);
- /**
- * save videoframe as bmp file, only accept rgb24 frame
- * @param bmpfile save file path
- * @param frame the rgb24 format frame
- * @return 0 on success
- */
- int video_frame_save_bmpfile(const char*bmpfile, video_frame *frame);
- video_frame *video_frame_new(int width, int height, int format);
- void video_frame_delete(video_frame *frame);
- int video_frame_fill_black(video_frame *frame);
- video_frame_scale_t *video_frame_scale_create(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
- void video_frame_scale_destroy(video_frame_scale_t *);
- int video_frame_scale_process(video_frame_scale_t *scale, unsigned char **src_data, int *src_linesize, int y, int h, unsigned char **dst_data, int *dst_linesize);
- #ifdef __cplusplus
- }//extern "C" {
- #endif
- #endif // VIDEOUTIL_H
|