Changeset 4793 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
- Timestamp:
- Mar 14, 2014 4:09:50 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
r4704 r4793 1193 1193 PJ_DEF(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id) 1194 1194 { 1195 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), 1195 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player),PJ_EINVAL); 1196 1196 PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); 1197 1197 … … 1205 1205 pjmedia_port **p_port) 1206 1206 { 1207 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), 1207 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player),PJ_EINVAL); 1208 1208 PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); 1209 1209 PJ_ASSERT_RETURN(p_port != NULL, PJ_EINVAL); … … 1215 1215 1216 1216 /* 1217 * Get player info. 1218 */ 1219 PJ_DEF(pj_status_t) pjsua_player_get_info(pjsua_player_id id, 1220 pjmedia_wav_player_info *info) 1221 { 1222 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), 1223 -PJ_EINVAL); 1224 PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); 1225 PJ_ASSERT_RETURN(pjsua_var.player[id].type == 0, PJ_EINVAL); 1226 1227 return pjmedia_wav_player_get_info(pjsua_var.player[id].port, info); 1228 } 1229 1230 /* 1231 * Get playback position. 1232 */ 1233 PJ_DEF(pj_ssize_t) pjsua_player_get_pos( pjsua_player_id id ) 1234 { 1235 pj_ssize_t pos_bytes; 1236 pjmedia_wav_player_info info; 1237 pj_status_t status; 1238 1239 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), 1240 -PJ_EINVAL); 1241 PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, -PJ_EINVAL); 1242 PJ_ASSERT_RETURN(pjsua_var.player[id].type == 0, -PJ_EINVAL); 1243 1244 pos_bytes = pjmedia_wav_player_port_get_pos(pjsua_var.player[id].port); 1245 if (pos_bytes < 0) 1246 return pos_bytes; 1247 1248 status = pjmedia_wav_player_get_info(pjsua_var.player[id].port, &info); 1249 if (status != PJ_SUCCESS) 1250 return -status; 1251 1252 return pos_bytes / (info.payload_bits_per_sample / 8); 1253 } 1254 1255 /* 1217 1256 * Set playback position. 1218 1257 */ … … 1220 1259 pj_uint32_t samples) 1221 1260 { 1222 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), PJ_EINVAL); 1261 pjmedia_wav_player_info info; 1262 pj_uint32_t pos_bytes; 1263 pj_status_t status; 1264 1265 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player),PJ_EINVAL); 1223 1266 PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); 1224 1267 PJ_ASSERT_RETURN(pjsua_var.player[id].type == 0, PJ_EINVAL); 1225 1268 1226 return pjmedia_wav_player_port_set_pos(pjsua_var.player[id].port, samples); 1269 status = pjmedia_wav_player_get_info(pjsua_var.player[id].port, &info); 1270 if (status != PJ_SUCCESS) 1271 return status; 1272 1273 pos_bytes = samples * (info.payload_bits_per_sample / 8); 1274 return pjmedia_wav_player_port_set_pos(pjsua_var.player[id].port, 1275 pos_bytes); 1227 1276 } 1228 1277 … … 1234 1283 PJ_DEF(pj_status_t) pjsua_player_destroy(pjsua_player_id id) 1235 1284 { 1236 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player), 1285 PJ_ASSERT_RETURN(id>=0&&id<(int)PJ_ARRAY_SIZE(pjsua_var.player),PJ_EINVAL); 1237 1286 PJ_ASSERT_RETURN(pjsua_var.player[id].port != NULL, PJ_EINVAL); 1238 1287
Note: See TracChangeset
for help on using the changeset viewer.