Skip to content

Commit 4d27bae

Browse files
committed
ndk/media: Add bindings for AMediaExtractor and AMediaDataSource
1 parent 46d6ebb commit 4d27bae

File tree

4 files changed

+662
-0
lines changed

4 files changed

+662
-0
lines changed

ndk/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

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

67
# 0.8.0 (2023-10-15)
78

ndk/src/asset.rs

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use std::{
88
ffi::{CStr, CString},
99
io,
10+
ops::Range,
1011
os::fd::{FromRawFd, OwnedFd},
1112
ptr::NonNull,
1213
};
@@ -321,3 +322,11 @@ pub struct OpenedFileDescriptor {
321322
pub offset: usize,
322323
pub size: usize,
323324
}
325+
326+
impl OpenedFileDescriptor {
327+
/// Returns a range starting at [`OpenedFileDescriptor::offset`] with a length of
328+
/// [`OpenedFileDescriptor::size`].
329+
pub fn range(&self) -> Range<usize> {
330+
self.offset..(self.offset + self.size)
331+
}
332+
}

0 commit comments

Comments
 (0)