Skip to content

Commit

Permalink
ndk/media: Add bindings for AMediaExtractor and AMediaDataSource
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Dec 2, 2023
1 parent 46d6ebb commit d04cd5b
Show file tree
Hide file tree
Showing 4 changed files with 662 additions and 0 deletions.
1 change: 1 addition & 0 deletions ndk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Move `MediaFormat` from `media::media_codec` to its own `media::media_format` module. (#442)
- media_format: Expose `MediaFormat::copy()` and `MediaFormat::clear()` from API level 29. (#449)
- media: Add bindings for `AMediaCodecCryptoInfo`, `AMediaExtractor` and `AMediaDataSource`. (#453)

# 0.8.0 (2023-10-15)

Expand Down
9 changes: 9 additions & 0 deletions ndk/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use std::{
ffi::{CStr, CString},
io,
ops::Range,
os::fd::{FromRawFd, OwnedFd},
ptr::NonNull,
};
Expand Down Expand Up @@ -321,3 +322,11 @@ pub struct OpenedFileDescriptor {
pub offset: usize,
pub size: usize,
}

impl OpenedFileDescriptor {
/// Returns a range starting at [`OpenedFileDescriptor::offset`] with a length of
/// [`OpenedFileDescriptor::size`].
pub fn range(&self) -> Range<usize> {
self.offset..(self.offset + self.size)
}
}
Loading

0 comments on commit d04cd5b

Please sign in to comment.