Changeset 1690
- Timestamp:
- Jan 14, 2008 4:12:41 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/wav_player.c
r1685 r1690 53 53 #endif 54 54 55 struct file_ port55 struct file_reader_port 56 56 { 57 57 pjmedia_port base; … … 75 75 static pj_status_t file_on_destroy(pjmedia_port *this_port); 76 76 77 static struct file_ port *create_file_port(pj_pool_t *pool)77 static struct file_reader_port *create_file_port(pj_pool_t *pool) 78 78 { 79 79 const pj_str_t name = pj_str("file"); 80 struct file_ port *port;81 82 port = PJ_POOL_ZALLOC_T(pool, struct file_ port);80 struct file_reader_port *port; 81 82 port = PJ_POOL_ZALLOC_T(pool, struct file_reader_port); 83 83 if (!port) 84 84 return NULL; … … 100 100 * Fill buffer. 101 101 */ 102 static pj_status_t fill_buffer(struct file_ port *fport)102 static pj_status_t fill_buffer(struct file_reader_port *fport) 103 103 { 104 104 pj_ssize_t size_left = fport->bufsize; … … 193 193 pjmedia_wave_hdr wave_hdr; 194 194 pj_ssize_t size_to_read, size_read; 195 struct file_ port *fport;195 struct file_reader_port *fport; 196 196 pj_off_t pos; 197 197 pj_status_t status; … … 410 410 PJ_DEF(pj_ssize_t) pjmedia_wav_player_get_len(pjmedia_port *port) 411 411 { 412 struct file_ port *fport;412 struct file_reader_port *fport; 413 413 pj_ssize_t size; 414 414 … … 419 419 PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, -PJ_EINVALIDOP); 420 420 421 fport = (struct file_ port*) port;421 fport = (struct file_reader_port*) port; 422 422 423 423 size = (pj_ssize_t) fport->fsize; … … 432 432 pj_uint32_t bytes ) 433 433 { 434 struct file_ port *fport;434 struct file_reader_port *fport; 435 435 436 436 /* Sanity check */ … … 441 441 442 442 443 fport = (struct file_ port*) port;443 fport = (struct file_reader_port*) port; 444 444 445 445 PJ_ASSERT_RETURN(bytes < fport->fsize - fport->start_data, PJ_EINVAL); … … 458 458 PJ_DEF(pj_ssize_t) pjmedia_wav_player_port_get_pos( pjmedia_port *port ) 459 459 { 460 struct file_ port *fport;460 struct file_reader_port *fport; 461 461 pj_size_t payload_pos; 462 462 … … 467 467 PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, -PJ_EINVALIDOP); 468 468 469 fport = (struct file_ port*) port;469 fport = (struct file_reader_port*) port; 470 470 471 471 payload_pos = (pj_size_t)(fport->fpos - fport->start_data); … … 487 487 void *usr_data)) 488 488 { 489 struct file_ port *fport;489 struct file_reader_port *fport; 490 490 491 491 /* Sanity check */ … … 495 495 PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, -PJ_EINVALIDOP); 496 496 497 fport = (struct file_ port*) port;497 fport = (struct file_reader_port*) port; 498 498 499 499 fport->base.port_data.pdata = user_data; … … 510 510 pjmedia_frame *frame) 511 511 { 512 struct file_ port *fport = (struct file_port*)this_port;512 struct file_reader_port *fport = (struct file_reader_port*)this_port; 513 513 unsigned frame_size; 514 514 pj_status_t status; … … 539 539 frame->type = PJMEDIA_FRAME_TYPE_NONE; 540 540 frame->size = 0; 541 fport->readpos = fport->buf + fport->bufsize; 541 542 return status; 542 543 } … … 563 564 } 564 565 fport->readpos = fport->buf + fport->bufsize; 565 return PJ_SUCCESS;566 return (endread? PJ_SUCCESS : status); 566 567 } 567 568 … … 578 579 static pj_status_t file_on_destroy(pjmedia_port *this_port) 579 580 { 580 struct file_ port *fport = (struct file_port*) this_port;581 struct file_reader_port *fport = (struct file_reader_port*) this_port; 581 582 582 583 pj_assert(this_port->info.signature == SIGNATURE);
Note: See TracChangeset
for help on using the changeset viewer.