- 的libavdevice类库最简单的例子。通过该例子,可以学习FFmpeg中
-
-
-
-
-
-
-
-
-
qt
工程文件pro:
SOURCES += \
ffmpeg_libavdevice.cpp
INCLUDEPATH += $$PWD/ffmpeg/include
LIBS += $$PWD/ffmpeg/lib/avcodec.lib \
$$PWD/ffmpeg/lib/avdevice.lib \
$$PWD/ffmpeg/lib/avfilter.lib \
$$PWD/ffmpeg/lib/avformat.lib \
$$PWD/ffmpeg/lib/avutil.lib \
$$PWD/ffmpeg/lib/postproc.lib \
$$PWD/ffmpeg/lib/swresample.lib \
$$PWD/ffmpeg/lib/swscale.lib
INCLUDEPATH += $$PWD/ffmpeg/include
源文件
ffmpeg_libavdevice.cpp
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/pixfmt.h"
#include "libswscale/swscale.h"
#include "libavdevice/avdevice.h"
}
//Show 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");
}
int main()
{
//注册
av_register_all();
avdevice_register_all();
show_dshow_device();
}