Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) |
| 4 | * |
| 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. |
| 9 | * |
| 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. |
| 14 | * |
| 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 |
| 18 | */ |
| 19 | #ifndef PJMEDIA_VIDEODEV_AVI_DEV_H__ |
| 20 | #define PJMEDIA_VIDEODEV_AVI_DEV_H__ |
| 21 | |
| 22 | /** |
| 23 | * @file avi_dev.h |
| 24 | * @brief AVI player virtual device |
| 25 | */ |
| 26 | #include <pjmedia-videodev/videodev.h> |
| 27 | #include <pjmedia/avi_stream.h> |
| 28 | |
| 29 | PJ_BEGIN_DECL |
| 30 | |
| 31 | /** |
| 32 | * @defgroup avi_dev AVI Player Virtual Device |
| 33 | * @ingroup video_device_api |
| 34 | * @brief AVI player virtual device |
| 35 | * @{ |
| 36 | * This describes a virtual capture device which takes its input from an AVI |
| 37 | * file. |
| 38 | */ |
| 39 | |
| 40 | /** |
| 41 | * Settings for the AVI player virtual device. This param corresponds to |
| 42 | * PJMEDIA_VID_DEV_CAP_AVI_PLAY capability of the video device/stream. |
| 43 | */ |
| 44 | typedef struct pjmedia_avi_dev_param |
| 45 | { |
| 46 | /** |
| 47 | * Specifies the full path of the AVI file to be played. |
| 48 | */ |
| 49 | pj_str_t path; |
| 50 | |
| 51 | /** |
| 52 | * If this setting is specified when setting the device, this specifies |
| 53 | * the title to be assigned as the device name. If this setting not |
| 54 | * specified, the filename part of the path will be used. |
| 55 | */ |
| 56 | pj_str_t title; |
| 57 | |
| 58 | /** |
| 59 | * The underlying AVI streams created by the device. If the value is NULL, |
| 60 | * that means the device has not been configured yet. Application can use |
| 61 | * this field to retrieve the audio stream of the AVI. This setting is |
| 62 | * "get"-only and will be ignored in "set capability" operation. |
| 63 | */ |
| 64 | pjmedia_avi_streams *avi_streams; |
| 65 | |
| 66 | } pjmedia_avi_dev_param; |
| 67 | |
| 68 | |
| 69 | /** |
| 70 | * Reset pjmedia_avi_dev_param with the default settings. This mostly will |
| 71 | * reset all values to NULL or zero. |
| 72 | * |
| 73 | * @param p The parameter to be initialized. |
| 74 | */ |
| 75 | PJ_DECL(void) pjmedia_avi_dev_param_default(pjmedia_avi_dev_param *p); |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * Create a AVI device factory, and register it to the video device |
| 80 | * subsystem. At least one factory needs to be created before an AVI |
| 81 | * device can be allocated and used, and normally only one factory is |
| 82 | * needed per application. |
| 83 | * |
| 84 | * @param pf Pool factory to be used. |
| 85 | * @param max_dev Number of devices to be reserved. |
| 86 | * @param p_ret Pointer to return the factory instance, to be |
| 87 | * used when allocating a virtual device. |
| 88 | * |
| 89 | * @return PJ_SUCCESS on success or the appropriate error code. |
| 90 | */ |
| 91 | PJ_DECL(pj_status_t) pjmedia_avi_dev_create_factory( |
| 92 | pj_pool_factory *pf, |
| 93 | unsigned max_dev, |
| 94 | pjmedia_vid_dev_factory **p_ret); |
| 95 | |
| 96 | /** |
| 97 | * Allocate one device ID to be used to play the specified AVI file in |
| 98 | * the parameter. |
| 99 | * |
| 100 | * @param param The parameter, with at least the AVI file path |
| 101 | * set. |
| 102 | * @param p_id Optional pointer to receive device ID to play |
| 103 | * the file. |
| 104 | * |
| 105 | * @return PJ_SUCCESS or the appropriate error code. |
| 106 | * |
| 107 | */ |
| 108 | PJ_DECL(pj_status_t) pjmedia_avi_dev_alloc(pjmedia_vid_dev_factory *f, |
| 109 | pjmedia_avi_dev_param *param, |
| 110 | pjmedia_vid_dev_index *p_id); |
| 111 | |
| 112 | /** |
| 113 | * Retrieve the parameters set for the virtual device. |
| 114 | * |
| 115 | * @param id Device ID. |
| 116 | * @param prm Structure to receive the settings. |
| 117 | * |
| 118 | * @return PJ_SUCCESS or the appropriate error code. |
| 119 | */ |
| 120 | PJ_DECL(pj_status_t) pjmedia_avi_dev_get_param(pjmedia_vid_dev_index id, |
| 121 | pjmedia_avi_dev_param *param); |
| 122 | |
| 123 | /** |
| 124 | * Free the resources associated with the virtual device. |
| 125 | * |
| 126 | * @param id The device ID. |
| 127 | * |
| 128 | * @return PJ_SUCCESS or the appropriate error code. |
| 129 | */ |
| 130 | PJ_DECL(pj_status_t) pjmedia_avi_dev_free(pjmedia_vid_dev_index id); |
| 131 | |
| 132 | /** |
| 133 | * @} |
| 134 | */ |
| 135 | |
| 136 | PJ_END_DECL |
| 137 | |
| 138 | |
| 139 | #endif /* PJMEDIA_VIDEODEV_AVI_DEV_H__ */ |