Function nom_exif::parse_metadata

source ·
pub fn parse_metadata<R: Read + Seek>(
    reader: R
) -> Result<Vec<(String, EntryValue)>>
Expand description

Analyze the byte stream in the reader as a MOV/MP4 file, attempting to extract any possible metadata it may contain, and return it in the form of key-value pairs.

Please note that the parsing routine itself provides a buffer, so the reader may not need to be wrapped with BufRead.

§Usage

use nom_exif::*;

use std::fs::File;
use std::path::Path;

let f = File::open(Path::new("./testdata/meta.mov")).unwrap();
let entries = parse_metadata(f).unwrap();

assert_eq!(
    entries
        .iter()
        .map(|x| format!("{x:?}"))
        .collect::<Vec<_>>()
        .join("\n"),
    r#"("com.apple.quicktime.make", Text("Apple"))
("com.apple.quicktime.model", Text("iPhone X"))
("com.apple.quicktime.software", Text("12.1.2"))
("com.apple.quicktime.location.ISO6709", Text("+27.1281+100.2508+000.000/"))
("com.apple.quicktime.creationdate", Time(2019-02-12T15:27:12+08:00))
("duration", U32(500))
("width", U32(720))
("height", U32(1280))"#,
);