Patches by Joshua

Original commit message from CVS:
Patches by Joshua
This commit is contained in:
Ronald S. Bultje 2002-05-10 21:14:47 +00:00
parent c7a20d6e69
commit b41ec019f0
3 changed files with 17 additions and 4 deletions

2
common

@ -1 +1 @@
Subproject commit 69cfea918b2840b5076e60becdb39b96a8ca5ef5 Subproject commit 3ce22b87b251e36d30660b72b8020011246b0c64

View file

@ -56,6 +56,7 @@ enum {
ARG_TRACK, ARG_TRACK,
ARG_BYTESPERREAD, ARG_BYTESPERREAD,
ARG_OFFSET, ARG_OFFSET,
ARG_MAX_ERRORS,
}; };
static void vcdsrc_class_init (VCDSrcClass *klass); static void vcdsrc_class_init (VCDSrcClass *klass);
@ -117,6 +118,8 @@ vcdsrc_class_init (VCDSrcClass *klass)
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_OFFSET, g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_OFFSET,
g_param_spec_int("offset","offset","offset", g_param_spec_int("offset","offset","offset",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */ G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_MAX_ERRORS,
g_param_spec_int("max-errors","","", 0,G_MAXINT,16,G_PARAM_READWRITE));
gobject_class->set_property = vcdsrc_set_property; gobject_class->set_property = vcdsrc_set_property;
gobject_class->get_property = vcdsrc_get_property; gobject_class->get_property = vcdsrc_get_property;
@ -139,6 +142,7 @@ vcdsrc_init (VCDSrc *vcdsrc)
vcdsrc->curoffset = 0; vcdsrc->curoffset = 0;
vcdsrc->bytes_per_read = VCD_BYTES_PER_SECTOR; vcdsrc->bytes_per_read = VCD_BYTES_PER_SECTOR;
vcdsrc->seq = 0; vcdsrc->seq = 0;
vcdsrc->max_errors = 16;
} }
@ -174,6 +178,9 @@ vcdsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParam
case ARG_OFFSET: case ARG_OFFSET:
src->curoffset = g_value_get_int (value) / VCD_BYTES_PER_SECTOR; src->curoffset = g_value_get_int (value) / VCD_BYTES_PER_SECTOR;
break; break;
case ARG_MAX_ERRORS:
src->max_errors = g_value_get_int (value);
break;
default: default:
break; break;
} }
@ -202,6 +209,9 @@ vcdsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *
case ARG_OFFSET: case ARG_OFFSET:
g_value_set_int (value, src->curoffset * VCD_BYTES_PER_SECTOR); g_value_set_int (value, src->curoffset * VCD_BYTES_PER_SECTOR);
break; break;
case ARG_MAX_ERRORS:
g_value_set_int (value, src->max_errors);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -249,16 +259,18 @@ vcdsrc_get (GstPad *pad)
/* msf->cdmsf_frame0); */ /* msf->cdmsf_frame0); */
if (ioctl(vcdsrc->fd,CDROMREADRAW,msf)) { if (ioctl(vcdsrc->fd,CDROMREADRAW,msf)) {
if (++error_count > 16) if (++error_count > vcdsrc->max_errors)
{ {
fprintf (stderr, "End of CD\n"); gst_element_set_eos (GST_ELEMENT (vcdsrc));
exit(1); return GST_BUFFER (gst_event_new (GST_EVENT_EOS));
} }
fprintf (stderr, "%s while reading raw data from cdrom at %d:%d:%d\n", fprintf (stderr, "%s while reading raw data from cdrom at %d:%d:%d\n",
strerror (errno), strerror (errno),
msf->cdmsf_min0, msf->cdmsf_sec0, msf->cdmsf_frame0); msf->cdmsf_min0, msf->cdmsf_sec0, msf->cdmsf_frame0);
vcdsrc->curoffset += 1; vcdsrc->curoffset += 1;
/* Or we can return a zero-filled buffer. Which is better? */
goto read_sector; goto read_sector;
} }

View file

@ -80,6 +80,7 @@ struct _VCDSrc {
gulong bytes_per_read; /* bytes per read */ gulong bytes_per_read; /* bytes per read */
gulong seq; /* buffer sequence number */ gulong seq; /* buffer sequence number */
int max_errors;
}; };
struct _VCDSrcClass { struct _VCDSrcClass {