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

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

資源簡介

環境:Vs2010 參考網址:http://blog.csdn.net/cffishappy/article/details/7352898 鑒于ffplay的代碼晦澀難懂 結合ffplay的代碼 自己實現了一個ffplay 比較精簡和通俗易懂 未解決的問題: 1、停止后會有崩潰(應該是釋放ffmpeg對象時未退出線程造成內存訪問錯誤 demo就不改了) 2、不支持手動點擊界面以跳轉進度,不過在代碼里實現了跳轉接口的測試 3、未處理SDL窗口的消息循環 預覽窗口不能拖動 且偶爾播放久了后界面未見刷新-測試定位應該是SDL的問題 因為之后解碼的AVFrame保存的圖片均正常 不予解決

資源截圖

代碼片段和文件信息

#include?“base.h“
#include?

BOOL?req_seek?=?FALSE;
AVFormatContext*?g_pFormatCtx?=?NULL;

int?g_videoStream?=?-1;
int?g_audioStream?=?-1;

AVStream*?g_pVideoStream?=?NULL;
AVStream*?g_pAudioStream?=?NULL;

AVCodecContext*?g_pCodecCtx?=?NULL;
AVCodecContext*?g_aCodecCtx?=?NULL;

AVCodec*?g_pCodec?=?NULL;
AVCodec*?g_aCodec?=?NULL;

BOOL??g_bStartPlay?=?FALSE;
DWORD?g_dwStartPlayTime?=?0;

BOOL?g_bAudioInit?=?FALSE;
CRITICAL_SECTION?g_csAudioList;
vector?g_vAudioList;?//?讀取到的音頻包
tMyAudioParams ?g_tAudioDstParams;?//?播放音頻的格式
int ?curAudioSamples?=?0;?//?獲取到一個新的包時?清零該值

CRITICAL_SECTION g_csVideoList;
vector g_vVideoList;?//?讀取到的視頻包
SDL_Overlay* g_bmp?=?NULL;
struct?SwsContext* g_pImgConvertCtx?=?NULL;

int?init_ffmpeg(const?char*?pFileName)
{
av_register_all();

if(avformat_open_input(&g_pFormatCtx?pFileName?NULL?NULL)?!=?0)
{
printf(“avformat_open_input??fail?to?open?file:%s?\n“?pFileName);
return?-1;
}

if(avformat_find_stream_info(g_pFormatCtx?NULL)? {
printf(“avformat_find_stream_info??fail?to?find?stream?\n“);
return?-1;?//?Couldn‘t?find?stream?information
}

for(int?i=0;?i?nb_streams;?i++)?//?find?the?video?or?audio?stream?index
{
if(g_pFormatCtx->streams[i]->codec->codec_type?==?AVMEDIA_TYPE_VIDEO)
{
g_videoStream?=?i;
}
else?if(g_pFormatCtx->streams[i]->codec->codec_type?==?AVMEDIA_TYPE_AUDIO)
{
g_audioStream?=?i;
}
if?(g_videoStream?>=?0?&&?g_audioStream?>=?0)
{
break;
}
}

if((g_videoStream?==?-1)?&&?(g_audioStream?==?-1))
{
printf(“can?not?find?any?video?or?audio?stream?\n“);
return?-1;
}

if?(g_videoStream?>=?0)
{
g_pVideoStream?=?g_pFormatCtx->streams[g_videoStream];
g_pCodecCtx?=?g_pFormatCtx->streams[g_videoStream]->codec;
if?(g_pCodecCtx) g_pCodec?=?avcodec_find_decoder(g_pCodecCtx->codec_id);
if?(g_pCodec) if(avcodec_open2(g_pCodecCtx?g_pCodec?NULL)? }

if?(g_audioStream?>=?0)
{
g_pAudioStream?=?g_pFormatCtx->streams[g_audioStream];
g_aCodecCtx?=?g_pFormatCtx->streams[g_audioStream]->codec;
if?(g_aCodecCtx)??g_aCodec?=?avcodec_find_decoder(g_aCodecCtx->codec_id);
if?(g_aCodec) if(avcodec_open2(g_aCodecCtx?g_aCodec?NULL)? }

return?0;
}

int?init_sdl()
{
if?(g_pCodecCtx)?//?SDL-video?show?init
{??
if(SDL_Init(SDL_INIT_VIDEO?|?SDL_INIT_AUDIO?|?SDL_INIT_TIMER))
{
return?-2;
}

SDL_Surface*?screen?=?SDL_SetVideoMode(g_pCodecCtx->width?g_pCodecCtx->height?0?0);
if(!screen)?
{
return?-2;
}

g_pImgConvertCtx?=?sws_getContext(g_pCodecCtx->width?g_pCodecCtx->height
?g_pCodecCtx->pix_fmt?g_pCodecCtx->width?g_pCodecCtx->height
?AV_PIX_FMT_YUV420P?SWS_BICUBIC
?NULL?NULL?NULL);

g_bmp?=?SDL_CreateYUVOverlay(g_pCodecCtx->width?g_pCodecCtx->height?SDL_YV12_OVERLAY?screen);
}


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-08-14?15:03??ffmpeg??wsh\
?????文件?????????294??2015-05-11?10:05??ffmpeg??wsh\clean.bat
?????目錄???????????0??2015-08-14?15:03??ffmpeg??wsh\Debug\
?????文件??????????48??2015-08-14?14:13??ffmpeg??wsh\Debug\Copy.bat
?????目錄???????????0??2015-08-14?14:11??ffmpeg??wsh\demos\
?????目錄???????????0??2015-08-14?15:03??ffmpeg??wsh\demos\ffplay\
?????文件???????10756??2015-08-14?15:00??ffmpeg??wsh\demos\ffplay\base.cpp
?????文件????????2686??2015-08-14?09:40??ffmpeg??wsh\demos\ffplay\base.h
?????文件????????4993??2015-08-14?14:15??ffmpeg??wsh\demos\ffplay\ffplay.vcxproj
?????文件????????5787??2015-08-14?15:02??ffmpeg??wsh\demos\ffplay\main.cpp
?????文件?????????891??2015-08-13?16:41??ffmpeg??wsh\myFFplay.sln
?????目錄???????????0??2015-08-14?15:03??ffmpeg??wsh\Release\
?????文件??????????48??2015-08-14?14:13??ffmpeg??wsh\Release\Copy.bat
?????目錄???????????0??2015-08-14?14:11??ffmpeg??wsh\sdk\
?????目錄???????????0??2015-08-14?14:11??ffmpeg??wsh\sdk\bin\
?????文件????22371840??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\avcodec-56.dll
?????文件?????1380352??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\avdevice-56.dll
?????文件?????2392576??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\avfilter-5.dll
?????文件?????6012928??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\avformat-56.dll
?????文件??????493568??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\avutil-54.dll
?????文件??????330752??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\ffmpeg_org.exe
?????文件??????476160??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\ffplay_org.exe
?????文件??????155648??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\ffprobe_org.exe
?????文件??????131584??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\postproc-53.dll
?????文件??????281600??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\swresample-1.dll
?????文件??????452608??2015-06-10?10:06??ffmpeg??wsh\sdk\bin\swscale-3.dll
?????目錄???????????0??2015-08-14?14:11??ffmpeg??wsh\sdk\include\
?????文件????????7875??2015-02-05?09:21??ffmpeg??wsh\sdk\include\inttypes.h
?????目錄???????????0??2015-08-14?14:11??ffmpeg??wsh\sdk\include\libavcodec\
?????文件??????181963??2015-06-10?10:06??ffmpeg??wsh\sdk\include\libavcodec\avcodec.h
?????文件????????3111??2015-06-10?10:06??ffmpeg??wsh\sdk\include\libavcodec\avfft.h
............此處省略157個文件信息

評論

共有 條評論