Skip to content

Commit

Permalink
Silence warnings and set avisynth clip level field order
Browse files Browse the repository at this point in the history
  • Loading branch information
myrsloik committed Apr 2, 2024
1 parent 04da097 commit 31ce21e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/audiosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ bool BestAudioSource::WriteAudioTrackIndex(const std::string &CachePath) {
for (auto &Iter : Dict)
Iter.second = PV++;

WriteInt(F, Dict.size());
WriteInt(F, static_cast<int>(Dict.size()));
WriteInt64(F, PTSPredictor);

for (const auto &Iter : Dict)
Expand Down
8 changes: 5 additions & 3 deletions src/avisynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ class AvisynthVideoSource : public IClip {
throw BestSourceException("Unsupported output bitdepth");
}

// FIXME, set TFF flag too?
if (VP.FieldBased)
VI.image_type |= VideoInfo::IT_FIELDBASED;
VI.image_type |= VP.TFF ? VideoInfo::IT_TFF : VideoInfo::IT_BFF;

VI.width = VP.Width;
VI.height = VP.Height;
Expand Down Expand Up @@ -281,11 +283,11 @@ class AvisynthVideoSource : public IClip {
}

if (Src->DolbyVisionRPU && Src->DolbyVisionRPUSize > 0) {
Env->propSetData(Props, "DolbyVisionRPU", reinterpret_cast<const char *>(Src->DolbyVisionRPU), Src->DolbyVisionRPUSize, 0);
Env->propSetData(Props, "DolbyVisionRPU", reinterpret_cast<const char *>(Src->DolbyVisionRPU), static_cast<int>(Src->DolbyVisionRPUSize), 0);
}

if (Src->HDR10Plus && Src->HDR10PlusSize > 0) {
Env->propSetData(Props, "HDR10Plus", reinterpret_cast<const char *>(Src->HDR10Plus), Src->HDR10PlusSize, 0);
Env->propSetData(Props, "HDR10Plus", reinterpret_cast<const char *>(Src->HDR10Plus), static_cast<int>(Src->HDR10PlusSize), 0);
}

Env->propSetInt(Props, "FlipVertical", VP.FlipVerical, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/tracklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ BestTrackList::~BestTrackList() {
}

int BestTrackList::GetNumTracks() const {
return TrackList.size();
return static_cast<int>(TrackList.size());
}

const BestTrackList::TrackInfo &BestTrackList::GetTrackInfo(int Track) const {
Expand Down
6 changes: 3 additions & 3 deletions src/vapoursynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,11 @@ static void VS_CC GetTrackInfo(const VSMap *In, VSMap *Out, void *, VSCore *core
for (int i = 0; i < TrackList->GetNumTracks(); i++) {
auto TI = TrackList->GetTrackInfo(i);
vsapi->mapSetInt(Out, "tracktype", TI.MediaType, maAppend);
vsapi->mapSetData(Out, "tracktypestr", TI.MediaTypeString.c_str(), TI.MediaTypeString.size(), dtUtf8, maAppend);
vsapi->mapSetData(Out, "tracktypestr", TI.MediaTypeString.c_str(), -1, dtUtf8, maAppend);
vsapi->mapSetInt(Out, "codec", TI.Codec, maAppend);
vsapi->mapSetData(Out, "codecstr", TI.CodecString.c_str(), TI.CodecString.size(), dtUtf8, maAppend);
vsapi->mapSetData(Out, "codecstr", TI.CodecString.c_str(), -1, dtUtf8, maAppend);
vsapi->mapSetInt(Out, "disposition", TI.Disposition, maAppend);
vsapi->mapSetData(Out, "dispositionstr", TI.DispositionString.c_str(), TI.DispositionString.size(), dtUtf8, maAppend);
vsapi->mapSetData(Out, "dispositionstr", TI.DispositionString.c_str(), -1, dtUtf8, maAppend);
}
} catch (BestSourceException &e) {
vsapi->mapSetError(Out, (std::string("TrackInfo: ") + e.what()).c_str());
Expand Down
4 changes: 3 additions & 1 deletion src/videosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ void LWVideoDecoder::GetVideoProperties(VideoProperties &VP) {
if (!PropFrame)
return;

VP.FieldBased = !!(PropFrame->flags & AV_FRAME_FLAG_INTERLACED);
VP.TFF = !!(PropFrame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
VP.Width = CodecContext->width;
VP.Height = CodecContext->height;
VP.VF.Set(av_pix_fmt_desc_get(static_cast<AVPixelFormat>(PropFrame->format)));
Expand Down Expand Up @@ -1343,7 +1345,7 @@ bool BestVideoSource::WriteVideoTrackIndex(const std::string &CachePath) {
for (auto &Iter : Dict)
Iter.second = PV++;

WriteInt(F, Dict.size());
WriteInt(F, static_cast<int>(Dict.size()));
WriteInt64(F, PTSPredictor);

for (const auto &Iter : Dict)
Expand Down
3 changes: 3 additions & 0 deletions src/videosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ struct VideoProperties {
int Width;
int Height;

bool FieldBased;
bool TFF;

/* Stereo 3D */
int Stereo3DType;
int Stereo3DFlags;
Expand Down

0 comments on commit 31ce21e

Please sign in to comment.