New API call burn_fifo_fill()
This commit is contained in:
parent
496d794bcd
commit
e335aa26b4
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2009.11.25.122233"
|
#define Cdrskin_timestamP "2009.11.25.160153"
|
||||||
|
@ -562,13 +562,21 @@ int burn_fifo_inquire_status(struct burn_source *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int burn_fifo_peek_data(struct burn_source *source, char *buf, int bufsize,
|
/* @param flag bit0= do not copy to buf but only wait until the fifo has read
|
||||||
|
bufsize or input ended.
|
||||||
|
The same happens if buf is NULL.
|
||||||
|
bit1= fill to max fifo size
|
||||||
|
*/
|
||||||
|
int burn_fifo_fill_data(struct burn_source *source, char *buf, int bufsize,
|
||||||
int flag)
|
int flag)
|
||||||
{
|
{
|
||||||
int size, free_bytes, ret, wait_count= 0;
|
int size, free_bytes, ret, wait_count= 0;
|
||||||
char *status_text;
|
char *status_text;
|
||||||
struct burn_source_fifo *fs = source->data;
|
struct burn_source_fifo *fs = source->data;
|
||||||
|
|
||||||
|
if (buf == NULL)
|
||||||
|
flag |= 1;
|
||||||
|
|
||||||
/* Eventually start fifo thread by reading 0 bytes */
|
/* Eventually start fifo thread by reading 0 bytes */
|
||||||
ret = fifo_read(source, (unsigned char *) NULL, 0);
|
ret = fifo_read(source, (unsigned char *) NULL, 0);
|
||||||
if (ret<0)
|
if (ret<0)
|
||||||
@ -578,11 +586,26 @@ int burn_fifo_peek_data(struct burn_source *source, char *buf, int bufsize,
|
|||||||
while (1) {
|
while (1) {
|
||||||
ret= burn_fifo_inquire_status(source,
|
ret= burn_fifo_inquire_status(source,
|
||||||
&size, &free_bytes, &status_text);
|
&size, &free_bytes, &status_text);
|
||||||
if (size < bufsize) {
|
if (flag & 2) {
|
||||||
libdax_msgs_submit(libdax_messenger, -1, 0x0002015c,
|
bufsize = size - (size % fs->inp_read_size) -
|
||||||
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
|
fs->inp_read_size;
|
||||||
"Fifo size is smaller than desired peek buffer", 0, 0);
|
if (bufsize <= 0)
|
||||||
return -1;
|
return 0;
|
||||||
|
}
|
||||||
|
if (size - fs->inp_read_size < bufsize) {
|
||||||
|
if (flag & 1) {
|
||||||
|
bufsize = size - (size % fs->inp_read_size) -
|
||||||
|
fs->inp_read_size;
|
||||||
|
if (bufsize <= 0)
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
libdax_msgs_submit(libdax_messenger, -1,
|
||||||
|
0x0002015c, LIBDAX_MSGS_SEV_FAILURE,
|
||||||
|
LIBDAX_MSGS_PRIO_HIGH,
|
||||||
|
"Fifo size too small for desired peek buffer",
|
||||||
|
0, 0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fs->out_counter > 0 || (ret & 4) || fs->buf == NULL) {
|
if (fs->out_counter > 0 || (ret & 4) || fs->buf == NULL) {
|
||||||
libdax_msgs_submit(libdax_messenger, -1, 0x0002015e,
|
libdax_msgs_submit(libdax_messenger, -1, 0x0002015e,
|
||||||
@ -598,17 +621,33 @@ int burn_fifo_peek_data(struct burn_source *source, char *buf, int bufsize,
|
|||||||
"libburn_DEBUG: after waiting cycle %d : fifo %s , %d bytes\n",
|
"libburn_DEBUG: after waiting cycle %d : fifo %s , %d bytes\n",
|
||||||
wait_count, status_text, size - free_bytes);
|
wait_count, status_text, size - free_bytes);
|
||||||
*/
|
*/
|
||||||
|
if(!(flag & 1))
|
||||||
memcpy(buf, fs->buf, bufsize);
|
memcpy(buf, fs->buf, bufsize);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (ret&2) { /* input has ended, not enough data arrived */
|
|
||||||
|
if (ret & 2) {
|
||||||
|
/* input has ended, not enough data arrived */
|
||||||
|
if (flag & 1)
|
||||||
|
return 0;
|
||||||
libdax_msgs_submit(libdax_messenger, -1, 0x0002015d,
|
libdax_msgs_submit(libdax_messenger, -1, 0x0002015d,
|
||||||
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
|
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
"Fifo input ended short of desired peek buffer size",
|
"Fifo input ended short of desired peek buffer size",
|
||||||
0, 0);
|
0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (free_bytes < fs->inp_read_size) {
|
||||||
|
/* Usable fifo size filled, not enough data arrived */
|
||||||
|
if (flag & 1)
|
||||||
|
return 0;
|
||||||
|
libdax_msgs_submit(libdax_messenger, -1, 0x00020174,
|
||||||
|
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
|
"Fifo alignment does not allow desired read size",
|
||||||
|
0, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
wait_count++;
|
wait_count++;
|
||||||
|
|
||||||
@ -622,3 +661,20 @@ int burn_fifo_peek_data(struct burn_source *source, char *buf, int bufsize,
|
|||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ts A80713 : API */
|
||||||
|
int burn_fifo_peek_data(struct burn_source *source, char *buf, int bufsize,
|
||||||
|
int flag)
|
||||||
|
{
|
||||||
|
return burn_fifo_fill_data(source, buf, bufsize, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ts A91125 : API */
|
||||||
|
int burn_fifo_fill(struct burn_source *source, int bufsize, int flag)
|
||||||
|
{
|
||||||
|
return burn_fifo_fill_data(source, NULL, bufsize,
|
||||||
|
1 | ((flag & 1) << 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1802,6 +1802,8 @@ struct burn_source *burn_file_source_new(const char *path,
|
|||||||
on the operating system and on compile time options of libburn.
|
on the operating system and on compile time options of libburn.
|
||||||
You may use this call instead of open(2) for opening file descriptors
|
You may use this call instead of open(2) for opening file descriptors
|
||||||
which shall be handed to burn_fd_source_new().
|
which shall be handed to burn_fd_source_new().
|
||||||
|
This should only be done for tracks with BURN_BLOCK_MODE1 (2048 bytes
|
||||||
|
per block).
|
||||||
|
|
||||||
If you use this call then you MUST allocate the buffers which you use
|
If you use this call then you MUST allocate the buffers which you use
|
||||||
with read(2) by call burn_os_alloc_buffer(). Read sizes MUST be a multiple
|
with read(2) by call burn_os_alloc_buffer(). Read sizes MUST be a multiple
|
||||||
@ -1926,12 +1928,11 @@ struct burn_source *burn_fifo_source_new(struct burn_source *inp,
|
|||||||
int burn_fifo_inquire_status(struct burn_source *fifo, int *size,
|
int burn_fifo_inquire_status(struct burn_source *fifo, int *size,
|
||||||
int *free_bytes, char **status_text);
|
int *free_bytes, char **status_text);
|
||||||
|
|
||||||
|
|
||||||
/* ts A80713 */
|
/* ts A80713 */
|
||||||
/** Obtain a preview of the first input data of a fifo which was created
|
/** Obtain a preview of the first input data of a fifo which was created
|
||||||
by burn_fifo_source_new(). The data will later be delivered normally to
|
by burn_fifo_source_new(). The data will later be delivered normally to
|
||||||
the consumer track of the fifo.
|
the consumer track of the fifo.
|
||||||
bufsize may not be larger than the fifo size (chunk_size * chunks).
|
bufsize may not be larger than the fifo size (chunk_size * chunks) - 32k.
|
||||||
This call will succeed only if data consumption by the track has not
|
This call will succeed only if data consumption by the track has not
|
||||||
started yet, i.e. best before the call to burn_disc_write().
|
started yet, i.e. best before the call to burn_disc_write().
|
||||||
It will start the worker thread of the fifo with the expectable side
|
It will start the worker thread of the fifo with the expectable side
|
||||||
@ -1950,6 +1951,22 @@ int burn_fifo_inquire_status(struct burn_source *fifo, int *size,
|
|||||||
int burn_fifo_peek_data(struct burn_source *source, char *buf, int bufsize,
|
int burn_fifo_peek_data(struct burn_source *source, char *buf, int bufsize,
|
||||||
int flag);
|
int flag);
|
||||||
|
|
||||||
|
/* ts A91125 */
|
||||||
|
/** Start the fifo worker thread and wait either until the requested number
|
||||||
|
of bytes have arrived or until it becomes clear that this will not happen.
|
||||||
|
Filling will go on asynchronously after burn_fifo_fill() returned.
|
||||||
|
This call and burn_fifo_peek_data() do not disturb each other.
|
||||||
|
@param fifo The fifo object to start
|
||||||
|
@param fill Number of bytes desired. Expect to get return 1 if
|
||||||
|
at least fifo size - 32k were read.
|
||||||
|
@param flag Bitfield for control purposes.
|
||||||
|
bit0= fill fifo to maximum size
|
||||||
|
@return <0 on severe error, 0 if not enough data,
|
||||||
|
1 if desired amount or fifo full
|
||||||
|
@since 0.7.4
|
||||||
|
*/
|
||||||
|
int burn_fifo_fill(struct burn_source *source, int bufsize, int flag);
|
||||||
|
|
||||||
|
|
||||||
/* ts A70328 */
|
/* ts A70328 */
|
||||||
/** Sets a fixed track size after the data source object has already been
|
/** Sets a fixed track size after the data source object has already been
|
||||||
|
@ -528,7 +528,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
|
|||||||
0x00020159 (DEBUG,HIGH) = TOC Format 0 returns inconsistent data
|
0x00020159 (DEBUG,HIGH) = TOC Format 0 returns inconsistent data
|
||||||
0x0002015a (NOTE,HIGH) = Could not examine busy device
|
0x0002015a (NOTE,HIGH) = Could not examine busy device
|
||||||
0x0002015b (HINT,HIGH) = Busy '...' seems to be a hard disk, as '...1' exists
|
0x0002015b (HINT,HIGH) = Busy '...' seems to be a hard disk, as '...1' exists
|
||||||
0x0002015c (FAILURE,HIGH) = Fifo size is smaller than desired peek buffer
|
0x0002015c (FAILURE,HIGH) = Fifo size too small for desired peek buffer
|
||||||
0x0002015d (FAILURE,HIGH) = Fifo input ended short of desired peek buffer size
|
0x0002015d (FAILURE,HIGH) = Fifo input ended short of desired peek buffer size
|
||||||
0x0002015e (FATAL,HIGH) = Fifo is already under consumption when peeking
|
0x0002015e (FATAL,HIGH) = Fifo is already under consumption when peeking
|
||||||
0x0002015f (MISHAP,HIGH) = Damaged CD table-of-content detected and truncated
|
0x0002015f (MISHAP,HIGH) = Damaged CD table-of-content detected and truncated
|
||||||
@ -551,6 +551,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
|
|||||||
0x00020171 (NOTE,HIGH) = Closing BD-R with accidently open session
|
0x00020171 (NOTE,HIGH) = Closing BD-R with accidently open session
|
||||||
0x00020172 (SORRY,HIGH) = Read start address larger than number of readable blocks
|
0x00020172 (SORRY,HIGH) = Read start address larger than number of readable blocks
|
||||||
0x00020173 (FAILURE,HIGH) = Drive tells NWA smaller than last written address
|
0x00020173 (FAILURE,HIGH) = Drive tells NWA smaller than last written address
|
||||||
|
0x00020174 (SORRY,HIGH) = Fifo alignment does not allow desired read size
|
||||||
|
|
||||||
|
|
||||||
libdax_audioxtr:
|
libdax_audioxtr:
|
||||||
|
Loading…
Reference in New Issue
Block a user