FLAC__Metadata_Chain

Struct FLAC__Metadata_Chain 

Source
pub struct FLAC__Metadata_Chain { /* private fields */ }
Expand description

\defgroup flac_metadata_level2 FLAC/metadata.h: metadata level 2 interface \ingroup flac_metadata

\brief The level 2 interface provides read-write access to FLAC file metadata; all metadata is read into memory, operated on in memory, and then written to file, which is more efficient than level 1 when editing multiple blocks.

Currently Ogg FLAC is supported for read only, via FLAC__metadata_chain_read_ogg() but a subsequent FLAC__metadata_chain_write() will fail.

The general usage of this interface is:

  • Create a new chain using FLAC__metadata_chain_new(). A chain is a linked list of FLAC metadata blocks.
  • Read all metadata into the chain from a FLAC file using FLAC__metadata_chain_read() or FLAC__metadata_chain_read_ogg() and check the status.
  • Optionally, consolidate the padding using FLAC__metadata_chain_merge_padding() or FLAC__metadata_chain_sort_padding().
  • Create a new iterator using FLAC__metadata_iterator_new()
  • Initialize the iterator to point to the first element in the chain using FLAC__metadata_iterator_init()
  • Traverse the chain using FLAC__metadata_iterator_next and FLAC__metadata_iterator_prev().
  • Get a block for reading or modification using FLAC__metadata_iterator_get_block(). The pointer to the object inside the chain is returned, so the block is yours to modify. Changes will be reflected in the FLAC file when you write the chain. You can also add and delete blocks (see functions below).
  • When done, write out the chain using FLAC__metadata_chain_write(). Make sure to read the whole comment to the function below.
  • Delete the chain using FLAC__metadata_chain_delete().

\note Even though the FLAC file is not open while the chain is being manipulated, you must not alter the file externally during this time. The chain assumes the FLAC file will not change between the time of FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg() and FLAC__metadata_chain_write().

\note Do not modify the is_last, length, or type fields of returned FLAC__StreamMetadata objects. These are managed automatically.

\note The metadata objects returned by FLAC__metadata_iterator_get_block() are owned by the chain; do not FLAC__metadata_object_delete() them. In the same way, blocks passed to FLAC__metadata_iterator_set_block() become owned by the chain and they will be deleted when the chain is deleted.

{

Trait Implementations§

Source§

impl Clone for FLAC__Metadata_Chain

Source§

fn clone(&self) -> FLAC__Metadata_Chain

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FLAC__Metadata_Chain

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for FLAC__Metadata_Chain

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.