1
/* $Id: avi_stream.h 3715 2011-08-19 09:35:25Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#ifndef __PJMEDIA_AVI_STREAM_H__
20
#define __PJMEDIA_AVI_STREAM_H__
24
* @brief AVI file player.
26
#include <pjmedia/port.h>
34
* @defgroup PJMEDIA_FILE_PLAY AVI File Player
35
* @ingroup PJMEDIA_PORT
36
* @brief Video and audio playback from AVI file
41
* AVI file player options.
43
enum pjmedia_avi_file_player_option
46
* Tell the file player to return NULL frame when the whole
47
* file has been played.
49
PJMEDIA_AVI_FILE_NO_LOOP = 1
53
* AVI stream data type.
55
typedef pjmedia_port pjmedia_avi_stream;
58
* Opaque data type for AVI streams. AVI streams is a collection of
59
* zero or more AVI stream.
61
typedef struct pjmedia_avi_streams pjmedia_avi_streams;
64
* Create avi streams to play an AVI file. AVI player supports
65
* reading AVI file with uncompressed video format and
66
* 16 bit PCM or compressed G.711 A-law/U-law audio format.
68
* @param pool Pool to create the streams.
69
* @param filename File name to open.
70
* @param flags Avi streams creation flags.
71
* @param p_streams Pointer to receive the avi streams instance.
73
* @return PJ_SUCCESS on success.
76
pjmedia_avi_player_create_streams(pj_pool_t *pool,
79
pjmedia_avi_streams **p_streams);
82
* Get the number of AVI stream.
84
* @param streams The AVI streams.
86
* @return The number of AVI stream.
89
pjmedia_avi_streams_get_num_streams(pjmedia_avi_streams *streams);
92
* Return the idx-th stream of the AVI streams.
94
* @param streams The AVI streams.
95
* @param idx The stream index.
97
* @return The AVI stream or NULL if it does not exist.
99
PJ_DECL(pjmedia_avi_stream *)
100
pjmedia_avi_streams_get_stream(pjmedia_avi_streams *streams,
104
* Return an AVI stream with a certain media type from the AVI streams.
106
* @param streams The AVI streams.
107
* @param start_idx The starting index.
108
* @param media_type The media type of the stream.
110
* @return The AVI stream or NULL if it does not exist.
112
PJ_DECL(pjmedia_avi_stream *)
113
pjmedia_avi_streams_get_stream_by_media(pjmedia_avi_streams *streams,
115
pjmedia_type media_type);
118
* Return the media port of an AVI stream.
120
* @param stream The AVI stream.
122
* @return The media port.
124
PJ_INLINE(pjmedia_port *)
125
pjmedia_avi_stream_get_port(pjmedia_avi_stream *stream)
127
return (pjmedia_port *)stream;
131
* Get the data length, in bytes.
133
* @param stream The AVI stream.
135
* @return The length of the data, in bytes. Upon error it will
136
* return negative value.
138
PJ_DECL(pj_ssize_t) pjmedia_avi_stream_get_len(pjmedia_avi_stream *stream);
142
* Register a callback to be called when the file reading has reached the
143
* end of file. If the file is set to play repeatedly, then the callback
144
* will be called multiple times. Note that only one callback can be
145
* registered for each AVI stream.
147
* @param stream The AVI stream.
148
* @param user_data User data to be specified in the callback
149
* @param cb Callback to be called. If the callback returns non-
150
* PJ_SUCCESS, the playback will stop. Note that if
151
* application destroys the file port in the callback,
152
* it must return non-PJ_SUCCESS here.
154
* @return PJ_SUCCESS on success.
157
pjmedia_avi_stream_set_eof_cb(pjmedia_avi_stream *stream,
159
pj_status_t (*cb)(pjmedia_avi_stream *stream,
170
#endif /* __PJMEDIA_AVI_STREAM_H__ */