亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? avilib.c

?? 一個可以實現嵌入式視頻監控系統的最新版客戶端軟件。
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* *  Some utilities for writing and reading AVI files. *  These are not intended to serve for a full blown *  AVI handling software (this would be much too complex) *  The only intention is to write out MJPEG encoded *  AVIs with sound and to be able to read them back again. *  These utilities should work with other types of codecs too, however. * *  Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de> * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include <stdio.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include "avilib.h"/* The following variable indicates the kind of error */long AVI_errno = 0;/******************************************************************* *                                                                 * *    Utilities for writing an AVI File                            * *                                                                 * *******************************************************************//* AVI_MAX_LEN: The maximum length of an AVI file, we stay a bit below    the 2GB limit (Remember: 2*10^9 is smaller than 2 GB) */#define AVI_MAX_LEN 2000000000/* HEADERBYTES: The number of bytes to reserve for the header */#define HEADERBYTES 2048#define PAD_EVEN(x) ( ((x)+1) & ~1 )/* Copy n into dst as a 4 byte, little endian number.   Should also work on big endian machines */static void long2str(unsigned char *dst, int n){   dst[0] = (n    )&0xff;   dst[1] = (n>> 8)&0xff;   dst[2] = (n>>16)&0xff;   dst[3] = (n>>24)&0xff;}/* Convert a string of 4 or 2 bytes to a number,   also working on big endian machines */static unsigned long str2ulong(unsigned char *str){   return ( str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24) );}static unsigned long str2ushort(unsigned char *str){   return ( str[0] | (str[1]<<8) );}/* Calculate audio sample size from number of bits and number of channels.   This may have to be adjusted for eg. 12 bits and stereo */static int avi_sampsize(avi_t *AVI){   int s;   s = ((AVI->a_bits+7)/8)*AVI->a_chans;   if(s==0) s=1; /* avoid possible zero divisions */   return s;}/* Add a chunk (=tag and data) to the AVI file,   returns -1 on write error, 0 on success */static int avi_add_chunk(avi_t *AVI, unsigned char *tag, unsigned char *data, int length){   unsigned char c[8];   /* Copy tag and length int c, so that we need only 1 write system call      for these two values */   memcpy(c,tag,4);   long2str(c+4,length);   /* Output tag, length and data, restore previous position      if the write fails */   length = PAD_EVEN(length);   if( write(AVI->fdes,c,8) != 8 ||       write(AVI->fdes,data,length) != length )   {      lseek(AVI->fdes,AVI->pos,SEEK_SET);      AVI_errno = AVI_ERR_WRITE;      return -1;   }   /* Update file position */   AVI->pos += 8 + length;   return 0;}static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, long pos, long len){   void *ptr;   if(AVI->n_idx>=AVI->max_idx)   {      ptr = realloc((void *)AVI->idx,(AVI->max_idx+4096)*16);      if(ptr == 0)      {         AVI_errno = AVI_ERR_NO_MEM;         return -1;      }      AVI->max_idx += 4096;      AVI->idx = (unsigned char((*)[16]) ) ptr;   }   /* Add index entry */   memcpy(AVI->idx[AVI->n_idx],tag,4);   long2str(AVI->idx[AVI->n_idx]+ 4,flags);   long2str(AVI->idx[AVI->n_idx]+ 8,pos);   long2str(AVI->idx[AVI->n_idx]+12,len);   /* Update counter */   AVI->n_idx++;   return 0;}/*   AVI_open_output_file: Open an AVI File and write a bunch                         of zero bytes as space for the header.   returns a pointer to avi_t on success, a zero pointer on error*/avi_t* AVI_open_output_file(char * filename){   avi_t *AVI;   int i;   unsigned char AVI_header[HEADERBYTES];   /* Allocate the avi_t struct and zero it */   AVI = (avi_t *) malloc(sizeof(avi_t));   if(AVI==0)   {      AVI_errno = AVI_ERR_NO_MEM;      return 0;   }   memset((void *)AVI,0,sizeof(avi_t));   /* Since Linux needs a long time when deleting big files,      we do not truncate the file when we open it.      Instead it is truncated when the AVI file is closed */   AVI->fdes = open(filename,O_RDWR|O_CREAT,0600);   if (AVI->fdes < 0)   {      AVI_errno = AVI_ERR_OPEN;      free(AVI);      return 0;   }   /* Write out HEADERBYTES bytes, the header will go here      when we are finished with writing */   for (i=0;i<HEADERBYTES;i++) AVI_header[i] = 0;   i = write(AVI->fdes,AVI_header,HEADERBYTES);   if (i != HEADERBYTES)   {      close(AVI->fdes);      AVI_errno = AVI_ERR_WRITE;      free(AVI);      return 0;   }   AVI->pos  = HEADERBYTES;   AVI->mode = AVI_MODE_WRITE; /* open for writing */   return AVI;}void AVI_set_video(avi_t *AVI, int width, int height, double fps, char *compressor){   /* may only be called if file is open for writing */   if(AVI->mode==AVI_MODE_READ) return;   AVI->width  = width;   AVI->height = height;   AVI->fps    = fps;   memcpy(AVI->compressor,compressor,4);   AVI->compressor[4] = 0;}void AVI_set_audio(avi_t *AVI, int channels, long rate, int bits, int format){   /* may only be called if file is open for writing */   if(AVI->mode==AVI_MODE_READ) return;   AVI->a_chans = channels;   AVI->a_rate  = rate;   AVI->a_bits  = bits;   AVI->a_fmt   = format;}#define OUT4CC(s) \   if(nhb<=HEADERBYTES-4) memcpy(AVI_header+nhb,s,4); nhb += 4#define OUTLONG(n) \   if(nhb<=HEADERBYTES-4) long2str(AVI_header+nhb,n); nhb += 4#define OUTSHRT(n) \   if(nhb<=HEADERBYTES-2) { \      AVI_header[nhb  ] = (n   )&0xff; \      AVI_header[nhb+1] = (n>>8)&0xff; \   } \   nhb += 2/*  Write the header of an AVI file and close it.  returns 0 on success, -1 on write error.*/static int avi_close_output_file(avi_t *AVI){   int ret, njunk, sampsize, hasIndex, ms_per_frame, idxerror, flag;   int movi_len, hdrl_start, strl_start;   unsigned char AVI_header[HEADERBYTES];   long nhb;   /* Calculate length of movi list */   movi_len = AVI->pos - HEADERBYTES + 4;   /* Try to ouput the index entries. This may fail e.g. if no space      is left on device. We will report this as an error, but we still      try to write the header correctly (so that the file still may be      readable in the most cases */   idxerror = 0;   ret = avi_add_chunk(AVI,"idx1",(void*)AVI->idx,AVI->n_idx*16);   hasIndex = (ret==0);   if(ret)   {      idxerror = 1;      AVI_errno = AVI_ERR_WRITE_INDEX;   }   /* Calculate Microseconds per frame */   if(AVI->fps < 0.001)      ms_per_frame = 0;   else      ms_per_frame = 1000000./AVI->fps + 0.5;   /* Prepare the file header */   nhb = 0;   /* The RIFF header */   OUT4CC ("RIFF");   OUTLONG(AVI->pos - 8);    /* # of bytes to follow */   OUT4CC ("AVI ");   /* Start the header list */   OUT4CC ("LIST");   OUTLONG(0);        /* Length of list in bytes, don't know yet */   hdrl_start = nhb;  /* Store start position */   OUT4CC ("hdrl");   /* The main AVI header */   /* The Flags in AVI File header */#define AVIF_HASINDEX           0x00000010      /* Index at end of file */#define AVIF_MUSTUSEINDEX       0x00000020#define AVIF_ISINTERLEAVED      0x00000100#define AVIF_TRUSTCKTYPE        0x00000800      /* Use CKType to find key frames */#define AVIF_WASCAPTUREFILE     0x00010000#define AVIF_COPYRIGHTED        0x00020000   OUT4CC ("avih");   OUTLONG(56);                 /* # of bytes to follow */   OUTLONG(ms_per_frame);       /* Microseconds per frame */   OUTLONG(10000000);           /* MaxBytesPerSec, I hope this will never be used */   OUTLONG(0);                  /* PaddingGranularity (whatever that might be) */                                /* Other sources call it 'reserved' */   flag = AVIF_WASCAPTUREFILE;   if(hasIndex) flag |= AVIF_HASINDEX;   if(hasIndex && AVI->must_use_index) flag |= AVIF_MUSTUSEINDEX;   OUTLONG(flag);               /* Flags */   OUTLONG(AVI->video_frames);  /* TotalFrames */   OUTLONG(0);                  /* InitialFrames */   if (AVI->audio_bytes)      { OUTLONG(2); }           /* Streams */   else      { OUTLONG(1); }           /* Streams */   OUTLONG(0);                  /* SuggestedBufferSize */   OUTLONG(AVI->width);         /* Width */   OUTLONG(AVI->height);        /* Height */                                /* MS calls the following 'reserved': */   OUTLONG(0);                  /* TimeScale:  Unit used to measure time */   OUTLONG(0);                  /* DataRate:   Data rate of playback     */   OUTLONG(0);                  /* StartTime:  Starting time of AVI data */   OUTLONG(0);                  /* DataLength: Size of AVI data chunk    */   /* Start the video stream list ---------------------------------- */   OUT4CC ("LIST");   OUTLONG(0);        /* Length of list in bytes, don't know yet */   strl_start = nhb;  /* Store start position */   OUT4CC ("strl");   /* The video stream header */   OUT4CC ("strh");   OUTLONG(64);                 /* # of bytes to follow */   OUT4CC ("vids");             /* Type */   OUT4CC (AVI->compressor);    /* Handler */   OUTLONG(0);                  /* Flags */   OUTLONG(0);                  /* Reserved, MS says: wPriority, wLanguage */   OUTLONG(0);                  /* InitialFrames */   OUTLONG(ms_per_frame);       /* Scale */   OUTLONG(1000000);            /* Rate: Rate/Scale == samples/second */   OUTLONG(0);                  /* Start */   OUTLONG(AVI->video_frames);  /* Length */   OUTLONG(0);                  /* SuggestedBufferSize */   OUTLONG(-1);                 /* Quality */   OUTLONG(0);                  /* SampleSize */   OUTLONG(0);                  /* Frame */   OUTLONG(0);                  /* Frame */   OUTLONG(0);                  /* Frame */   OUTLONG(0);                  /* Frame */   /* The video stream format */   OUT4CC ("strf");   OUTLONG(40);                 /* # of bytes to follow */   OUTLONG(40);                 /* Size */   OUTLONG(AVI->width);         /* Width */   OUTLONG(AVI->height);        /* Height */   OUTSHRT(1); OUTSHRT(24);     /* Planes, Count */   OUT4CC (AVI->compressor);    /* Compression */   OUTLONG(AVI->width*AVI->height);  /* SizeImage (in bytes?) */   OUTLONG(0);                  /* XPelsPerMeter */   OUTLONG(0);                  /* YPelsPerMeter */   OUTLONG(0);                  /* ClrUsed: Number of colors used */   OUTLONG(0);                  /* ClrImportant: Number of colors important */   /* Finish stream list, i.e. put number of bytes in the list to proper pos */   long2str(AVI_header+strl_start-4,nhb-strl_start);   if (AVI->a_chans && AVI->audio_bytes)   {   sampsize = avi_sampsize(AVI);   /* Start the audio stream list ---------------------------------- */   OUT4CC ("LIST");   OUTLONG(0);        /* Length of list in bytes, don't know yet */   strl_start = nhb;  /* Store start position */   OUT4CC ("strl");   /* The audio stream header */   OUT4CC ("strh");   OUTLONG(64);            /* # of bytes to follow */   OUT4CC ("auds");   OUT4CC ("\0\0\0\0");   OUTLONG(0);             /* Flags */   OUTLONG(0);             /* Reserved, MS says: wPriority, wLanguage */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久www免费人成精品| 日韩—二三区免费观看av| 亚洲午夜激情av| 激情丁香综合五月| 在线欧美小视频| 国产精品毛片久久久久久| 日韩精品一二区| 在线观看日韩电影| 国产精品无圣光一区二区| 老司机午夜精品| 在线观看一区日韩| 亚洲欧洲精品成人久久奇米网| 男女激情视频一区| 在线观看亚洲精品视频| 国产精品美女久久久久久| 狠狠v欧美v日韩v亚洲ⅴ| 欧美日韩在线免费视频| 亚洲特级片在线| 成人av网站在线| 久久先锋资源网| 国产毛片精品一区| 精品国产污污免费网站入口| 日韩电影一区二区三区四区| 91麻豆免费看| 亚洲乱码日产精品bd| 91丨九色丨黑人外教| 欧美国产日韩在线观看| 国产精品996| 国产色产综合色产在线视频| 国产精品白丝av| 欧美国产精品一区二区| 国产成人8x视频一区二区| 国产亚洲自拍一区| 不卡欧美aaaaa| 成人欧美一区二区三区1314| jlzzjlzz欧美大全| 国产精品国产成人国产三级| 成人激情开心网| 亚洲欧美欧美一区二区三区| 91麻豆swag| 亚洲国产日韩在线一区模特| 欧美视频在线不卡| 日韩精品视频网| 久久久亚洲综合| 99视频热这里只有精品免费| 一区二区在线观看免费视频播放| 欧美私模裸体表演在线观看| 亚欧色一区w666天堂| 欧美一区二区三区色| 韩国三级电影一区二区| 中文字幕 久热精品 视频在线| 成人毛片视频在线观看| 亚洲综合在线观看视频| 欧美色爱综合网| 国产伦精品一区二区三区在线观看| 久久久久久99精品| 色婷婷久久久综合中文字幕| 婷婷成人综合网| 国产亚洲欧美中文| 91在线无精精品入口| 日韩电影在线观看一区| 中文字幕巨乱亚洲| 欧美日韩一区二区在线观看视频| 老司机免费视频一区二区| 成人免费在线视频观看| 日韩三级免费观看| 色香蕉成人二区免费| 久久国产成人午夜av影院| 最近中文字幕一区二区三区| 欧美一级高清片在线观看| 成人污污视频在线观看| 午夜视频在线观看一区二区三区| 久久亚洲二区三区| 欧美乱熟臀69xxxxxx| 成人晚上爱看视频| 国内外成人在线视频| 亚洲成人黄色影院| 亚洲四区在线观看| 久久九九久精品国产免费直播| 欧美在线观看一二区| 国产91对白在线观看九色| 日本美女视频一区二区| 亚洲精品一卡二卡| 日本一区二区三区国色天香| 欧美一区二区三区四区久久| 91黄色激情网站| 成人黄页毛片网站| 精品午夜久久福利影院| 三级在线观看一区二区| 综合久久久久久| 国产精品女主播av| 最新国产の精品合集bt伙计| 国产**成人网毛片九色| 亚洲一区二区综合| 中文字幕一区二区三区在线播放| 激情文学综合插| 亚洲精品亚洲人成人网 | 亚洲6080在线| 亚洲影院理伦片| 91污在线观看| 色偷偷一区二区三区| 欧美日韩一区二区不卡| 久久天堂av综合合色蜜桃网| 欧美国产一区二区在线观看| 亚洲影院在线观看| 国产一区欧美日韩| 91麻豆国产福利精品| 91精品国产黑色紧身裤美女| 国产日韩三级在线| 亚洲成a人片在线观看中文| 国产一区二区0| 欧美优质美女网站| 久久精子c满五个校花| 亚洲一区二区三区在线播放 | 免费美女久久99| 国产大陆精品国产| 欧美乱妇15p| 中日韩av电影| 免费av成人在线| 99久久精品国产一区二区三区| 制服.丝袜.亚洲.另类.中文| 亚洲国产精品黑人久久久| 日韩中文字幕91| jlzzjlzz亚洲日本少妇| 欧美成人伊人久久综合网| 亚洲黄色免费电影| 国产一区在线观看麻豆| 在线观看三级视频欧美| 国产情人综合久久777777| 日韩福利电影在线| 色欧美日韩亚洲| 中文字幕的久久| 久草在线在线精品观看| 欧美另类变人与禽xxxxx| 国产精品麻豆一区二区| 九一久久久久久| 欧美日韩国产美女| 亚洲欧美欧美一区二区三区| 国产精品亚洲第一| 欧美成人video| 日韩在线卡一卡二| 在线中文字幕一区| 国产精品电影一区二区| 国产精品亚洲成人| 亚洲精品一区二区三区香蕉| 亚洲韩国精品一区| 91在线看国产| 国产精品欧美久久久久一区二区| 免费欧美高清视频| 这里只有精品电影| 婷婷六月综合网| 欧美日韩中文精品| 亚洲小说欧美激情另类| 99re亚洲国产精品| 中文字幕中文乱码欧美一区二区 | 无吗不卡中文字幕| 在线影视一区二区三区| 伊人开心综合网| 色婷婷av一区二区三区软件| 亚洲欧美一区二区在线观看| 不卡影院免费观看| ●精品国产综合乱码久久久久| 高清beeg欧美| 国产欧美一区二区三区沐欲 | 99v久久综合狠狠综合久久| 国产精品毛片久久久久久| 成人精品高清在线| 国产精品国产自产拍高清av王其| 大胆欧美人体老妇| 亚洲天堂av老司机| 欧美伊人久久久久久久久影院 | 婷婷综合久久一区二区三区| 欧美片在线播放| 麻豆成人在线观看| 久久久久久久久免费| 国产高清视频一区| 国产精品成人一区二区三区夜夜夜 | 亚洲精品国产视频| 欧美色国产精品| 免费久久精品视频| 久久久久久久久久久久电影 | 国产福利一区在线| 国产精品国产三级国产专播品爱网| 99久久精品国产麻豆演员表| 亚洲人亚洲人成电影网站色| 在线观看免费成人| 日韩黄色小视频| 久久亚洲精华国产精华液 | 国产精品一区二区久久精品爱涩| 久久这里只有精品首页| 懂色av一区二区夜夜嗨| 亚洲私人黄色宅男| 欧美色图第一页| 国内成+人亚洲+欧美+综合在线| 久久久久综合网| 91国产福利在线| 国产美女精品一区二区三区| 亚洲色欲色欲www在线观看| 欧美日韩精品福利| 风间由美中文字幕在线看视频国产欧美 |