xml: resolve relative root against document#1232
Closed
Komzpa wants to merge 1 commit into
Closed
Conversation
Member
|
|
Member
|
In other words, it already works relative to the document without a |
Contributor
|
Kdenlive will only write absolute path to the xml root property, or omit it when archiving a project, but I don't think there is a way to create a relative path. |
Member
|
Rejected |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolve a relative
<mlt root="...">against the directory of the XML document being parsed, instead of leaving it relative to the process current working directory.This matters for portable MLT/Kdenlive projects opened from a GUI or another caller whose cwd is unrelated to the project file. For example, if
/tmp/project/output/repro.kdenlivecontainsroot="."and a media resource../media.mp4, the resource should resolve under/tmp/project/output, not under the caller's cwd.The patch also reuses the same absolute-path helper for normal resource qualification and adds an avformat XML regression test using
avformat-novalidate.Reproducer
I reproduced this with a Kdenlive/MLT project shaped like this:
/tmp/mlt-root-repro/output/repro.kdenlive<mlt root=".">../DJI_0884.MP4,3.400000:../DJI_0884.MP4, and../assets/audio/.../tmp, deliberately not from the project directoryCurrent packaged MLT 7.38.0 resolves the paths against cwd and logs failures like:
In that repro I got 28
failed to load producerlines.With this patch and the same system modules:
The command exits 0 and the same grep finds 0
failed to load producerlines. The resolved resources go through paths such as/tmp/mlt-root-repro/output/./../DJI_0884.MP4, which is the document-relative location.Validation
clang-format -i src/modules/xml/producer_xml.c src/tests/test_mod_avformat/test_mod_avformat.cppcmake --build build -j$(nproc)git diff --checklibmltxml.soresolves it correctly.I could not run the new
test_mod_avformattest locally because this machine lacks the FFmpeg development packages needed to configureMOD_AVFORMAT=ONin a fresh test build. The runtime repro used the patched XML module together with the system avformat module.