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

📄 eg_1.cpp

📁 实现多序列连续播放功能!对于视频编解码很有用途。
💻 CPP
字号:
// eg_1.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "stdio.h"

#define uint8_t  unsigned char
#define int32_t  int

int main()
{

	int total_no,total_no2;
	char * src_path;
	char * out_path;

	int width = 352;						//width
    int height = 288;					    //height
	total_no =total_no2= 300;				//total frame number

    src_path = "G:\\videos\\foreman_cif.yuv";
    out_path = "C:\\my_work\\eg_1\\clip_cif_test.yuv";

    uint8_t* buf;
    int32_t size;
	FILE* in_file, *out_file,*in_file2;
    int32_t frame_no,frame_no2;
    
	size =height * width + (height * width >> 1);
    buf = (unsigned char*)malloc(size);
    
	in_file = fopen(src_path, "rb");
   
    if (!in_file)
    {
        printf("cannot open input file.");
        return 0;
    }

    out_file = fopen(out_path, "wb");
    if (!out_file)
    {
        printf("cannot write 264 file.\n");
        return 0;
    }
   
	for(frame_no = 0; frame_no < total_no; frame_no++)
    {        
        if (fread(buf, size, 1, in_file) <= 0)
            printf("cannot read from input file.");

        if (fwrite(buf, size, 1, out_file) < 0)
            printf("cannot write 264 file.\n");
         
		

		printf("Do num  %5d  \n",frame_no);
	}
  
	
	in_file2 = fopen(src_path, "rb");
	for(frame_no2 = 0; frame_no2 < total_no; frame_no2++)
    {        
        if (fread(buf, size, 1, in_file2) <= 0)
            printf("cannot read from input file.");

        if (fwrite(buf, size, 1, out_file) < 0)
            printf("cannot write 264 file.\n");
         
		

		printf("Do num  %5d  \n",frame_no2);
	}
 
 if(buf)
	{
		free(buf);
	}
	fclose(in_file);
	fclose(in_file2);
	fclose(out_file);

	return 0;
}


⌨️ 快捷键说明

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