blob: 91b471d2f039f92a9ad9622113543fa837bedfd9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
use four_cc::FourCC;
use bytes::{BufMut, BytesMut};
use crate::Mp4BoxError;
use crate::{FullBoxHeader, Mp4Box};
pub struct DataEntryUrlBox {
pub location: String,
}
impl Mp4Box for DataEntryUrlBox {
const NAME: FourCC = FourCC(*b"url ");
fn get_full_box_header(&self) -> Option<FullBoxHeader> {
Some(FullBoxHeader::new(0, 0x000001))
}
fn content_size(&self) -> u64 {
self.location.as_bytes().len() as u64 + 1
}
fn write_box_contents(&self, writer: &mut BytesMut) -> Result<(), Mp4BoxError> {
let mut v = Vec::new();
v.extend(self.location.as_bytes());
v.push(0);
assert_eq!(v.len() as u64, self.content_size());
writer.put_slice(&v);
Ok(())
}
}
|