Struct sm_motion_photo::SmMotion [−][src]
Simple extractor of Motion Photo taken on Samsung phone (if it provides such feature and this feature is turned on) and saves it in MP4. It is available on Galaxy S20, S20+, S20 Ultra, Z Flip, Note10, Note10+, S10e, S10, S10+, Fold, Note9, S9, S9+, Note8, S8, S8+, S7, and S7 edge.
Example of usage:
use std::fs::File; use sm_motion_photo::SmMotion; // open file let photo_file = File::open("tests/data/photo.jpg").unwrap(); let mut sm = SmMotion::with(&photo_file).unwrap(); println!("JPEG file contains video? {:?}", sm.has_video()); let mut video_file = File::create("tests/tmp/video.mp4").unwrap(); // dump mp4 from jpeg sm.dump_video_file(&mut video_file).unwrap(); // get video duration (no dump needed) println!("{:?}", sm.get_video_file_duration()); // get MP4 file context println!("{:?}", sm.find_video_context()); // You can also save index and use it afterwards let mut sm_cached = SmMotion::with_precalculated(&photo_file, 3366251).unwrap(); println!("{:?}", sm_cached.get_video_file_duration());
Fields
video_index: Option<usize>
Index where starts a video
Implementations
impl SmMotion
[src]
pub fn with(file: &File) -> Option<SmMotion>
[src]
First things first send here a file ref
pub fn with_precalculated(file: &File, index: usize) -> Option<SmMotion>
[src]
Initialize SmMotion with a known video index. It's handful when you are caching the results of searching.
pub fn find_video_index(&mut self) -> Result<Option<usize>, &'static str>
[src]
Look for starting MP4 index in Samsung Motion Photo JPEG (or HEIC/HEIF) file
pub fn has_video(&self) -> bool
[src]
Check if a photo has a Motion Photo feature
pub fn find_video_context(&self) -> Option<MediaContext>
[src]
Get video context from mp4parse.
pub fn get_video_file_duration(&self) -> Option<u64>
[src]
Gen length of video file in photo in milliseconds
pub fn dump_video_file(&self, file: &mut File) -> Result<(), &str>
[src]
Auto Trait Implementations
impl RefUnwindSafe for SmMotion
[src]
impl Send for SmMotion
[src]
impl Sync for SmMotion
[src]
impl Unpin for SmMotion
[src]
impl UnwindSafe for SmMotion
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,