-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
isomp4: parse Dolby Vision configuration
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Symphonia | ||
// Copyright (c) 2019-2022 The Project Symphonia Developers. | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
use symphonia_core::codecs::video::well_known::extra_data::VIDEO_EXTRA_DATA_ID_DOLBY_VISION_CONFIG; | ||
use symphonia_core::codecs::video::VideoExtraData; | ||
use symphonia_core::errors::{Error, Result}; | ||
use symphonia_core::io::ReadBytes; | ||
|
||
use crate::atoms::{Atom, AtomHeader}; | ||
|
||
use super::stsd::VisualSampleEntry; | ||
|
||
#[allow(dead_code)] | ||
#[derive(Debug)] | ||
pub struct DvvCAtom { | ||
extra_data: VideoExtraData, | ||
} | ||
|
||
impl Atom for DvvCAtom { | ||
fn read<B: ReadBytes>(reader: &mut B, header: AtomHeader) -> Result<Self> { | ||
// The Dolby Vision Configuration atom payload | ||
let len = header | ||
.data_len() | ||
.ok_or_else(|| Error::DecodeError("isomp4 (dvvC): expected atom size to be known"))?; | ||
|
||
let dv_data = VideoExtraData { | ||
id: VIDEO_EXTRA_DATA_ID_DOLBY_VISION_CONFIG, | ||
data: reader.read_boxed_slice_exact(len as usize)?, | ||
}; | ||
|
||
Ok(Self { extra_data: dv_data }) | ||
} | ||
} | ||
|
||
impl DvvCAtom { | ||
pub fn fill_video_sample_entry(&self, entry: &mut VisualSampleEntry) { | ||
entry.extra_data.push(self.extra_data.clone()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters