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

  • 大小: 16.2MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2024-01-29
  • 語言: 其他
  • 標簽: FFmpeg??SDL??

資源簡介

FFmpeg解碼+SDL播放

資源截圖

代碼片段和文件信息

//?FFmepg_SDL.cpp?:?定義控制臺應用程序的入口點。
//

#include?“stdafx.h“

#ifdef?__cplusplus
extern?“C“
{
#endif
#include?“include\libavformat\avformat.h“
#include?“include\libavcodec\avcodec.h“
#include?“include\libswscale\swscale.h“
#include?“include\libavfilter\avfilter.h“
#include?“include\libavdevice\avdevice.h“
#include?“include\libavutil\avutil.h“

#include?“include\sdl\SDL.h“
#include?“include\sdl\SDL_thread.h“

#include?
#include?
#include?
#include?
#ifdef?__cplusplus
}
#endif

int?ffplay()
{
AVFormatContext????*pFormatCtx;
int????????????????i?videoindex;
AVCodecContext????*pCodecCtx;
AVCodec????????????*pCodec;

char?rtspUrl[]?=?“rtsp://admin:admin@10.100.40.93:554/1/h264major“;???//攝像機路徑


avformat_network_init();//支持網絡流
pFormatCtx?=?avformat_alloc_context();//初始化AVFormatContext

if?(avformat_open_input(&pFormatCtx/*filepath*/rtspUrl?NULL?NULL)?!=?0){//打開文件或網絡流
printf(“無法打開文件\n“);
return?-1;
}
if?(avformat_find_stream_info(pFormatCtx?NULL)<0)//查找流信息
{
printf(“Couldn‘t?find?stream?information.\n“);
return?-1;
}
videoindex?=?-1;
for?(i?=?0;?inb_streams;?i++)?//獲取視頻流ID
if?(pFormatCtx->streams[i]->codec->codec_type?==?AVMEDIA_TYPE_VIDEO)
{
videoindex?=?i;
break;
}
if?(videoindex?==?-1)
{
printf(“Didn‘t?find?a?video?stream.\n“);
return?-1;
}
pCodecCtx?=?pFormatCtx->streams[videoindex]->codec;
pCodec?=?avcodec_find_decoder(pCodecCtx->codec_id);//查找解碼器
if?(pCodec?==?NULL)
{
printf(“Codec?not?found.\n“);
return?-1;
}
if?(avcodec_open2(pCodecCtx?pCodec?NULL)<0)//打開解碼器
{
printf(“Could?not?open?codec.\n“);
return?-1;
}

AVframe??*pframe?*pframeYUV;
pframe?=?av_frame_alloc();//存儲解碼后AVframe
pframeYUV?=?av_frame_alloc();//存儲轉換后AVframe
uint8_t?*out_buffer;
out_buffer?=?new?uint8_t[avpicture_get_size(PIX_FMT_YUV420P?pCodecCtx->width?pCodecCtx->height)];//分配AVframe所需內存
avpicture_fill((AVPicture?*)pframeYUV?out_buffer?PIX_FMT_YUV420P?pCodecCtx->width?pCodecCtx->height);//填充AVframe

//------------SDL初始化--------
if?(SDL_Init(SDL_INIT_VIDEO?|?SDL_INIT_AUDIO?|?SDL_INIT_TIMER))?{
printf(“Could?not?initialize?SDL?-?%s\n“?SDL_GetError());
return?-1;
}
SDL_Window?*screen?=?SDL_CreateWindow(“RTSP?Client?Demo“
SDL_WINDOWPOS_UNDEFINED
SDL_WINDOWPOS_UNDEFINED
pCodecCtx->width?pCodecCtx->height
SDL_WINDOW_RESIZABLE/*?SDL_WINDOW_HIDDEN*/?|?SDL_WINDOW_OPENGL);
if?(!screen)?{
printf(“SDL:?could?not?set?video?mode?-?exiting\n“);
return?-1;
}
SDL_Renderer*?sdlRenderer?=?SDL_CreateRenderer(screen?-1?0);
SDL_Texture*?sdlTexture?=?SDL_CreateTexture(
sdlRenderer
SDL_PIXELFORMAT_YV12
SDL_TEXTUREACCESS_STREAMING
pCodecCtx->width
pCodecCtx->height);

SDL_Rect?rect;
//-----------------------------
int?ret?got_picture;
static?struct?SwsContext?*img_convert_ctx;
int?y_size?=?pCodecCtx->width?*?pCodecCtx->heigh

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-10-31?17:13??FFmepg_SDL\
?????目錄???????????0??2016-10-28?13:32??FFmepg_SDL\Debug\
?????文件???????39424??2016-10-28?15:09??FFmepg_SDL\Debug\FFmepg_SDL.exe
?????文件??????302944??2016-10-28?15:09??FFmepg_SDL\Debug\FFmepg_SDL.ilk
?????文件??????782336??2016-10-28?15:09??FFmepg_SDL\Debug\FFmepg_SDL.pdb
?????目錄???????????0??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\
?????文件????18936320??2014-05-06?10:08??FFmepg_SDL\FFmepg_SDL\avcodec-55.dll
?????文件?????1340928??2014-05-06?10:08??FFmepg_SDL\FFmepg_SDL\avdevice-55.dll
?????文件?????2034688??2014-05-06?10:08??FFmepg_SDL\FFmepg_SDL\avfilter-4.dll
?????文件?????5342720??2014-05-06?10:08??FFmepg_SDL\FFmepg_SDL\avformat-55.dll
?????文件??????418304??2014-05-06?10:08??FFmepg_SDL\FFmepg_SDL\avutil-52.dll
?????目錄???????????0??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\
?????文件????????1642??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.log
?????文件???????29639??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.obj
?????文件?????1638400??2016-10-28?13:30??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.pch
?????目錄???????????0??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\
?????文件????????1374??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\cl.command.1.tlog
?????文件???????15738??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\CL.read.1.tlog
?????文件?????????862??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\CL.write.1.tlog
?????文件?????????152??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\FFmepg_SDL.lastbuildstate
?????文件????????1432??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\link.command.1.tlog
?????文件????????3524??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\link.read.1.tlog
?????文件?????????448??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\FFmepg_SDL.tlog\link.write.1.tlog
?????文件???????11344??2016-10-28?13:30??FFmepg_SDL\FFmepg_SDL\Debug\stdafx.obj
?????文件??????330752??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\vc120.idb
?????文件??????241664??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\Debug\vc120.pdb
?????文件????????5101??2016-10-28?15:09??FFmepg_SDL\FFmepg_SDL\FFmepg_SDL.cpp
?????文件????????4911??2016-10-28?13:31??FFmepg_SDL\FFmepg_SDL\FFmepg_SDL.vcxproj
?????文件????????1317??2016-10-28?11:30??FFmepg_SDL\FFmepg_SDL\FFmepg_SDL.vcxproj.filters
?????目錄???????????0??2016-10-28?11:31??FFmepg_SDL\FFmepg_SDL\include\
?????文件????????5721??2012-05-23?20:03??FFmepg_SDL\FFmepg_SDL\include\inttypes.h
............此處省略184個文件信息

評論

共有 條評論