Skip to content

Commit

Permalink
Fix vs video source not handling unicode properly
Browse files Browse the repository at this point in the history
Even more std::filesystem
  • Loading branch information
myrsloik committed Apr 8, 2024
1 parent 50ef9e7 commit 278d130
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/avisynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class AvisynthVideoSource : public IClip {
V->SetMaxCacheSize(CacheSize * 1024 * 1024);

if (Timecodes)
V->WriteTimecodes(Timecodes);
V->WriteTimecodes(std::filesystem::u8path(Timecodes));

} catch (BestSourceException &e) {
Env->ThrowError("BestVideoSource: %s", e.what());
Expand Down
4 changes: 2 additions & 2 deletions src/vapoursynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static void VS_CC CreateBestVideoSource(const VSMap *In, VSMap *Out, void *, VSC
BSInit();

int err;
const char *Source = vsapi->mapGetData(In, "source", 0, nullptr);
std::filesystem::path Source = std::filesystem::u8path(vsapi->mapGetData(In, "source", 0, nullptr));
const char *CachePath = vsapi->mapGetData(In, "cachepath", 0, &err);
const char *HWDevice = vsapi->mapGetData(In, "hwdevice", 0, &err);
const char *Timecodes = vsapi->mapGetData(In, "timecodes", 0, &err);
Expand Down Expand Up @@ -232,7 +232,7 @@ static void VS_CC CreateBestVideoSource(const VSMap *In, VSMap *Out, void *, VSC
D->V->SetSeekPreRoll(SeekPreRoll);

if (Timecodes)
D->V->WriteTimecodes(Timecodes);
D->V->WriteTimecodes(std::filesystem::u8path(Timecodes));
} catch (BestSourceException &e) {
delete D;
vsapi->mapSetError(Out, (std::string("VideoSource: ") + e.what()).c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/videosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,8 +1545,8 @@ bool BestVideoSource::GetFrameIsTFF(int64_t N, bool RFF) {
}
}

bool BestVideoSource::WriteTimecodes(const std::string &TimecodeFile) const {
file_ptr_t F(OpenNormalFile(std::filesystem::u8path(TimecodeFile), true));
bool BestVideoSource::WriteTimecodes(const std::filesystem::path &TimecodeFile) const {
file_ptr_t F(OpenNormalFile(TimecodeFile, true));
if (!F)
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/videosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class BestVideoSource {
[[nodiscard]] BestVideoFrame *GetFrameWithRFF(int64_t N, bool Linear = false);
[[nodiscard]] BestVideoFrame *GetFrameByTime(double Time, bool Linear = false);
[[nodiscard]] bool GetFrameIsTFF(int64_t N, bool RFF = false);
bool WriteTimecodes(const std::string &TimecodeFile) const;
bool WriteTimecodes(const std::filesystem::path &TimecodeFile) const;
[[nodiscard]] const FrameInfo &GetFrameInfo(int64_t N) const;
[[nodiscard]] bool GetLinearDecodingState() const;
};
Expand Down

0 comments on commit 278d130

Please sign in to comment.