diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/buffering.c | 56 | ||||
-rw-r--r-- | apps/buffering.h | 7 | ||||
-rw-r--r-- | apps/playback.c | 3 |
3 files changed, 1 insertions, 65 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index db555d8805..8661a42ab8 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -1436,62 +1436,6 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data) | |||
1436 | return size; | 1436 | return size; |
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | ssize_t bufgettail(int handle_id, size_t size, void **data) | ||
1440 | { | ||
1441 | if (thread_self() != buffering_thread_id) | ||
1442 | return ERR_WRONG_THREAD; /* only from buffering thread */ | ||
1443 | |||
1444 | /* We don't support tail requests of > guardbuf_size, for simplicity */ | ||
1445 | if (size > GUARD_BUFSIZE) | ||
1446 | return ERR_INVALID_VALUE; | ||
1447 | |||
1448 | const struct memory_handle *h = find_handle(handle_id); | ||
1449 | if (!h) | ||
1450 | return ERR_HANDLE_NOT_FOUND; | ||
1451 | |||
1452 | if (h->end >= h->filesize) { | ||
1453 | size_t tidx = ringbuf_sub_empty(h->widx, size); | ||
1454 | |||
1455 | if (tidx + size > buffer_len) { | ||
1456 | size_t copy_n = tidx + size - buffer_len; | ||
1457 | memcpy(guard_buffer, ringbuf_ptr(0), copy_n); | ||
1458 | } | ||
1459 | |||
1460 | *data = ringbuf_ptr(tidx); | ||
1461 | } | ||
1462 | else { | ||
1463 | size = ERR_HANDLE_NOT_DONE; | ||
1464 | } | ||
1465 | |||
1466 | return size; | ||
1467 | } | ||
1468 | |||
1469 | ssize_t bufcuttail(int handle_id, size_t size) | ||
1470 | { | ||
1471 | if (thread_self() != buffering_thread_id) | ||
1472 | return ERR_WRONG_THREAD; /* only from buffering thread */ | ||
1473 | |||
1474 | struct memory_handle *h = find_handle(handle_id); | ||
1475 | if (!h) | ||
1476 | return ERR_HANDLE_NOT_FOUND; | ||
1477 | |||
1478 | if (h->end >= h->filesize) { | ||
1479 | /* Cannot trim to before read position */ | ||
1480 | size_t available = h->end - MAX(h->start, h->pos); | ||
1481 | if (available < size) | ||
1482 | size = available; | ||
1483 | |||
1484 | h->widx = ringbuf_sub_empty(h->widx, size); | ||
1485 | h->filesize -= size; | ||
1486 | h->end -= size; | ||
1487 | } else { | ||
1488 | size = ERR_HANDLE_NOT_DONE; | ||
1489 | } | ||
1490 | |||
1491 | return size; | ||
1492 | } | ||
1493 | |||
1494 | |||
1495 | /* | 1439 | /* |
1496 | SECONDARY EXPORTED FUNCTIONS | 1440 | SECONDARY EXPORTED FUNCTIONS |
1497 | ============================ | 1441 | ============================ |
diff --git a/apps/buffering.h b/apps/buffering.h index 1a75d865ae..bc47d6b1a1 100644 --- a/apps/buffering.h +++ b/apps/buffering.h | |||
@@ -46,8 +46,7 @@ enum data_type { | |||
46 | #define ERR_FILE_ERROR -4 | 46 | #define ERR_FILE_ERROR -4 |
47 | #define ERR_HANDLE_NOT_DONE -5 | 47 | #define ERR_HANDLE_NOT_DONE -5 |
48 | #define ERR_UNSUPPORTED_TYPE -6 | 48 | #define ERR_UNSUPPORTED_TYPE -6 |
49 | #define ERR_WRONG_THREAD -7 | 49 | #define ERR_BITMAP_TOO_LARGE -7 |
50 | #define ERR_BITMAP_TOO_LARGE -8 | ||
51 | 50 | ||
52 | /* Initialise the buffering subsystem */ | 51 | /* Initialise the buffering subsystem */ |
53 | void buffering_init(void) INIT_ATTR; | 52 | void buffering_init(void) INIT_ATTR; |
@@ -68,8 +67,6 @@ bool buffering_reset(char *buf, size_t buflen); | |||
68 | * bufftell : Return the handle's file read position | 67 | * bufftell : Return the handle's file read position |
69 | * bufread : Copy data from a handle to a buffer | 68 | * bufread : Copy data from a handle to a buffer |
70 | * bufgetdata: Obtain a pointer for linear access to a "size" amount of data | 69 | * bufgetdata: Obtain a pointer for linear access to a "size" amount of data |
71 | * bufgettail: Out-of-band get the last size bytes of a handle. | ||
72 | * bufcuttail: Out-of-band remove the trailing 'size' bytes of a handle. | ||
73 | * | 70 | * |
74 | * NOTE: bufread and bufgetdata will block the caller until the requested | 71 | * NOTE: bufread and bufgetdata will block the caller until the requested |
75 | * amount of data is ready (unless EOF is reached). | 72 | * amount of data is ready (unless EOF is reached). |
@@ -85,8 +82,6 @@ int bufadvance(int handle_id, off_t offset); | |||
85 | off_t bufftell(int handle_id); | 82 | off_t bufftell(int handle_id); |
86 | ssize_t bufread(int handle_id, size_t size, void *dest); | 83 | ssize_t bufread(int handle_id, size_t size, void *dest); |
87 | ssize_t bufgetdata(int handle_id, size_t size, void **data); | 84 | ssize_t bufgetdata(int handle_id, size_t size, void **data); |
88 | ssize_t bufgettail(int handle_id, size_t size, void **data); | ||
89 | ssize_t bufcuttail(int handle_id, size_t size); | ||
90 | 85 | ||
91 | /*************************************************************************** | 86 | /*************************************************************************** |
92 | * SECONDARY FUNCTIONS | 87 | * SECONDARY FUNCTIONS |
diff --git a/apps/playback.c b/apps/playback.c index a56c6d17ec..7fdb302d71 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -3467,9 +3467,6 @@ static void buffer_event_finished_callback(unsigned short id, void *ev_data) | |||
3467 | break; | 3467 | break; |
3468 | 3468 | ||
3469 | case TYPE_PACKET_AUDIO: | 3469 | case TYPE_PACKET_AUDIO: |
3470 | /* Strip any useless trailing tags that are left. */ | ||
3471 | strip_tags(hid); | ||
3472 | /* Fall-through */ | ||
3473 | case TYPE_ATOMIC_AUDIO: | 3470 | case TYPE_ATOMIC_AUDIO: |
3474 | LOGFQUEUE("buffering > audio Q_AUDIO_HANDLE_FINISHED: %d", hid); | 3471 | LOGFQUEUE("buffering > audio Q_AUDIO_HANDLE_FINISHED: %d", hid); |
3475 | audio_queue_post(Q_AUDIO_HANDLE_FINISHED, hid); | 3472 | audio_queue_post(Q_AUDIO_HANDLE_FINISHED, hid); |