MCPcopy Create free account
hub / github.com/FFMS/ffms2 / LAVFOpenFile

Function LAVFOpenFile

src/core/utils.cpp:89–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void LAVFOpenFile(const char *SourceFile, AVFormatContext *&FormatContext, int Track, const std::map<std::string, std::string> &LAVFOpts) {
90 AVDictionary *Dict = nullptr;
91 for (const auto &iter : LAVFOpts)
92 av_dict_set(&Dict, iter.first.c_str(), iter.second.c_str(), 0);
93
94 if (avformat_open_input(&FormatContext, SourceFile, nullptr, &Dict) != 0)
95 throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
96 std::string("Couldn't open '") + SourceFile + "'");
97
98 av_dict_free(&Dict);
99
100 if (avformat_find_stream_info(FormatContext, nullptr) < 0) {
101 avformat_close_input(&FormatContext);
102 FormatContext = nullptr;
103 throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
104 "Couldn't find stream information");
105 }
106
107 for (int i = 0; i < (int)FormatContext->nb_streams; i++)
108 if (i != Track)
109 FormatContext->streams[i]->discard = AVDISCARD_ALL;
110}
111
112int ResizerNameToSWSResizer(const char *ResizerName) {
113 if (!ResizerName)

Callers 2

FFMS_VideoSourceMethod · 0.85
OpenFileMethod · 0.85

Calls 1

FFMS_ExceptionClass · 0.85

Tested by

no test coverage detected