Skip to content

Commit

Permalink
Use 'use_mfra_for pts' for demuxing
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
  • Loading branch information
dwbuiten committed May 5, 2021
1 parent b4ee994 commit 2778a35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/core/indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ FFMS_Indexer *CreateIndexer(const char *Filename) {
FFMS_Indexer::FFMS_Indexer(const char *Filename)
: SourceFile(Filename) {
try {
if (avformat_open_input(&FormatContext, Filename, nullptr, nullptr) != 0)
AVDictionary *opts = nullptr;

if (av_dict_set(&opts, "use_mfra_for", "pts", 0) < 0) {
throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_ALLOCATION_FAILED,
std::string("Couldn't set use_mfra_for AVOption"));
}
if (avformat_open_input(&FormatContext, Filename, nullptr, &opts) != 0)
throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
std::string("Can't open '") + Filename + "'");

Expand Down
8 changes: 7 additions & 1 deletion src/core/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ void FillAP(FFMS_AudioProperties &AP, AVCodecContext *CTX, FFMS_Track &Frames) {
}

void LAVFOpenFile(const char *SourceFile, AVFormatContext *&FormatContext, int Track) {
if (avformat_open_input(&FormatContext, SourceFile, nullptr, nullptr) != 0)
AVDictionary *opts = nullptr;

if (av_dict_set(&opts, "use_mfra_for", "pts", 0) < 0) {
throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_ALLOCATION_FAILED,
std::string("Couldn't set use_mfra_for AVOption"));
}
if (avformat_open_input(&FormatContext, SourceFile, nullptr, &opts) != 0)
throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,
std::string("Couldn't open '") + SourceFile + "'");

Expand Down

0 comments on commit 2778a35

Please sign in to comment.