- Timestamp:
- Feb 18, 2009 8:14:15 PM (16 years ago)
- Location:
- pjproject/branches/projects/aps-direct
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/aps-direct/pjmedia/build/pjmedia_audiodev.dsp
r2459 r2463 94 94 # Begin Source File 95 95 96 SOURCE="..\src\pjmedia-audiodev\audiotest.c" 97 # End Source File 98 # Begin Source File 99 96 100 SOURCE="..\src\pjmedia-audiodev\pa_dev.c" 97 101 # End Source File … … 112 116 SOURCE="..\include\pjmedia-audiodev\audiodev_imp.h" 113 117 # End Source File 118 # Begin Source File 119 120 SOURCE="..\include\pjmedia-audiodev\audiotest.h" 121 # End Source File 114 122 # End Group 115 123 # End Target -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia-audiodev/audiodev.h
r2459 r2463 226 226 * The underlying driver name 227 227 */ 228 char driver[ 64];228 char driver[128]; 229 229 230 230 /** … … 409 409 */ 410 410 PJ_DECL(pj_status_t) pjmedia_aud_subsys_init(pj_pool_factory *pf); 411 412 413 /** 414 * Get the pool factory registered to the audio subsystem. 415 * 416 * @return The pool factory. 417 */ 418 PJ_DECL(pj_pool_factory*) pjmedia_aud_subsys_get_pool_factory(void); 411 419 412 420 -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/audiodev.c
r2459 r2463 30 30 * At driver level, device ID is a 16bit unsigned integer index. 31 31 */ 32 #define MAKE_DEV_ID(f_id, index) (((f_id & 0xFFFF) << 16) &(index & 0xFFFF))32 #define MAKE_DEV_ID(f_id, index) (((f_id & 0xFFFF) << 16) | (index & 0xFFFF)) 33 33 #define GET_INDEX(dev_id) ((dev_id) & 0xFFFF) 34 34 #define GET_FID(dev_id) ((dev_id) >> 16) … … 40 40 pjmedia_aud_dev_factory* pjmedia_wmme_factory(pj_pool_factory *pf); 41 41 42 43 /* Array of factories */ 44 static struct factory 45 { 46 pjmedia_aud_dev_factory* (*create)(pj_pool_factory*); 47 pjmedia_aud_dev_factory *f; 48 49 } factories[] = 50 { 51 /* WMME */ 42 #define MAX_DRIVERS 16 43 44 /* The audio subsystem */ 45 static struct aud_subsys 46 { 47 pj_pool_factory *pf; 48 unsigned factory_cnt; 49 50 struct factory 52 51 { 53 &pjmedia_wmme_factory 54 }, 55 /* PortAudio: */ 56 { 57 &pjmedia_pa_factory 58 }, 59 }; 60 static unsigned factory_cnt; 52 pjmedia_aud_dev_factory* (*create)(pj_pool_factory*); 53 pjmedia_aud_dev_factory *f; 54 55 } factories[MAX_DRIVERS]; 56 57 } aud_subsys; 58 61 59 62 60 … … 67 65 pj_status_t status = PJ_ENOMEM; 68 66 69 factory_cnt = 0; 70 71 for (i=0; i<PJ_ARRAY_SIZE(factories); ++i) { 72 factories[i].f = (*factories[i].create)(pf); 73 if (!factories[i].f) 74 continue; 75 76 status = factories[i].f->op->init(factories[i].f); 67 aud_subsys.pf = pf; 68 aud_subsys.factory_cnt = 0; 69 70 aud_subsys.factories[aud_subsys.factory_cnt++].create = &pjmedia_pa_factory; 71 aud_subsys.factories[aud_subsys.factory_cnt++].create = &pjmedia_wmme_factory; 72 73 for (i=0; i<aud_subsys.factory_cnt; ++i) { 74 pjmedia_aud_dev_factory *f; 75 76 f = (*aud_subsys.factories[i].create)(pf); 77 if (!f) 78 continue; 79 80 status = f->op->init(f); 77 81 if (status != PJ_SUCCESS) { 78 f actories[i].f->op->destroy(factories[i].f);79 factories[i].f = NULL;82 f->op->destroy(f); 83 continue; 80 84 } 81 85 82 factories[i].f->internal.id = i;83 ++factory_cnt;86 aud_subsys.factories[i].f = f; 87 aud_subsys.factories[i].f->internal.id = i; 84 88 } 85 89 86 return factory_cnt ? PJ_SUCCESS : status; 90 return aud_subsys.factory_cnt ? PJ_SUCCESS : status; 91 } 92 93 /* API: get the pool factory registered to the audio subsystem. */ 94 PJ_DEF(pj_pool_factory*) pjmedia_aud_subsys_get_pool_factory(void) 95 { 96 return aud_subsys.pf; 87 97 } 88 98 … … 92 102 unsigned i; 93 103 94 for (i=0; i<PJ_ARRAY_SIZE(factories); ++i) { 95 if (!factories[i].f) 96 continue; 97 98 factories[i].f->op->destroy(factories[i].f); 99 factories[i].f = NULL; 104 for (i=0; i<aud_subsys.factory_cnt; ++i) { 105 pjmedia_aud_dev_factory *f = aud_subsys.factories[i].f; 106 107 if (!f) 108 continue; 109 110 f->op->destroy(f); 111 aud_subsys.factories[i].f = NULL; 100 112 } 101 113 … … 108 120 unsigned i, count = 0; 109 121 110 for (i=0; i<PJ_ARRAY_SIZE(factories); ++i) { 111 if (!factories[i].f) 112 continue; 113 114 count += factories[i].f->op->get_dev_count(factories[i].f); 122 for (i=0; i<aud_subsys.factory_cnt; ++i) { 123 pjmedia_aud_dev_factory *f = aud_subsys.factories[i].f; 124 125 if (!f) 126 continue; 127 128 count += f->op->get_dev_count(f); 115 129 } 116 130 … … 124 138 unsigned i, count = 0; 125 139 126 for (i=0; i<PJ_ARRAY_SIZE(factories) && count < max_count; ++i) { 140 for (i=0; i<aud_subsys.factory_cnt && count < max_count; ++i) { 141 pjmedia_aud_dev_factory *f = aud_subsys.factories[i].f; 127 142 unsigned j, fcount; 128 143 129 if (!f actories[i].f)130 continue; 131 132 fcount = f actories[i].f->op->get_dev_count(factories[i].f);144 if (!f) 145 continue; 146 147 fcount = f->op->get_dev_count(f); 133 148 for (j=0; j<fcount && count<max_count; ++j) { 134 149 ids[count++] = MAKE_DEV_ID(i, j); … … 144 159 pjmedia_aud_dev_info *info) 145 160 { 161 pjmedia_aud_dev_factory *f; 146 162 int f_id, index; 147 163 … … 152 168 index = GET_INDEX(id); 153 169 154 if (f_id < 0 || f_id >= PJ_ARRAY_SIZE(factories))155 return PJMEDIA_EAUD_INVDEV; 156 157 if (factories[f_id].f == NULL)158 return PJMEDIA_EAUD_INVDEV; 159 160 return factories[f_id].f->op->get_dev_info(factories[f_id].f, 161 170 if (f_id < 0 || f_id >= (int)aud_subsys.factory_cnt) 171 return PJMEDIA_EAUD_INVDEV; 172 173 f = aud_subsys.factories[f_id].f; 174 if (f == NULL) 175 return PJMEDIA_EAUD_INVDEV; 176 177 return f->op->get_dev_info(f, index, info); 162 178 } 163 179 … … 168 184 pjmedia_aud_dev_param *param) 169 185 { 186 pjmedia_aud_dev_factory *f; 170 187 int f_id, index; 171 188 pj_status_t status; … … 177 194 index = GET_INDEX(id); 178 195 179 if (f_id < 0 || f_id >= PJ_ARRAY_SIZE(factories))180 return PJMEDIA_EAUD_INVDEV; 181 182 if (factories[f_id].f == NULL)183 return PJMEDIA_EAUD_INVDEV; 184 185 status = factories[f_id].f->op->default_param(factories[f_id].f, 186 196 if (f_id < 0 || f_id >= (int)aud_subsys.factory_cnt) 197 return PJMEDIA_EAUD_INVDEV; 198 199 f = aud_subsys.factories[f_id].f; 200 if (f == NULL) 201 return PJMEDIA_EAUD_INVDEV; 202 203 status = f->op->default_param(f, index, param); 187 204 if (status != PJ_SUCCESS) 188 205 return status; … … 204 221 pjmedia_aud_stream **p_aud_strm) 205 222 { 223 pjmedia_aud_dev_factory *f; 206 224 pjmedia_aud_dev_param param; 207 225 int f_id; … … 222 240 f_id = GET_FID(param.play_id); 223 241 224 if (f_id < 0 || f_id >= PJ_ARRAY_SIZE(factories))242 if (f_id < 0 || f_id >= (int)aud_subsys.factory_cnt) 225 243 return PJMEDIA_EAUD_INVDEV; 226 244 … … 229 247 param.play_id = GET_INDEX(param.play_id); 230 248 231 if (factories[f_id].f == NULL)232 return PJMEDIA_EAUD_INVDEV; 233 234 status = factories[f_id].f->op->create_stream(factories[f_id].f, 235 236 249 f = aud_subsys.factories[f_id].f; 250 if (f == NULL) 251 return PJMEDIA_EAUD_INVDEV; 252 253 status = f->op->create_stream(f, ¶m, rec_cb, play_cb, 254 user_data, p_aud_strm); 237 255 if (status != PJ_SUCCESS) 238 256 return status; 239 257 240 (*p_aud_strm)->factory = f actories[f_id].f;258 (*p_aud_strm)->factory = f; 241 259 return PJ_SUCCESS; 242 260 } -
pjproject/branches/projects/aps-direct/pjproject.dsw
r2458 r2463 474 474 Project_Dep_Name libsrtp 475 475 End Project Dependency 476 Begin Project Dependency 477 Project_Dep_Name pjmedia_audiodev 478 End Project Dependency 476 479 }}} 477 480 -
pjproject/branches/projects/aps-direct/pjsip-apps/build/sample_debug.dsp
r1765 r2463 91 91 92 92 SOURCE=..\src\samples\debug.c 93 94 !IF "$(CFG)" == "sample_debug - Win32 Release"95 96 !ELSEIF "$(CFG)" == "sample_debug - Win32 Debug"97 98 !ENDIF99 100 93 # End Source File 101 94 # End Group -
pjproject/branches/projects/aps-direct/pjsip-apps/build/samples.dsp
r2178 r2463 91 91 # Begin Source File 92 92 93 SOURCE=..\src\samples\auddemo.c 94 # End Source File 95 # Begin Source File 96 93 97 SOURCE=..\src\samples\confbench.c 94 98 # End Source File -
pjproject/branches/projects/aps-direct/pjsip-apps/src/samples/debug.c
r2394 r2463 29 29 * #include "playfile.c" 30 30 */ 31 #include "a ectest.c"31 #include "auddemo.c" 32 32
Note: See TracChangeset
for help on using the changeset viewer.