Skip to content

Commit

Permalink
Merge pull request #25 from Rikharthu/feature/expose_packet_key_frame…
Browse files Browse the repository at this point in the history
…_and_codec_base_time
  • Loading branch information
gerwin3 authored Sep 27, 2023
2 parents fc4ee11 + 45f8761 commit 6810e7b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ impl Decoder {
})
}

/// Get decoder time base.
#[inline]
pub fn time_base(&self) -> AvRational {
self.decoder.time_base()
}

/// Decode frames through iterator interface. This is similar to `decode` but it returns frames
/// through an infinite iterator.
///
Expand Down Expand Up @@ -221,6 +227,12 @@ pub struct DecoderSplit {
}

impl DecoderSplit {
/// Get decoder time base.
#[inline]
pub fn time_base(&self) -> AvRational {
self.decoder_time_base
}

/// Decode a [`Packet`].
///
/// Feeds the packet to the decoder and returns a frame if there is one available. The caller
Expand Down
6 changes: 6 additions & 0 deletions src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ impl Encoder {
self
}

/// Get encoder time base.
#[inline]
pub fn time_base(&self) -> AvRational {
self.encoder_time_base
}

/// Encode a single `ndarray` frame.
///
/// # Arguments
Expand Down
6 changes: 6 additions & 0 deletions src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ impl Packet {
Time::new(Some(self.inner.duration()), self.time_base)
}

// Check whether packet is key.
#[inline]
pub fn is_key(&self) -> bool {
self.inner.is_key()
}

/// Set packet PTS (presentation timestamp).
#[inline]
pub fn set_pts(&mut self, timestamp: &Time) {
Expand Down

0 comments on commit 6810e7b

Please sign in to comment.