91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 10.86MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2024-01-24
  • 語(yǔ)言: C#
  • 標(biāo)簽: demo??

資源簡(jiǎn)介

C#H264格式視頻解碼, 使用FFMPEG解碼為H264視頻文件,解碼后的數(shù)據(jù)保存為.YUV,可以使用VLC等播放器播放。

資源截圖

代碼片段和文件信息

/****************************
?*??Black?Spoor?2018.02.08??*
?****************************/

#include?“CH264.h“

static?void?Init(struct?CH264Class?*int);
static?void?Dispose(struct?CH264Class?*);
static?int?InitDecode(struct?CH264Class?*?stu);
static?void?SetFileName(struct?CH264Class?*char?*int);
static?void?OpenFile(struct?CH264Class?*);
static?void?CloseFile(struct?CH264Class?*);

static?void?SetFileName(struct?CH264Class?*?stuchar?*?fileint?length)
{
memset(stu->filename0sizeof(stu->filename));
strcpy(stu->filenamefile);
}

static?int?GReadBuffer(void?*?opaque?uint8_t?*?buf?int?buf_size)
{
if(opaque?!=?NULL)
{
CH264Class?*?decode?=?(CH264Class?*)?opaque;
if(decode?!=?NULL)
{
//從文件讀數(shù)據(jù)
if(!feof(decode->fp))
{
int?readlen?=?fread(buf1buf_sizedecode->fp);
return?readlen;
}
}
}
return?-1;
}?

static?void?OpenFile(struct?CH264Class?*?stu)
{
fopen_s(&stu->fpstu->filename“rb“);
}

static?void?CloseFile(struct?CH264Class?*?stu)
{
fclose(stu->fp);
}

static?int?InitDecode(struct?CH264Class?*?stu)
{
AVDictionary?*?options?=?NULL;

stu->decodeInited?=?-1;

stu->avio?=?avio_alloc_context(stu->aviobuffer40960stuGReadBufferNULLNULL);
stu->pFormatCtx->pb?=?stu->avio;
stu->ifmt?=?NULL;

if(avformat_open_input(&stu->pFormatCtxNULLstu->ifmt&options)!=0)
{
printf(“Couldn‘t?open?input?stream.\n“);
return?-1;
}

if(avformat_find_stream_info(stu->pFormatCtxNULL)<0)
{
printf(“Couldn‘t?find?stream?information.\n“);
return?-1;
}

stu->decodeInited?=?0;


stu->videoindex=-1;
//遍歷所有的流,并找到視頻流
for(unsigned?int?i=0;?i?pFormatCtx->nb_streams;?i++){?
if(stu->pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)
{
stu->videoindex=i;
break;
}
}

//如果沒(méi)找到,報(bào)錯(cuò)返回
if(stu->videoindex==-1)
{
printf(“Didn‘t?find?a?video?stream.\n“);
stu->pVideoCodecCtx?=NULL;
stu->pVideoCodec?=?NULL;
return?-1;
}else{
//記住視頻解碼器
stu->pVideoCodecCtx=stu->pFormatCtx->streams[stu->videoindex]->codec;
stu->pVideoCodec=avcodec_find_decoder(stu->pVideoCodecCtx->codec_id);
avcodec_open2(stu->pVideoCodecCtx?stu->pVideoCodecNULL);
}

stu->pVideoframe?=?av_frame_alloc();

return?0;
}

static?void?Init(struct?CH264Class?*?stu?int?index)
{
//編碼器
av_register_all();
avformat_network_init();
stu->pFormatCtx?=?avformat_alloc_context();
avdevice_register_all();
stu->aviobuffer?=?(unsigned?char?*)av_malloc(4096);
}

static?void?Dispose(struct?CH264Class?*?stu)
{
if(stu->pVideoCodecCtx!=NULL)
{
avcodec_close(stu->pVideoCodecCtx);
}

avformat_close_input(&stu->pFormatCtx);

free(stu);
}

CH264Class?*?CH264ClassCreate(void)
{
CH264Class?*?stu?=?(CH264Class?*)malloc(sizeof(CH264Class));
memset(stu0sizeof(CH264Class));

stu->Init?=?Init;
stu->Dispose?=?Dispose;

stu->InitDecode?=?InitDecode;
stu->SetFileName?=?SetFileName;

stu->Open

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????3104??2018-02-08?11:42??C#H264格式視頻解碼\CH264Decode\CH264.cpp

?????文件????????985??2018-02-08?11:42??C#H264格式視頻解碼\CH264Decode\CH264.h

?????文件???????5345??2018-02-08?11:39??C#H264格式視頻解碼\CH264Decode\CH264Decode.vcxproj

?????文件???????1247??2018-02-08?11:04??C#H264格式視頻解碼\CH264Decode\CH264Decode.vcxproj.filters

?????文件??????????0??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\empty-file

?????文件???????9170??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\entries

?????文件??????????2??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\format

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\bs.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\cabac.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\cabac.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\clip1.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\common.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\common.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\cpu.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\cpu.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\csp.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\csp.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\dct.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\dct.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\display-x11.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\display.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\frame.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\frame.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\macroblock.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\macroblock.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\mc.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\mc.h.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\mdate.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\pixel.c.svn-base

?????文件??????????4??2005-12-07?12:41??C#H264格式視頻解碼\CH264Decode\common\.svn\prop-base\pixel.h.svn-base

............此處省略487個(gè)文件信息

評(píng)論

共有 條評(píng)論