Update burn_source to version 1, that adds cancel() function.

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent ae679b0f61
commit ebcd5883e2

@ -170,7 +170,7 @@ int main(int argc, char **argv)
return 1;
}
while (burn_src->read(burn_src, buf, 2048) == 2048) {
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
fwrite(buf, 1, 2048, fd);
}
fclose(fd);

@ -119,7 +119,7 @@ int main(int argc, char **argv)
return 1;
}
while (burn_src->read(burn_src, buf, 2048) == 2048) {
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
fwrite(buf, 1, 2048, fd);
}
fclose(fd);

@ -122,7 +122,7 @@ int main(int argc, char **argv)
return 1;
}
while (burn_src->read(burn_src, buf, 2048) == 2048) {
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
fwrite(buf, 1, 2048, fd);
}
fclose(fd);

@ -253,6 +253,13 @@ void iso_ring_buffer_writer_close(IsoRingBuffer *buf, int error)
void iso_ring_buffer_reader_close(IsoRingBuffer *buf, int error)
{
pthread_mutex_lock(&buf->mutex);
if (buf->rend) {
/* reader already closed */
pthread_mutex_unlock(&buf->mutex);
return;
}
buf->rend = error ? 2 : 1;
/* ensure no writer is waiting */

@ -1103,6 +1103,22 @@ static void bs_free_data(struct burn_source *bs)
ecma119_image_free(target);
}
int bs_cancel(struct burn_source *bs)
{
Ecma119Image *target = (Ecma119Image*)bs->data;
iso_msg_debug(target->image->id, "Reader thread being cancelled");
/* forces writer to stop if it is still running */
iso_ring_buffer_reader_close(target->buffer, ISO_CANCELED);
/* wait until writer thread finishes */
pthread_join(target->wthread, NULL);
iso_msg_debug(target->image->id, "Writer thread joined");
return ISO_SUCCESS;
}
static
int bs_set_size(struct burn_source *bs, off_t size)
{
@ -1140,10 +1156,13 @@ int iso_image_create_burn_source(IsoImage *image, Ecma119WriteOpts *opts,
}
source->refcount = 1;
source->read = bs_read;
source->version = 1;
source->read = NULL;
source->get_size = bs_get_size;
source->set_size = bs_set_size;
source->free_data = bs_free_data;
source->read_xt = bs_read;
source->cancel = bs_cancel;
source->data = target;
*burn_src = source;

Loading…
Cancel
Save