Prosody Audio Video Format (AVF): API: sm_avfplay_start
Prototype Definition
int sm_avfplay_start(struct sm_avfplay_start_parms *avfsp)
Parameters
- *avfsp
-
a structure of the following type:
typedef struct sm_avfplay_start_parms {
tSMAVFplayId avfplay; /* in */
enum kSMAVFOutputType {
kSMAVFOutputAVFVideo,
kSMAVFOutputAVFAudio,
kSMAVFOutputLinearAudio,
} dest_type; /* in */
union {
struct {
tSM_INT sampling_rate; /* in */
enum kSMAudioDataFormat {
kSMAudioDataFormatALawPCM,
kSMAudioDataFormatULawPCM,
kSMAudioDataFormatAMRNB,
kSMAudioDataFormat16bit,
kSMAudioDataFormat8bit,
} src_type; /* in */
} audio; /* in */
} u_dest_type; /* in */
tSM_INT hbuf_size; /* in */
tSM_INT test_mode; /* in */
} SM_AVFPLAY_START_PARMS;
Description
Starts the necessary tasks on the module for playback of AVF-encapsulated
video or audio.
Note that, unlike most tasks, an AVF player can output different types
of data - e.g. AVF AMR-NB audio stream, AVF H.263 video stream, etc. -
dependant on how it is started. It is the application writer's
responsibility to ensure that any task (e.g. VMP[tx]) connected to the
AVF player's datafeed is able to process this data.
Note: The union in in the above struct is used to allow future expansion.
Fields
- avfplay
- A tSMAVFplayId that has been prevously created by a call to
sm_avfplay_create().
- dest_type
- The type of data to output on the datafeed.
One of these values:
- kSMAVFOutputAVFVideo
- Output raw AVF-encapsulated video frames. The AVF player does not
modify or interpret the media data within these frames.
- kSMAVFOutputAVFAudio
- Output raw AVF-encapsulated audio frames. The AVF player does not
modify or interpret the media data within these frames.
- kSMAVFOutputLinearAudio
- Output linear audio, converting the supplied AVF-encapsulated audio
frames' payload using the audio decoder specified in the
src_type
field.
- u_dest_type
-
- audio
- This struct is valid only if
dest_type
is
kSMAVFOutputAVFAudio
or
kSMAVFOutputLinearAudio
- sampling_rate
- The output sampling rate in Hz. For example, 8000 for narrowband audio. If
set to 0, a value of 8000 is assumed.
- src_type
- The audio encoding of the AVF-encapsulated source data.
One of these values:
- kSMAudioDataFormatALawPCM
- G.711 A-law. This uses 8 bits per sample.
- kSMAudioDataFormatULawPCM
- G.711 mu-law. This uses 8 bits per sample.
- kSMAudioDataFormatAMRNB
- AMR-NB. The sampling rate must be 8000Hz.
- kSMAudioDataFormat16bit
- 16-bit linear coding, where each sample is a signed value (-32768 to 32767). The first octet of each sample is the less significant one.
- kSMAudioDataFormat8bit
- 8-bit unsigned linear coding, where each sample is an unsigned value (0 to 255). This is Microsoft's 8-bit format.
- hbuf_size
- This must be set to the desired size of the playback's buffer on the module
in bytes. For audio replays 8192 is generally a suitable value. For video
replays the value depends on the video content but MUST be comfortably
larger than the largest AVF frame to be replayed. If set to 0, for
dest_type
kSMAVFOutputAVFAudio
the assumed size is 8192, and for
dest_type
kSMAVFOutputAVFVideo
the assumed size is 32768. This value is ignored if
dest_type
is
kSMAVFOutputLinearAudio
and, in this case, a default buffer size is used as for regular audio playback.
- test_mode
- For Aculab use only: sets the test mode. Must be set to 0 for normal operation.
Returns
0
if call completed successfully, otherwise a standard error such as:
- ERR_SM_DEVERR - device error
This function is part of the Prosody Audio Video Format (AVF) API.