├── RTMPPublisher.sdf ├── RTMPPublisher ├── stdafx.h ├── test.mp3 ├── stdafx.cpp ├── targetver.h ├── temp │ ├── 1 │ │ └── course_demo.jpg │ ├── 2 │ │ └── course_demo.jpg │ ├── 3 │ │ └── course_demo.jpg │ ├── error.jpg │ └── course_demo.jpg ├── RTMPPublisher.cpp ├── ffmpegExtend.cpp ├── FFMPEGExtendLibrary.h ├── FFMPEGExtendLibrary.cpp ├── FFMPEGExtendManager.cpp ├── audio.h ├── RTMPPublisher.vcxproj.user ├── FFMPEGExtendMain.cpp ├── FFMPEGExtendManager.h ├── ffmpeg.h ├── ReadMe.txt ├── ffmpegExtend.h ├── RTMPPublisher.vcxproj.filters └── RTMPPublisher.vcxproj ├── .vs └── RTMPPublisher │ └── v14 │ └── .suo ├── .gitignore └── RTMPPublisher.sln /RTMPPublisher.sdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher.sdf -------------------------------------------------------------------------------- /RTMPPublisher/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/stdafx.h -------------------------------------------------------------------------------- /RTMPPublisher/test.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/test.mp3 -------------------------------------------------------------------------------- /.vs/RTMPPublisher/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/.vs/RTMPPublisher/v14/.suo -------------------------------------------------------------------------------- /RTMPPublisher/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/stdafx.cpp -------------------------------------------------------------------------------- /RTMPPublisher/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/targetver.h -------------------------------------------------------------------------------- /RTMPPublisher/temp/error.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/temp/error.jpg -------------------------------------------------------------------------------- /RTMPPublisher/RTMPPublisher.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/RTMPPublisher.cpp -------------------------------------------------------------------------------- /RTMPPublisher/ffmpegExtend.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/ffmpegExtend.cpp -------------------------------------------------------------------------------- /RTMPPublisher/FFMPEGExtendLibrary.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/FFMPEGExtendLibrary.h -------------------------------------------------------------------------------- /RTMPPublisher/temp/1/course_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/temp/1/course_demo.jpg -------------------------------------------------------------------------------- /RTMPPublisher/temp/2/course_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/temp/2/course_demo.jpg -------------------------------------------------------------------------------- /RTMPPublisher/temp/3/course_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/temp/3/course_demo.jpg -------------------------------------------------------------------------------- /RTMPPublisher/temp/course_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/temp/course_demo.jpg -------------------------------------------------------------------------------- /RTMPPublisher/FFMPEGExtendLibrary.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/FFMPEGExtendLibrary.cpp -------------------------------------------------------------------------------- /RTMPPublisher/FFMPEGExtendManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JR-Dun/RTMPPublisher/HEAD/RTMPPublisher/FFMPEGExtendManager.cpp -------------------------------------------------------------------------------- /RTMPPublisher/audio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | using namespace irrklang; 5 | #pragma comment(lib,"irrKlang.lib") 6 | -------------------------------------------------------------------------------- /RTMPPublisher/RTMPPublisher.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | *.smod 19 | 20 | # Compiled Static libraries 21 | *.lai 22 | *.la 23 | *.a 24 | *.lib 25 | 26 | # Executables 27 | *.exe 28 | *.out 29 | *.app 30 | -------------------------------------------------------------------------------- /RTMPPublisher/FFMPEGExtendMain.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "FFMPEGExtendManager.h" 3 | 4 | using namespace RTMPPublisher; 5 | using namespace System; 6 | using namespace System::Runtime::InteropServices; 7 | 8 | 9 | 10 | void main() 11 | { 12 | FFMPEGExtendManager ffmpegExtendManager; 13 | 14 | FFMPEGExtend *extend1 = ffmpegExtendManager.getExtend("10086"); 15 | FFMPEGExtend *extend3 = ffmpegExtendManager.getExtend("10086"); 16 | ffmpegExtendManager.threadStart(extend1); 17 | 18 | while (true) 19 | { 20 | if (kbhit()) { 21 | extend3->catchVideoStop(); 22 | }; 23 | } 24 | } -------------------------------------------------------------------------------- /RTMPPublisher/FFMPEGExtendManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "FFMPEGExtend.h" 3 | 4 | using namespace System; 5 | using namespace System::Runtime::InteropServices; 6 | using namespace System::Collections::Generic; 7 | 8 | namespace RTMPPublisher { 9 | 10 | public ref class FFMPEGExtendManager 11 | { 12 | public: 13 | bool isExistExtend(char *courseId); 14 | bool addExtend(FFMPEGExtend *_extend); 15 | bool delExtend(char *courseId); 16 | FFMPEGExtend *getExtend(char *courseId); 17 | 18 | bool threadStart(FFMPEGExtend *extend); 19 | bool threadStop(FFMPEGExtend *extend); 20 | }; 21 | 22 | } -------------------------------------------------------------------------------- /RTMPPublisher/ffmpeg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | extern "C" 5 | { 6 | #include "libavformat/avformat.h" 7 | #include "libavdevice/avdevice.h" 8 | #include "libavcodec/avcodec.h" 9 | #include "libswscale/swscale.h" 10 | #include "libswresample/swresample.h" 11 | #include "libavutil/imgutils.h" 12 | #include "libavutil/opt.h" 13 | #include "libavutil/time.h" 14 | #include "libavutil/avutil.h" 15 | #include "libavutil/audio_fifo.h" 16 | #include "libavutil/mathematics.h" 17 | } 18 | 19 | #pragma comment(lib,"avformat.lib") 20 | #pragma comment(lib,"avdevice.lib") 21 | #pragma comment(lib,"avcodec.lib") 22 | #pragma comment(lib,"avutil.lib") 23 | #pragma comment(lib,"swscale.lib") 24 | #pragma comment(lib,"swresample.lib") 25 | 26 | -------------------------------------------------------------------------------- /RTMPPublisher/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | 控制台应用程序:RTMPPublisher 项目概述 3 | ======================================================================== 4 | 5 | 应用程序向导已为您创建了此 RTMPPublisher 应用程序。 6 | 7 | 本文件概要介绍组成 RTMPPublisher 应用程序的每个文件的内容。 8 | 9 | 10 | RTMPPublisher.vcxproj 11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 12 | 13 | RTMPPublisher.vcxproj.filters 14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 15 | 16 | RTMPPublisher.cpp 17 | 这是主应用程序源文件。 18 | 19 | ///////////////////////////////////////////////////////////////////////////// 20 | 其他标准文件: 21 | 22 | StdAfx.h, StdAfx.cpp 23 | 这些文件用于生成名为 RTMPPublisher.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | 其他注释: 27 | 28 | 应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 29 | 30 | ///////////////////////////////////////////////////////////////////////////// 31 | -------------------------------------------------------------------------------- /RTMPPublisher.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTMPPublisher", "RTMPPublisher\RTMPPublisher.vcxproj", "{E648217E-4B13-4577-B882-D27BC8799A1F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Debug|x64.ActiveCfg = Debug|x64 17 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Debug|x64.Build.0 = Debug|x64 18 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Debug|x86.ActiveCfg = Debug|Win32 19 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Debug|x86.Build.0 = Debug|Win32 20 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Release|x64.ActiveCfg = Release|x64 21 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Release|x64.Build.0 = Release|x64 22 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Release|x86.ActiveCfg = Release|Win32 23 | {E648217E-4B13-4577-B882-D27BC8799A1F}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /RTMPPublisher/ffmpegExtend.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | using namespace System; 4 | using namespace System::Runtime::InteropServices; 5 | using namespace System::Collections::Generic; 6 | 7 | namespace RTMPPublisher { 8 | 9 | typedef struct SwsContext SWSContext; 10 | 11 | public class FFMPEGExtend 12 | { 13 | public: 14 | FFMPEGExtend(); 15 | FFMPEGExtend(char *courseId); 16 | FFMPEGExtend(char *inputPath, char *outputPath); 17 | ~FFMPEGExtend(); 18 | 19 | public: 20 | void getMp3Info(); 21 | void catchVideoStart(); 22 | void catchVideoStop(); 23 | 24 | 25 | private: 26 | void init(char *inputPath, char *outputPath); 27 | void dealloc(); 28 | 29 | int start(); 30 | void stop(); 31 | int initInput(); 32 | int initOutput(); 33 | void initFrame(); 34 | 35 | int openCodecContextJPEG(); 36 | void closeCodecContextJPEG(); 37 | 38 | int catchVideoFrame(int frameIndex); 39 | int catchJPEGFrame(int frameIndex); 40 | void savePacketToJPEG(AVPacket *packet, int frame); 41 | void saveFrameToJPEG(AVFrame *frame, int index); 42 | void saveFrameToPPM(AVFrame *frame, int index); 43 | 44 | uint8_t *getFileBuffer(); 45 | 46 | void centerError(char *error); 47 | 48 | public: 49 | char *courseId; 50 | bool isWorking; 51 | 52 | private: 53 | char *inputFile; 54 | char *output; 55 | 56 | AVFormatContext *vFormatContextInput; 57 | AVCodecContext *vCodecContextInput; 58 | 59 | AVFormatContext *vFormatContextOutput; 60 | AVCodecContext *vCodecContextOutput; 61 | AVPixelFormat vPixelFormatOutput; 62 | 63 | AVFormatContext *jpegFormatContext; 64 | AVCodecContext *jpegCodecContext; 65 | 66 | SWSContext *vSWSContext; 67 | SWSContext *jpegSWSContext; 68 | 69 | AVFrame *videoFrame; 70 | AVStream *videoStream; 71 | }; 72 | 73 | } -------------------------------------------------------------------------------- /RTMPPublisher/RTMPPublisher.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 头文件 23 | 24 | 25 | 头文件 26 | 27 | 28 | 头文件 29 | 30 | 31 | 头文件 32 | 33 | 34 | 头文件 35 | 36 | 37 | 头文件 38 | 39 | 40 | 头文件 41 | 42 | 43 | 44 | 45 | 源文件 46 | 47 | 48 | 源文件 49 | 50 | 51 | 源文件 52 | 53 | 54 | 源文件 55 | 56 | 57 | 源文件 58 | 59 | 60 | -------------------------------------------------------------------------------- /RTMPPublisher/RTMPPublisher.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {E648217E-4B13-4577-B882-D27BC8799A1F} 23 | Win32Proj 24 | RTMPPublisher 25 | 8.1 26 | 27 | 28 | 29 | Application 30 | true 31 | v140 32 | Unicode 33 | true 34 | 35 | 36 | Application 37 | false 38 | v140 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v140 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v140 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | $(SolutionDir)RTMPPublisher\include\;$(IncludePath) 76 | $(SolutionDir)RTMPPublisher\lib\;$(LibraryPath) 77 | 78 | 79 | true 80 | 81 | 82 | false 83 | 84 | 85 | false 86 | 87 | 88 | 89 | Use 90 | Level3 91 | Disabled 92 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 93 | false 94 | %(AdditionalIncludeDirectories) 95 | -D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions) 96 | 97 | 98 | Console 99 | true 100 | %(AdditionalLibraryDirectories) 101 | 102 | 103 | 104 | 105 | Use 106 | Level3 107 | Disabled 108 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 109 | true 110 | 111 | 112 | Console 113 | true 114 | 115 | 116 | 117 | 118 | Level3 119 | Use 120 | MaxSpeed 121 | true 122 | true 123 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | true 125 | 126 | 127 | Console 128 | true 129 | true 130 | true 131 | 132 | 133 | 134 | 135 | Level3 136 | Use 137 | MaxSpeed 138 | true 139 | true 140 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 141 | true 142 | 143 | 144 | Console 145 | true 146 | true 147 | true 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | Create 169 | Create 170 | Create 171 | Create 172 | 173 | 174 | 175 | 176 | 177 | --------------------------------------------------------------------------------