Repository navigation
fix: keep audio-only containers as sound in PPTX - #2413
mahesh-desu wants to merge 3 commits into
Conversation
Signed-off-by: MaheshDesu <mahesh.desu3@gmail.com>
Signed-off-by: MaheshDesu <mahesh.desu3@gmail.com>
…torytold#2390) Signed-off-by: MaheshDesu <mahesh.desu3@gmail.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Audio-only files now save as sound in a PPTX, not as movies.
Fixes #2390.
What the user saw. Inserting an audio-only
.asfthroughinsert.audioreportedvideo: false, but the saved PPTX stored the bytes asppt/media/media1.wmv; the reference app reopened it as a Movie. A byte-identical.wmacopy reopened as Sound.Cause.
content_typeclassifies an ASF/WMV container from the filename extension and returnedvideo/x-ms-wmvfor.asf, even when the probe found only an audio stream.insert.audiostored that MIME on the media item, and the shared PPTX writer chooses the part extension from the MIME (audio/x-ms-wma→.wma,video/x-ms-wmv→.wmv). TheMediaClip.videoflag was already correct.What changed. After the probe,
insert.audionormalizes the MIME only when the command is audio, the probe found audio and the probe found no video:video/x-ms-wmvbecomesaudio/x-ms-wma, and the equivalentvideo/mp4,video/webm,video/oggandvideo/quicktimevalues become their audio MIMEs. Video-bearing containers keep theirvideo/*MIME andinsert.videois unchanged. The probe, the media model and the shared writer's MIME table are untouched.Test.
audio_only_asf_saves_as_soundinserts the ownedtone.wmafixture under the nametone.asf, asserts the returned content type isaudio/x-ms-wma, opens the saved PPTX ZIP to findppt/media/media1.wmaand no.wmv, reopens the deck, and checksvideo: false, a nonzero duration and the audio content type.audio_content_type_maps_every_audio_only_containerpins every mapping arm, including the reporter's audio-only.mp4/.webmfollow-up.audio_only_ogv_saves_as_soundinserts the ownedtone.oggunder the nametone.ogv, so a realvideo/oggcontainer becomes anaudio/oggentry.a_video_container_inserted_as_video_stays_a_movieinserts the ownedclip-h264.mp4throughinsert.videoand checks the reopened shape is still a movie;insert_video_still_rejects_an_audio_only_filekeeps the video validator honest, andunreadable_audio_is_still_refusedproves the original MIME validation still rejects an unreadable file.Verification.
cargo fmt --all --check— passed.cargo clippy -p deckcraft-engine --all-targets -- -D warnings— passed.cargo test -p deckcraft-engine— 607 lib tests, 6 integration tests and 8 show-paragraph tests passed; 1 ignored; 0 failed.videoflag.The mapping follows the existing writer table, so no new dependency or craft-libs change is needed.
Summary by CodeRabbit