Gave up use of libburn fifo. Attached -fs and pacifier to libisofs fifo.

This commit is contained in:
Thomas Schmitt 2008-01-24 20:23:02 +00:00
parent 3b33349903
commit 40885c40c3
4 changed files with 86 additions and 9 deletions

View File

@ -454,15 +454,47 @@ int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes,
{
int ret;
struct isoburn *o;
#ifdef Libisoburn_no_fifO
size_t hsize= 0, hfree_bytes= 0;
#endif
ret= isoburn_find_emulator(&o, d, 0);
if(ret<0)
return(-1);
if(o==NULL)
return(0);
#ifdef Libisoburn_no_fifO
if(o->iso_source==NULL)
return(0);
ret= iso_ring_buffer_get_status(o->iso_source, &hsize, &hfree_bytes);
if(hsize > 1024*1024*1024)
*size= 1024*1024*1024;
else
*size= hsize;
if(hfree_bytes > 1024*1024*1024)
*free_bytes= 1024*1024*1024;
else
*free_bytes= hfree_bytes;
*status_text= "";
if(ret==1)
*status_text= "active";
else if(ret==2)
*status_text= "ending";
else if(ret==3)
*status_text= "failing";
else if(ret==5)
*status_text= "abandoned";
else if(ret==6)
*status_text= "ended";
else if(ret==7)
*status_text= "aborted";
#else
if(o->fifo==NULL)
return(0);
ret= burn_fifo_inquire_status(o->fifo, size, free_bytes, status_text);
#endif /* ! Libisoburn_no_fifO */
return(ret);
}

View File

@ -62,7 +62,13 @@ int isoburn_new(struct isoburn **objpt, int flag)
o->emulation_mode= 0;
o->min_start_byte= 0;
o->nwa= 0;
#ifdef Libisoburn_no_fifO
o->iso_source= NULL;
#else
o->fifo= NULL;
#endif
o->wrote_well= -1;
o->fabricated_disc_status= BURN_DISC_UNREADY;
for(i=0;i<65536;i++)
@ -102,8 +108,15 @@ int isoburn_destroy(struct isoburn **objpt, int flag)
if(o->image!=NULL)
iso_image_unref(o->image);
#ifdef Libisoburn_no_fifO
if(o->iso_source!=NULL)
burn_source_free(o->iso_source);
#else
if(o->fifo!=NULL)
burn_source_free(o->fifo);
#endif /* ! Libisoburn_no_fifO */
free((char *) o);
*objpt= NULL;
@ -247,7 +260,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
struct isoburn *o;
Ecma119WriteOpts wopts;
enum burn_disc_status state;
int ret, chunks;
int ret, fifo_chunks;
ret= isoburn_find_emulator(&o, d, 0);
if(ret<0 || o==NULL)
@ -261,6 +274,13 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
/* unsuitable status */
return -2;
}
fifo_chunks= 32;
if(opts->fifo_size >= 64*1024 && opts->fifo_size <= 1024.0 * 1024.0 * 1024.0){
fifo_chunks= opts->fifo_size/2048;
if(fifo_chunks*2048 < opts->fifo_size)
fifo_chunks++;
}
memset((char *) &wopts, 0, sizeof(wopts));
wopts.level = opts->level;
@ -285,6 +305,13 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
wopts.gid = opts->gid;
wopts.uid = opts->uid;
wopts.output_charset = opts->output_charset;
#ifdef Libisoburn_no_fifO
wopts.fifo_size= fifo_chunks;
/* <<<
fprintf(stderr, "libisoburn_DEBUG: fifo chunks: %d\n", fifo_chunks);
*/
#endif /* Libisoburn_no_fifO */
if (new_img) {
wopts.ms_block = 0;
@ -311,23 +338,28 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
/* TODO check return values for failure. propertly clean-up on error */
chunks= 32;
if(opts->fifo_size >= 64*1024 && opts->fifo_size <= 1024.0 * 1024.0 * 1024.0){
chunks= opts->fifo_size/2048;
if(chunks*2048 < opts->fifo_size)
chunks++;
}
o->fifo = burn_fifo_source_new(wsrc, 2048, chunks, 0);
#ifdef Libisoburn_no_fifO
o->iso_source= wsrc;
#else
o->fifo = burn_fifo_source_new(wsrc, 2048, fifo_chunks, 0);
burn_source_free(wsrc);
if (o->fifo == NULL) {
fprintf(stderr, "Cannot attach fifo\n");
return -1;
}
#endif /* ! Libisoburn_no_fifO */
*disc = burn_disc_create();
session = burn_session_create();
burn_disc_add_session(*disc, session, BURN_POS_END);
track = burn_track_create();
#ifdef Libisoburn_no_fifO
burn_track_set_source(track, o->iso_source);
#else
burn_track_set_source(track, o->fifo);
#endif /* ! Libisoburn_no_fifO */
burn_session_add_track(session, track, BURN_POS_END);
/* give up local references */

View File

@ -10,6 +10,9 @@
#define Isoburn_includeD
/* <<< transition macro */
#define Libisoburn_no_fifO 1
/* for uint8_t */
#include <stdint.h>
@ -46,9 +49,11 @@ struct isoburn {
*/
enum burn_disc_status fabricated_disc_status;
#ifndef Libisoburn_no_fifO
/* The fifo which is installed between track and libisofs burn_source
*/
struct burn_source *fifo;
#endif /* ! Libisoburn_no_fifO */
/* Indicator wether the most recent burn run worked :
-1 = undetermined, ask libburn , 0 = failure , 1 = success
@ -65,6 +70,14 @@ struct isoburn {
/* Libisofs image context */
IsoImage *image;
#ifdef Libisoburn_no_fifO
/* The burn source which transfers data from libisofs to libburn.
It has its own fifo.
*/
struct burn_source *iso_source;
#endif /* Libisoburn_no_fifO */
};

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.01.23.195855"
#define Xorriso_timestamP "2008.01.24.202206"