資源簡介
FFmpeg 采集攝像頭視頻H264編碼輸出rtmp流媒體項目文件基于雷神之前代碼匯總編譯,經過測試,基本代碼涵蓋注釋。VS2015編譯環境編譯通過,ffmpeg學習用
代碼片段和文件信息
//?dsshowffmpeg.cpp?:?定義控制臺應用程序的入口點。
//
#include?“stdafx.h“
#include?“stdio.h“
#include?“_mingw.h“
#include?“stdint.h“
//解決SDL之后發現的錯誤?LNK2019無法解析的外部符號?__imp__fprintf,該符號在函數?_ShowError?中被引用
#pragma?comment(lib?“legacy_stdio_definitions.lib“)
//#pragma?comment(lib“SDL2.lib“)
#define?__STDC_CONSTANT_MACROS
//#define?__STDC_CONSTANT_MACROS
extern?“C“
{
//解決SDL之后發現的錯誤?LNK2019無法解析的外部符號?__imp____iob_func,該符號在函數?_ShowError?中被引用
FILE?__iob_func[3]?=?{?*stdin*stdout*stderr?};
#include?“libavcodec/avcodec.h“
#include?“libavformat/avformat.h“
#include?“libswscale/swscale.h“
#include?“libavdevice/avdevice.h“
#include?“libavutil/mathematics.h“
#include?“libavutil/time.h“
#include?“SDL2/SDL.h“
};
//Output?YUV420P?
#define?OUTPUT_YUV420P?0
//‘1‘?Use?Dshow?
//‘0‘?Use?VFW
#define?USE_DSHOW?0
//Refresh?Event
#define?SFM_REFRESH_EVENT??(SDL_USEREVENT?+?1)
#define?SFM_BREAK_EVENT??(SDL_USEREVENT?+?2)
int?thread_exit?=?0;
int?thread_pause?=?0;
//線程和事件
int?sfp_refresh_thread(void?*opaque)
{
thread_exit?=?0;
thread_pause?=?0;
while?(!thread_exit)?
{
if?(!thread_pause)?
{
SDL_Event?event;
event.type?=?SFM_REFRESH_EVENT;
SDL_PushEvent(&event);
}
SDL_Delay(40);
}
thread_exit?=?0;
thread_pause?=?0;
//Break
SDL_Event?event;
event.type?=?SFM_BREAK_EVENT;
SDL_PushEvent(&event);
return?0;
}
//Show?Dshow?Device
void?show_dshow_device()
{
AVFormatContext?*pFormatCtx?=?avformat_alloc_context();
AVDictionary*?options?=?NULL;
av_dict_set(&options?“list_devices“?“true“?0);
AVInputFormat?*iformat?=?av_find_input_format(“dshow“);
printf(“========Device?Info=============\n“);
avformat_open_input(&pFormatCtx?“video=dummy“?iformat?&options);
printf(“================================\n“);
}
//Show?Dshow?Device?Option
void?show_dshow_device_option()
{
AVFormatContext?*pFormatCtx?=?avformat_alloc_context();
AVDictionary*?options?=?NULL;
av_dict_set(&options?“list_options“?“true“?0);
AVInputFormat?*iformat?=?av_find_input_format(“dshow“);
printf(“========Device?Option?Info======\n“);
avformat_open_input(&pFormatCtx?“video=Integrated?Camera“?iformat?&options);
//avformat_open_input(&pFormatCtx?“video=USB2.0?PC?CAMERA“?iformat?&options);
//avformat_open_input(&pFormatCtx?“video=USB2.0?HD?UVC?WebCam“?iformat?&options);
printf(“================================\n“);
}
//Show?VFW?Device
void?show_vfw_device()?
{
AVFormatContext?*pFormatCtx?=?avformat_alloc_context();
AVInputFormat?*iformat?=?av_find_input_format(“vfwcap“);
printf(“========VFW?Device?Info======\n“);
avformat_open_input(&pFormatCtx?“list“?iformat?NULL);
printf(“=============================\n“);
}
//Show?AVFoundation?Device
void?show_avfoundation_device()
{
AVFormatContext?*pFormatCtx?=?avformat_alloc_context();
AVDictionary*?options?=?NULL;
av_dict_set(&options?“list_devices“?“true“?0);
AVInputFormat?*iformat?=?av_find_input_f
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????44544??2017-07-14?15:09??dsshowffmpeg\.vs\dsshowffmpeg\v14\.suo
?????文件??????71680??2017-07-14?14:50??dsshowffmpeg\Debug\dsshowffmpeg.exe
?????文件?????641160??2017-07-14?14:50??dsshowffmpeg\Debug\dsshowffmpeg.ilk
?????文件????1273856??2017-07-14?14:50??dsshowffmpeg\Debug\dsshowffmpeg.pdb
?????文件???18936320??2016-03-11?20:51??dsshowffmpeg\dsshowffmpeg\avcodec-55.dll
?????文件????1340928??2016-03-11?20:51??dsshowffmpeg\dsshowffmpeg\avdevice-55.dll
?????文件????2034688??2016-03-11?20:51??dsshowffmpeg\dsshowffmpeg\avfilter-4.dll
?????文件????5342720??2016-03-11?20:51??dsshowffmpeg\dsshowffmpeg\avformat-55.dll
?????文件?????418304??2016-03-11?20:51??dsshowffmpeg\dsshowffmpeg\avutil-52.dll
?????文件???????1652??2017-07-13?16:45??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.Build.CppClean.log
?????文件???????2506??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.log
?????文件??????49247??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.obj
?????文件??????49505??2017-07-14?14:11??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.obj.enc
?????文件????3407872??2017-07-13?16:45??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.pch
?????文件???????1842??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.tlog\CL.command.1.tlog
?????文件??????26310??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.tlog\CL.read.1.tlog
?????文件???????1774??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.tlog\CL.write.1.tlog
?????文件????????280??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.tlog\dsshowffmpeg.lastbuildstate
?????文件???????4776??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.tlog\li
?????文件???????8280??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.tlog\li
?????文件???????3256??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\dsshowffmpeg.tlog\li
?????文件??????13096??2017-07-13?16:45??dsshowffmpeg\dsshowffmpeg\Debug\stdafx.obj
?????文件?????445440??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\vc140.idb
?????文件?????258048??2017-07-14?14:50??dsshowffmpeg\dsshowffmpeg\Debug\vc140.pdb
?????文件??????18168??2017-07-14?15:08??dsshowffmpeg\dsshowffmpeg\dsshowffmpeg.cpp
?????文件??????11300??2017-07-13?16:47??dsshowffmpeg\dsshowffmpeg\dsshowffmpeg.vcxproj
?????文件???????6748??2017-07-13?16:44??dsshowffmpeg\dsshowffmpeg\dsshowffmpeg.vcxproj.filters
?????文件????????165??2017-07-13?15:19??dsshowffmpeg\dsshowffmpeg\dsshowffmpeg.vcxproj.user
?????文件???????5721??2016-03-11?20:51??dsshowffmpeg\dsshowffmpeg\include\inttypes.h
?????文件?????175612??2016-03-11?20:51??dsshowffmpeg\dsshowffmpeg\include\libavcodec\avcodec.h
............此處省略239個文件信息
- 上一篇:破解藍光加密超級工具,無懼任何光盤加密!
- 下一篇:flash個人簡歷制作
評論
共有 條評論