Skip to content

Commit

Permalink
add '-f image2' to dpx-handling codepath
Browse files Browse the repository at this point in the history
  • Loading branch information
ElderOrb committed Sep 11, 2023
1 parent a7c10c1 commit b404df6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions Source/Core/FileInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,12 +817,12 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil

m_mediaParser = new QAVPlayer();

int dpxOffset = -1;
if(mediaFileName == "-")
mediaFileName = "pipe:0";
else if(isDpx(mediaFileName)) {
int dpxOffset = 0;
mediaFileName = adjustDpxFileName(mediaFileName, dpxOffset);
m_mediaParser->setInputOptions({ {"start_number", QString::number(dpxOffset) } });
m_mediaParser->setInputOptions({ {"start_number", QString::number(dpxOffset) }, {"f", "image2"} });
}

m_mediaParser->setSource(mediaFileName);
Expand Down Expand Up @@ -856,7 +856,13 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil

AVFormatContext* FormatContext = nullptr;
auto stdMediaFileName = mediaFileName.toStdString();
if (avformat_open_input(&FormatContext, stdMediaFileName.c_str(), NULL, NULL)>=0)
AVDictionary* options = nullptr;
if (dpxOffset != -1) {
auto dpxOffsetString = std::to_string(dpxOffset);
av_dict_set(&options, "f", "image2", 0);
av_dict_set(&options, "start_number", dpxOffsetString.c_str(), 0);
}
if (avformat_open_input(&FormatContext, stdMediaFileName.c_str(), nullptr, &options)>=0)
{
QVector<QAVStream*> orderedStreams;
if (avformat_find_stream_info(FormatContext, NULL)>=0) {
Expand Down Expand Up @@ -927,6 +933,9 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil

avformat_close_input(&FormatContext);
}
if (options) {
av_dict_free(&options);
}
}

if(attachment.isEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion Source/GUI/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class MediaPlayer : public QAVPlayer {
if (isDpx(sourceFile)) {
int dpxOffset = 0;
sourceFile = adjustDpxFileName(sourceFile, dpxOffset);
setInputOptions({ {"start_number", QString::number(dpxOffset) } });
setInputOptions({ {"start_number", QString::number(dpxOffset) }, {"f", "image2"} });
} else {
if(!inputOptions().empty()) {
setInputOptions({});
Expand Down

0 comments on commit b404df6

Please sign in to comment.