⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdatabuf.c

📁 有关嵌入式的摄像头视频采集的论文
💻 C
字号:
/********************************************************************* * webcam_server                                                     * *                                                                   * * (c) 2002 Donn Morrison donn@donn.dyndns.org                       * *                                                                   * * code used from Gerd Knorr's xawtv (libng)                         * * - and -                                                           * * Cory Lueninghoener's gqcam                                        * *                                                                   * *    waits for connections from a viewer and sends                  * *    jpeg encoded captures as a live video feed                     * *                                                                   * *********************************************************************/#ifndef _WCSJPEG_H_INCLUDED_#define _WCSJPEG_H_INCLUDED_#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include "jdatabuf.h"#define DEFAULT_JPEG_SIZE	20000	/* default jpeg size (bytes) *//*-----------------------------------------------------------  jpeg data buffer stuff  -----------------------------------------------------------*///METHODDEF(void)voidinit_destination (j_compress_ptr cinfo){  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;  dest->buffer = (char *)malloc(DEFAULT_JPEG_SIZE * sizeof(JOCTET));    dest->pub.next_output_byte = dest->buffer;  dest->pub.free_in_buffer = DEFAULT_JPEG_SIZE;  dest->total_buffer_size = DEFAULT_JPEG_SIZE;}//METHODDEF(boolean)booleanempty_output_buffer (j_compress_ptr cinfo){  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;  u_char *tmp;  long size;  size = dest->total_buffer_size;  /* re-allocate more memory (another DEFAULT_JPEG_SIZE block) */  tmp = (char *)realloc(dest->buffer, (dest->total_buffer_size + DEFAULT_JPEG_SIZE) * sizeof(JOCTET));  if(tmp == NULL)  {    fprintf(stderr, "empty_output_buffer: couldn't allocate more memory for jpeg (%ld bytes)\n",            (dest->total_buffer_size + DEFAULT_JPEG_SIZE) * sizeof(JOCTET));    return FALSE;  }  dest->total_buffer_size += DEFAULT_JPEG_SIZE;  dest->buffer = tmp;  /* reset the free_in_buffer counter */  dest->pub.free_in_buffer = dest->total_buffer_size - size;  dest->pub.next_output_byte = dest->buffer + size;  return TRUE;}//METHODDEF(void)voidterm_destination (j_compress_ptr cinfo){}//GLOBAL(void)voidjpeg_buff_dest (j_compress_ptr cinfo){  my_dest_ptr dest;  if (cinfo->dest == NULL) {	/* first time for this JPEG object? */    cinfo->dest = (struct jpeg_destination_mgr *)      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,				  sizeof(my_destination_mgr));  }  dest = (my_dest_ptr) cinfo->dest;  dest->pub.init_destination = init_destination;  dest->pub.empty_output_buffer = empty_output_buffer;  dest->pub.term_destination = term_destination;}//METHODDEF(long)longget_jpeg_size (j_compress_ptr cinfo){	my_dest_ptr dest = (my_dest_ptr) cinfo->dest;		return (long)(dest->pub.next_output_byte - dest->buffer);}//METHODDEF(void)voidjpeg_buff_free (j_compress_ptr cinfo){  my_dest_ptr dest = (my_dest_ptr) cinfo->dest;    free(dest->buffer);}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -