mp4_atom/moov/trak/mdia/minf/dinf/dref/
urn.rs1use crate::*;
2
3ext! {
4 name: Urn,
5 versions: [0],
6 flags: {}
7}
8
9#[derive(Debug, Clone, PartialEq, Eq, Default)]
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12pub struct Urn {
13 pub name: String,
14 pub location: String,
15}
16
17impl AtomExt for Urn {
18 type Ext = UrnExt;
19
20 const KIND_EXT: FourCC = FourCC::new(b"urn ");
21
22 fn decode_body_ext<B: Buf>(buf: &mut B, _ext: UrnExt) -> Result<Self> {
23 Ok(Self {
24 name: String::decode(buf)?,
25 location: String::decode(buf)?,
26 })
27 }
28
29 fn encode_body_ext<B: BufMut>(&self, buf: &mut B) -> Result<UrnExt> {
30 self.name.as_str().encode(buf)?;
31 self.location.as_str().encode(buf)?;
32 Ok(UrnExt::default())
33 }
34}