Home --> Documentations --> PJMEDIA Reference

Data Structures | Typedefs | Enumerations | Functions
AVI File Player

Video and audio playback from AVI file. More...

Data Structures

struct  pjmedia_wav_player_info
 

Typedefs

typedef pjmedia_port pjmedia_avi_stream
 
typedef struct pjmedia_avi_streams pjmedia_avi_streams
 

Enumerations

enum  pjmedia_avi_file_player_option { PJMEDIA_AVI_FILE_NO_LOOP = 1 }
 
enum  pjmedia_file_player_option { PJMEDIA_FILE_NO_LOOP = 1 }
 

Functions

pj_status_t pjmedia_avi_player_create_streams (pj_pool_t *pool, const char *filename, unsigned flags, pjmedia_avi_streams **p_streams)
 
unsigned pjmedia_avi_streams_get_num_streams (pjmedia_avi_streams *streams)
 
pjmedia_avi_streampjmedia_avi_streams_get_stream (pjmedia_avi_streams *streams, unsigned idx)
 
pjmedia_avi_streampjmedia_avi_streams_get_stream_by_media (pjmedia_avi_streams *streams, unsigned start_idx, pjmedia_type media_type)
 
pjmedia_portpjmedia_avi_stream_get_port (pjmedia_avi_stream *stream)
 
pj_ssize_t pjmedia_avi_stream_get_len (pjmedia_avi_stream *stream)
 
pj_status_t pjmedia_avi_stream_set_eof_cb (pjmedia_avi_stream *stream, void *user_data, pj_status_t(*cb)(pjmedia_avi_stream *stream, void *usr_data))
 
pj_status_t pjmedia_wav_player_port_create (pj_pool_t *pool, const char *filename, unsigned ptime, unsigned flags, pj_ssize_t buff_size, pjmedia_port **p_port)
 
pj_status_t pjmedia_wav_player_get_info (pjmedia_port *port, pjmedia_wav_player_info *i)
 
pj_ssize_t pjmedia_wav_player_get_len (pjmedia_port *port)
 
pj_status_t pjmedia_wav_player_port_set_pos (pjmedia_port *port, pj_uint32_t offset)
 
pj_ssize_t pjmedia_wav_player_port_get_pos (pjmedia_port *port)
 
pj_status_t pjmedia_wav_player_set_eof_cb (pjmedia_port *port, void *user_data, pj_status_t(*cb)(pjmedia_port *port, void *usr_data))
 

Detailed Description

Audio playback from WAV file.

Typedef Documentation

AVI stream data type.

Opaque data type for AVI streams. AVI streams is a collection of zero or more AVI stream.

Enumeration Type Documentation

AVI file player options.

Enumerator
PJMEDIA_AVI_FILE_NO_LOOP 

Tell the file player to return NULL frame when the whole file has been played.

WAV file player options.

Enumerator
PJMEDIA_FILE_NO_LOOP 

Tell the file player to return NULL frame when the whole file has been played.

Function Documentation

pj_status_t pjmedia_avi_player_create_streams ( pj_pool_t pool,
const char *  filename,
unsigned  flags,
pjmedia_avi_streams **  p_streams 
)

Create avi streams to play an AVI file. AVI player supports reading AVI file with uncompressed video format and 16 bit PCM or compressed G.711 A-law/U-law audio format.

Parameters
poolPool to create the streams.
filenameFile name to open.
flagsAvi streams creation flags.
p_streamsPointer to receive the avi streams instance.
Returns
PJ_SUCCESS on success.
unsigned pjmedia_avi_streams_get_num_streams ( pjmedia_avi_streams streams)

Get the number of AVI stream.

Parameters
streamsThe AVI streams.
Returns
The number of AVI stream.
pjmedia_avi_stream* pjmedia_avi_streams_get_stream ( pjmedia_avi_streams streams,
unsigned  idx 
)

Return the idx-th stream of the AVI streams.

Parameters
streamsThe AVI streams.
idxThe stream index.
Returns
The AVI stream or NULL if it does not exist.
pjmedia_avi_stream* pjmedia_avi_streams_get_stream_by_media ( pjmedia_avi_streams streams,
unsigned  start_idx,
pjmedia_type  media_type 
)

Return an AVI stream with a certain media type from the AVI streams.

Parameters
streamsThe AVI streams.
start_idxThe starting index.
media_typeThe media type of the stream.
Returns
The AVI stream or NULL if it does not exist.
pjmedia_port* pjmedia_avi_stream_get_port ( pjmedia_avi_stream stream)

Return the media port of an AVI stream.

Parameters
streamThe AVI stream.
Returns
The media port.
pj_ssize_t pjmedia_avi_stream_get_len ( pjmedia_avi_stream stream)

Get the data length, in bytes.

Parameters
streamThe AVI stream.
Returns
The length of the data, in bytes. Upon error it will return negative value.
pj_status_t pjmedia_avi_stream_set_eof_cb ( pjmedia_avi_stream stream,
void *  user_data,
pj_status_t(*)(pjmedia_avi_stream *stream, void *usr_data)  cb 
)

Register a callback to be called when the file reading has reached the end of file. If the file is set to play repeatedly, then the callback will be called multiple times. Note that only one callback can be registered for each AVI stream.

Parameters
streamThe AVI stream.
user_dataUser data to be specified in the callback
cbCallback to be called. If the callback returns non- PJ_SUCCESS, the playback will stop. Note that if application destroys the file port in the callback, it must return non-PJ_SUCCESS here.
Returns
PJ_SUCCESS on success.
pj_status_t pjmedia_wav_player_port_create ( pj_pool_t pool,
const char *  filename,
unsigned  ptime,
unsigned  flags,
pj_ssize_t  buff_size,
pjmedia_port **  p_port 
)

Create a media port to play streams from a WAV file. WAV player port supports for reading WAV file with uncompressed 16 bit PCM format or compressed G.711 A-law/U-law format.

Parameters
poolPool to create memory buffers for this port.
filenameFile name to open.
ptimeThe duration (in miliseconds) of each frame read from this port. If the value is zero, the default duration (20ms) will be used.
flagsPort creation flags.
buff_sizeBuffer size to be allocated. If the value is zero or negative, the port will use default buffer size (which is about 4KB).
p_portPointer to receive the file port instance.
Returns
PJ_SUCCESS on success.
pj_status_t pjmedia_wav_player_get_info ( pjmedia_port port,
pjmedia_wav_player_info i 
)

Get additional info about the file player.

Parameters
portThe file port.
iThe info.
Returns
PJ_SUCCESS on success or the appropriate error code.
pj_ssize_t pjmedia_wav_player_get_len ( pjmedia_port port)

Get the data length, in bytes.

Parameters
portThe file player port.
Returns
The length of the data, in bytes. On error, the error code is given as negative value.
pj_status_t pjmedia_wav_player_port_set_pos ( pjmedia_port port,
pj_uint32_t  offset 
)

Set the file play position of WAV player.

Parameters
portThe file player port.
offsetPlayback position in bytes, relative to the start of the payload.
Returns
PJ_SUCCESS on success.
pj_ssize_t pjmedia_wav_player_port_get_pos ( pjmedia_port port)

Get the file play position of WAV player, in bytes.

Parameters
portThe file player port.
Returns
The current play position, in bytes. On error, the error code is given as negative value.
pj_status_t pjmedia_wav_player_set_eof_cb ( pjmedia_port port,
void *  user_data,
pj_status_t(*)(pjmedia_port *port, void *usr_data)  cb 
)

Register a callback to be called when the file reading has reached the end of file. If the file is set to play repeatedly, then the callback will be called multiple times. Note that only one callback can be registered for each file port.

Parameters
portThe file player port.
user_dataUser data to be specified in the callback
cbCallback to be called. If the callback returns non- PJ_SUCCESS, the playback will stop. Note that if application destroys the file port in the callback, it must return non-PJ_SUCCESS here.
Returns
PJ_SUCCESS on success.

 


PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.