Skip to content

Most visited

Recently visited

navigation

NdkMediaExtractor.h File Reference

NdkMediaExtractor.h File Reference

Data Structures

struct  PsshEntry
 
struct  PsshInfo
 

Typedefs

typedef struct AMediaExtractor AMediaExtractor
 
typedef struct PsshEntry PsshEntry
 
typedef struct PsshInfo PsshInfo
 

Enumerations

enum  SeekMode { AMEDIAEXTRACTOR_SEEK_PREVIOUS_SYNC, AMEDIAEXTRACTOR_SEEK_NEXT_SYNC, AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC }
 
enum  { AMEDIAEXTRACTOR_SAMPLE_FLAG_SYNC = 1, AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED = 2 }
 

Functions

AMediaExtractorAMediaExtractor_new ()
 
media_status_t AMediaExtractor_delete (AMediaExtractor *)
 
media_status_t AMediaExtractor_setDataSourceFd (AMediaExtractor *, int fd, off64_t offset, off64_t length)
 
media_status_t AMediaExtractor_setDataSource (AMediaExtractor *, const char *location)
 
media_status_t AMediaExtractor_setDataSourceCustom (AMediaExtractor *, AMediaDataSource *src)
 
size_t AMediaExtractor_getTrackCount (AMediaExtractor *)
 
AMediaFormatAMediaExtractor_getTrackFormat (AMediaExtractor *, size_t idx)
 
media_status_t AMediaExtractor_selectTrack (AMediaExtractor *, size_t idx)
 
media_status_t AMediaExtractor_unselectTrack (AMediaExtractor *, size_t idx)
 
ssize_t AMediaExtractor_readSampleData (AMediaExtractor *, uint8_t *buffer, size_t capacity)
 
uint32_t AMediaExtractor_getSampleFlags (AMediaExtractor *)
 
int AMediaExtractor_getSampleTrackIndex (AMediaExtractor *)
 
int64_t AMediaExtractor_getSampleTime (AMediaExtractor *)
 
bool AMediaExtractor_advance (AMediaExtractor *)
 
media_status_t AMediaExtractor_seekTo (AMediaExtractor *, int64_t seekPosUs, SeekMode mode)
 
PsshInfoAMediaExtractor_getPsshInfo (AMediaExtractor *)
 
AMediaCodecCryptoInfoAMediaExtractor_getSampleCryptoInfo (AMediaExtractor *)
 
AMediaFormatAMediaExtractor_getFileFormat (AMediaExtractor *)
 
ssize_t AMediaExtractor_getSampleSize (AMediaExtractor *)
 
int64_t AMediaExtractor_getCachedDuration (AMediaExtractor *)
 

Typedef Documentation

◆ AMediaExtractor

◆ PsshEntry

typedef struct PsshEntry PsshEntry

mapping of crypto scheme uuid to the scheme specific data for that scheme

◆ PsshInfo

typedef struct PsshInfo PsshInfo

list of crypto schemes and their data

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AMEDIAEXTRACTOR_SAMPLE_FLAG_SYNC 
AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED 

◆ SeekMode

enum SeekMode
Enumerator
AMEDIAEXTRACTOR_SEEK_PREVIOUS_SYNC 
AMEDIAEXTRACTOR_SEEK_NEXT_SYNC 
AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC 

Function Documentation

◆ AMediaExtractor_advance()

bool AMediaExtractor_advance ( AMediaExtractor )

Advance to the next sample. Returns false if no more sample data is available (end of stream).

◆ AMediaExtractor_delete()

media_status_t AMediaExtractor_delete ( AMediaExtractor )

Delete a previously created media extractor

◆ AMediaExtractor_getCachedDuration()

int64_t AMediaExtractor_getCachedDuration ( AMediaExtractor )

Returns the duration of cached media samples downloaded from a network data source (AMediaExtractor_setDataSource with a "http(s)" URI) in microseconds.

This information is calculated using total bitrate; if total bitrate is not in the media container it is calculated using total duration and file size.

Returns -1 when the extractor is not reading from a network data source, or when the cached duration cannot be calculated (bitrate, duration, and file size information not available).

◆ AMediaExtractor_getFileFormat()

AMediaFormat* AMediaExtractor_getFileFormat ( AMediaExtractor )

Returns the format of the extractor. The caller must free the returned format using AMediaFormat_delete(format).

This function will always return a format; however, the format could be empty (no key-value pairs) if the media container does not provide format information.

◆ AMediaExtractor_getPsshInfo()

PsshInfo* AMediaExtractor_getPsshInfo ( AMediaExtractor )

Get the PSSH info if present.

◆ AMediaExtractor_getSampleCryptoInfo()

AMediaCodecCryptoInfo* AMediaExtractor_getSampleCryptoInfo ( AMediaExtractor )

◆ AMediaExtractor_getSampleFlags()

uint32_t AMediaExtractor_getSampleFlags ( AMediaExtractor )

Read the current sample's flags.

◆ AMediaExtractor_getSampleSize()

ssize_t AMediaExtractor_getSampleSize ( AMediaExtractor )

Returns the size of the current sample in bytes, or -1 when no samples are available (end of stream). This API can be used in in conjunction with AMediaExtractor_readSampleData:

ssize_t sampleSize = AMediaExtractor_getSampleSize(ex); uint8_t *buf = new uint8_t[sampleSize]; AMediaExtractor_readSampleData(ex, buf, sampleSize);

◆ AMediaExtractor_getSampleTime()

int64_t AMediaExtractor_getSampleTime ( AMediaExtractor )

Returns the current sample's presentation time in microseconds. or -1 if no more samples are available.

◆ AMediaExtractor_getSampleTrackIndex()

int AMediaExtractor_getSampleTrackIndex ( AMediaExtractor )

Returns the track index the current sample originates from (or -1 if no more samples are available)

◆ AMediaExtractor_getTrackCount()

size_t AMediaExtractor_getTrackCount ( AMediaExtractor )

Return the number of tracks in the previously specified media file

◆ AMediaExtractor_getTrackFormat()

AMediaFormat* AMediaExtractor_getTrackFormat ( AMediaExtractor ,
size_t  idx 
)

Return the format of the specified track. The caller must free the returned format

◆ AMediaExtractor_new()

AMediaExtractor* AMediaExtractor_new ( )

Create new media extractor

◆ AMediaExtractor_readSampleData()

ssize_t AMediaExtractor_readSampleData ( AMediaExtractor ,
uint8_t *  buffer,
size_t  capacity 
)

Read the current sample.

◆ AMediaExtractor_seekTo()

media_status_t AMediaExtractor_seekTo ( AMediaExtractor ,
int64_t  seekPosUs,
SeekMode  mode 
)

◆ AMediaExtractor_selectTrack()

media_status_t AMediaExtractor_selectTrack ( AMediaExtractor ,
size_t  idx 
)

Select the specified track. Subsequent calls to readSampleData, getSampleTrackIndex and getSampleTime only retrieve information for the subset of tracks selected. Selecting the same track multiple times has no effect, the track is only selected once.

◆ AMediaExtractor_setDataSource()

media_status_t AMediaExtractor_setDataSource ( AMediaExtractor ,
const char *  location 
)

Set the URI from which the extractor will read.

◆ AMediaExtractor_setDataSourceCustom()

media_status_t AMediaExtractor_setDataSourceCustom ( AMediaExtractor ,
AMediaDataSource src 
)

Set the custom data source implementation from which the extractor will read.

◆ AMediaExtractor_setDataSourceFd()

media_status_t AMediaExtractor_setDataSourceFd ( AMediaExtractor ,
int  fd,
off64_t  offset,
off64_t  length 
)

Set the file descriptor from which the extractor will read.

◆ AMediaExtractor_unselectTrack()

media_status_t AMediaExtractor_unselectTrack ( AMediaExtractor ,
size_t  idx 
)

Unselect the specified track. Subsequent calls to readSampleData, getSampleTrackIndex and getSampleTime only retrieve information for the subset of tracks selected..

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)