Skip to content

Most visited

Recently visited


NdkMediaDataSource.h File Reference

NdkMediaDataSource.h File Reference


typedef struct AMediaDataSource AMediaDataSource
typedef ssize_t(* AMediaDataSourceReadAt) (void *userdata, off64_t offset, void *buffer, size_t size)
typedef ssize_t(* AMediaDataSourceGetSize) (void *userdata)
typedef void(* AMediaDataSourceClose) (void *userdata)


AMediaDataSourceAMediaDataSource_new ()
void AMediaDataSource_delete (AMediaDataSource *)
void AMediaDataSource_setUserdata (AMediaDataSource *, void *userdata)
void AMediaDataSource_setReadAt (AMediaDataSource *, AMediaDataSourceReadAt)
void AMediaDataSource_setGetSize (AMediaDataSource *, AMediaDataSourceGetSize)
void AMediaDataSource_setClose (AMediaDataSource *, AMediaDataSourceClose)

Typedef Documentation

◆ AMediaDataSource

◆ AMediaDataSourceClose

typedef void(* AMediaDataSourceClose) (void *userdata)

Called to close the data source and release associated resources. The NDK media framework guarantees that after |close| is called no future callbacks will be invoked on the data source.

◆ AMediaDataSourceGetSize

typedef ssize_t(* AMediaDataSourceGetSize) (void *userdata)

Called to get the size of the data source.

Return the size of data source in bytes, or -1 if the size is unknown.

◆ AMediaDataSourceReadAt

typedef ssize_t(* AMediaDataSourceReadAt) (void *userdata, off64_t offset, void *buffer, size_t size)

Called to request data from the given |offset|.

Implementations should should write up to |size| bytes into |buffer|, and return the number of bytes written.

Return 0 if size is zero (thus no bytes are read).

Return -1 to indicate that end of stream is reached.

Function Documentation

◆ AMediaDataSource_delete()

void AMediaDataSource_delete ( AMediaDataSource )

Delete a previously created media data source.

◆ AMediaDataSource_new()

AMediaDataSource* AMediaDataSource_new ( )

Create new media data source. Returns NULL if memory allocation for the new data source object fails.

◆ AMediaDataSource_setClose()

void AMediaDataSource_setClose ( AMediaDataSource ,

Set a custom callback to receive signal from the NDK media framework when the data source is closed.

Please refer to the definition of AMediaDataSourceClose for additional details.

◆ AMediaDataSource_setGetSize()

void AMediaDataSource_setGetSize ( AMediaDataSource ,

Set a custom callback for supplying the size of the data source to the NDK media framework.

Please refer to the definition of AMediaDataSourceGetSize for additional details.

◆ AMediaDataSource_setReadAt()

void AMediaDataSource_setReadAt ( AMediaDataSource ,

Set a custom callback for supplying random access media data to the NDK media framework.

Implement this if your app has special requirements for the way media data is obtained, or if you need a callback when data is read by the NDK media framework.

Please refer to the definition of AMediaDataSourceReadAt for additional details.

◆ AMediaDataSource_setUserdata()

void AMediaDataSource_setUserdata ( AMediaDataSource ,
void *  userdata 

Set an user provided opaque handle. This opaque handle is passed as the first argument to the data source callbacks.

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


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. (Dec 2017 Android Platform & Tools Survey)