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

📄 store.c

📁 <VC++视频音频开发>一书的光盘资料。
💻 C
字号:


#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>

#include "mp4_vars.h"

#include "debug.h"
#include "store.h"

/**
 *
**/

static void store_yuv (char *name, unsigned char *src, int offset, int incr, int width, int height);
static void putbyte (int c);

/**/

FILE * outfile;
int create_flag = 1;
const char mode_create[] = "wb";
const char mode_open[] = "ab";

/***/


void storeframe (unsigned char *src[], int width, int height)
{
	int offset = 0;
	int hor_size = mp4_state->horizontal_size;

  store_yuv (mp4_state->outputname, src[0], offset, width, hor_size, height);

  offset >>= 1;
  width >>= 1;
  height >>= 1;
	hor_size >>= 1;

  store_yuv (mp4_state->outputname, src[1], offset, width, hor_size, height);
  store_yuv (mp4_state->outputname, src[2], offset, width, hor_size, height);
}

/***/

static void store_yuv (char *name, unsigned char *src, int offset, 
                        int incr, int width, int height)
{
  int i;
  unsigned char *p;
	const char * mode = create_flag ? mode_create : mode_open;


	if (create_flag)
		create_flag = 0;

  if ((outfile = fopen (name, mode)) == NULL)
  {
    _Print ("Error: Couldn't append to %s\n", name);
    exit(0);
  }

  for (i = 0; i < height; i++)
  {
    p = src + offset + incr * i;
		fwrite(p, width, 1, outfile);
  }

  fclose (outfile);
}

⌨️ 快捷键说明

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