+2004-01-30 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * just about every source file:
+ gst_element_error -> GST_ELEMENT_ERROR
+
2004-01-29 Julien MOUTTE <julien@moutte.net>
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get): Fixing seeking
aasink->context = aa_autoinit (&aasink->ascii_surf);
if (aasink->context == NULL) {
- gst_element_error (GST_ELEMENT (aasink), LIBRARY, TOO_LAZY, NULL,
+ GST_ELEMENT_ERROR (GST_ELEMENT (aasink), LIBRARY, TOO_LAZY, NULL,
("error opening aalib context"));
return FALSE;
}
dvdec->bpp = 2;
}
} else {
- gst_element_error (element, CORE, NEGOTIATION, NULL, NULL);
+ GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, NULL, NULL);
return;
}
}
"channels", G_TYPE_INT, esdmon->channels
)) <= 0)
{
- gst_element_error (esdmon, CORE, NEGOTIATION, NULL, NULL);
+ GST_ELEMENT_ERROR (esdmon, CORE, NEGOTIATION, NULL, NULL);
return NULL;
}
}
esdsink = GST_ESDSINK (gst_pad_get_parent (pad));
+ if (!esdsink->negotiated) {
+ GST_ELEMENT_ERROR (esdsink, CORE, NEGOTIATION, NULL,
+ ("element wasn't negotiated before chain function"));
+ goto done;
+ }
+
if (GST_IS_EVENT(buf)){
GstEvent *event = GST_EVENT(buf);
if (sink->depth == 16) esdformat |= ESD_BITS16;
else if (sink->depth == 8) esdformat |= ESD_BITS8;
else {
- gst_element_error (sink, STREAM, FORMAT, NULL,
+ GST_ELEMENT_ERROR (sink, STREAM, FORMAT, NULL,
("invalid bit depth (%d)", sink->depth));
return FALSE;
}
if (sink->channels == 2) esdformat |= ESD_STEREO;
else if (sink->channels == 1) esdformat |= ESD_MONO;
else {
- gst_element_error (sink, STREAM, FORMAT, NULL,
+ GST_ELEMENT_ERROR (sink, STREAM, FORMAT, NULL,
("invalid number of channels (%d)", sink->channels));
return FALSE;
}
sink->fd = esd_play_stream(esdformat, sink->frequency, sink->host, connname);
}
if ( sink->fd < 0 ) {
- gst_element_error (sink, RESOURCE, OPEN_WRITE, NULL,
+ GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, NULL,
("can't open connection to esound server"));
return FALSE;
}
break;
}
- gst_element_error (flacdec, STREAM, DECODE, NULL, (error));
+ GST_ELEMENT_ERROR (flacdec, STREAM, DECODE, NULL, (error));
}
static FLAC__SeekableStreamDecoderSeekStatus
GST_DEBUG ("flacdec: initializing decoder");
res = FLAC__seekable_stream_decoder_init (flacdec->decoder);
if (res != FLAC__SEEKABLE_STREAM_DECODER_OK) {
- gst_element_error (flacdec, LIBRARY, INIT, NULL,
+ GST_ELEMENT_ERROR (flacdec, LIBRARY, INIT, NULL,
(FLAC__SeekableStreamDecoderStateString[res]));
return;
}
}
if (!flacenc->negotiated) {
- gst_element_error (flacenc, CORE, NEGOTIATION, NULL,
+ GST_ELEMENT_ERROR (flacenc, CORE, NEGOTIATION, NULL,
("format wasn't negotiated before chain function"));
return;
}
gst_flacenc_set_metadata (flacenc);
state = FLAC__seekable_stream_encoder_init (flacenc->encoder);
if (state != FLAC__STREAM_ENCODER_OK) {
- gst_element_error (flacenc, LIBRARY, INIT, NULL,
+ GST_ELEMENT_ERROR (flacenc, LIBRARY, INIT, NULL,
("could not initialize encoder (wrong parameters?)"));
return;
}
flacenc->data = NULL;
if (!res) {
- gst_element_error (flacenc, STREAM, ENCODE, NULL, NULL);
+ GST_ELEMENT_ERROR (flacenc, STREAM, ENCODE, NULL, NULL);
}
}
gst_buffer_unref (sub);
} else {
/* FIXME: does that work well with FLAC files containing ID3v2 tags ? */
- gst_element_error (tag, STREAM, WRONG_TYPE, NULL, NULL);
+ GST_ELEMENT_ERROR (tag, STREAM, WRONG_TYPE, NULL, NULL);
}
}
g_warning ("No tags found\n");
buffer = gst_buffer_new_and_alloc (12);
if (buffer == NULL) {
- gst_element_error (tag, CORE, TOO_LAZY, NULL,
+ GST_ELEMENT_ERROR (tag, CORE, TOO_LAZY, NULL,
("Error creating 12-byte buffer for padding block"));
}
bzero (GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
sizeof (header), NULL);
gst_tag_list_free (merged_tags);
if (buffer == NULL) {
- gst_element_error (tag, CORE, TAG, NULL, ("Error converting tag list to vorbiscomment buffer"));
+ GST_ELEMENT_ERROR (tag, CORE, TAG, NULL, ("Error converting tag list to vorbiscomment buffer"));
return;
}
size = GST_BUFFER_SIZE (buffer) - 4;
* while the vorbis specs allow more than that. Shouldn't
* be a real world problem though
*/
- gst_element_error (tag, CORE, TAG, NULL, ("Vorbis comment of size %d too long", size));
+ GST_ELEMENT_ERROR (tag, CORE, TAG, NULL, ("Vorbis comment of size %d too long", size));
return;
}
}
GError *error;
if (gdk_pixbuf_loader_close (filter->pixbuf_loader, &error)) {
- gst_element_error (filter, LIBRARY, SHUTDOWN, NULL, (error->message));
+ GST_ELEMENT_ERROR (filter, LIBRARY, SHUTDOWN, NULL, (error->message));
g_error_free (error);
return;
}
if (!GST_PAD_CAPS (mikmod->srcpad)) {
if (gst_mikmod_negotiate (mikmod) <= 0) {
- gst_element_error (mikmod, CORE, NEGOTIATION, NULL, NULL);
+ GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, NULL, NULL);
return;
}
}
if (gst_pad_try_set_caps (dv1394src->srcpad,
gst_caps_new_simple ("video/dv",
"format", G_TYPE_STRING, "PAL", NULL)) <= 0) {
- gst_element_error (dv1394src, CORE, NEGOTIATION, NULL, ("Could not set source caps for PAL"));
+ GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, NULL, ("Could not set source caps for PAL"));
return 0;
}
} else {
if (gst_pad_try_set_caps (dv1394src->srcpad,
gst_caps_new_simple ("video/dv",
"format", G_TYPE_STRING, "NTSC", NULL)) <= 0) {
- gst_element_error (dv1394src, CORE, NEGOTIATION, NULL, ("Could not set source caps for NTSC"));
+ GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, NULL, ("Could not set source caps for NTSC"));
return 0;
}
}
"channels", G_TYPE_INT, 1,
NULL)))
{
- gst_element_error (speexenc, CORE, NEGOTIATION, NULL, NULL);
+ GST_ELEMENT_ERROR (speexenc, CORE, NEGOTIATION, NULL, NULL);
return;
}
}
if (!gst_riff_read_header (riff, &doctype))
return FALSE;
if (doctype != GST_RIFF_RIFF_AVI) {
- gst_element_error (avi, STREAM, WRONG_TYPE, NULL, NULL);
+ GST_ELEMENT_ERROR (avi, STREAM, WRONG_TYPE, NULL, NULL);
return FALSE;
}
if (!(tag = gst_riff_peek_tag (riff, NULL)))
return FALSE;
if (tag != GST_RIFF_TAG_strf) {
- gst_element_error (avi, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (avi, STREAM, DEMUX, NULL,
("Invalid AVI header (no strf as second tag)"));
goto skip_stream;
}
if (!(tag = gst_riff_peek_tag (riff, NULL)))
return FALSE;
if (tag != GST_RIFF_TAG_LIST) {
- gst_element_error (avi, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (avi, STREAM, DEMUX, NULL,
("Invalid AVI header (no LIST at start): "
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
return FALSE;
if (!gst_riff_read_list (riff, &tag))
return FALSE;
if (tag != GST_RIFF_LIST_hdrl) {
- gst_element_error (avi, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (avi, STREAM, DEMUX, NULL,
("Invalid AVI header (no hdrl at start): "
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
return FALSE;
if (!(tag = gst_riff_peek_tag (riff, NULL)))
return FALSE;
if (tag != GST_RIFF_TAG_avih) {
- gst_element_error (avi, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (avi, STREAM, DEMUX, NULL,
("Invalid AVI header (no avih at start): "
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
return FALSE;
if (avimux->audio_time) {
avimux->auds_hdr.rate = (GST_SECOND * avimux->audio_size) / avimux->audio_time;
} else {
- gst_element_error (avimux, STREAM, MUX,
+ GST_ELEMENT_ERROR (avimux, STREAM, MUX,
(_("No or invalid input audio, AVI stream will be corrupt")), NULL);
avimux->auds_hdr.rate = 0;
}
if (flxh->type != FLX_MAGICHDR_FLI &&
flxh->type != FLX_MAGICHDR_FLC &&
flxh->type != FLX_MAGICHDR_FLX) {
- gst_element_error (element, STREAM, WRONG_TYPE, NULL, ("not a flx file (type %d)\n", flxh->type));
+ GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, NULL, ("not a flx file (type %d)\n", flxh->type));
return;
}
}
if (goom->channels == 0) {
- gst_element_error (goom, CORE, NEGOTIATION, NULL,
+ GST_ELEMENT_ERROR (goom, CORE, NEGOTIATION, NULL,
("format wasn't negotiated before chain function"));
goto done;
} else {
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_event_unref (event);
- gst_element_error (ebml, RESOURCE, READ, NULL,
+ GST_ELEMENT_ERROR (ebml, RESOURCE, READ, NULL,
("Read error at position %llu (0x%llx)",
pos, pos));
}
}
if (read > 4) {
guint64 pos = gst_bytestream_tell (ebml->bs);
- gst_element_error (ebml, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, NULL,
("Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)",
data[0], pos, pos));
return -1;
if (gst_bytestream_peek_bytes (ebml->bs, &data, read) != read) {
guint64 pos = gst_bytestream_tell (ebml->bs);
- gst_element_error (ebml, RESOURCE, READ, NULL,
+ GST_ELEMENT_ERROR (ebml, RESOURCE, READ, NULL,
("Read error at position %llu (0x%llx)", pos, pos));
return -1;
}
if (gst_bytestream_peek_bytes (ebml->bs, &data, 1) != 1) {
guint64 pos = gst_bytestream_tell (ebml->bs);
- gst_element_error (ebml, RESOURCE, READ, NULL,
+ GST_ELEMENT_ERROR (ebml, RESOURCE, READ, NULL,
("Read error at position %llu (0x%llx)", pos, pos));
return -1;
}
}
if (read > 8) {
guint64 pos = gst_bytestream_tell (ebml->bs);
- gst_element_error (ebml, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, NULL,
("Invalid EBML length size tag (0x%x) at position %llu (0x%llx)",
data[0], pos, pos));
return -1;
num_ffs++;
if (gst_bytestream_peek_bytes (ebml->bs, &data, read) != read) {
guint64 pos = gst_bytestream_tell (ebml->bs);
- gst_element_error (ebml, RESOURCE, READ, NULL,
+ GST_ELEMENT_ERROR (ebml, RESOURCE, READ, NULL,
("Read error at position %llu (0x%llx)", pos, pos));
return -1;
}
if (gst_bytestream_peek (ebml->bs, &buf, length) != length) {
guint64 pos = gst_bytestream_tell (ebml->bs);
- gst_element_error (ebml, RESOURCE, READ, NULL,
+ GST_ELEMENT_ERROR (ebml, RESOURCE, READ, NULL,
("Read error at position %llu (0x%llx)", pos, pos));
if (buf)
gst_buffer_unref (buf);
/* now seek */
if (!gst_bytestream_seek (ebml->bs, offset, GST_SEEK_METHOD_SET)) {
- gst_element_error (ebml, RESOURCE, SEEK, NULL,
+ GST_ELEMENT_ERROR (ebml, RESOURCE, SEEK, NULL,
("Seek to position %llu (0x%llx) failed", offset, offset));
return NULL;
}
/* get the discont event and return */
gst_bytestream_get_status (ebml->bs, &remaining, &event);
if (!event || GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) {
- gst_element_error (ebml, CORE, SEEK, NULL,
+ GST_ELEMENT_ERROR (ebml, CORE, SEEK, NULL,
("No discontinuity event after seek"));
if (event)
gst_event_unref (event);
data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
if (size < 1 || size > 8) {
- gst_element_error (ebml, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, NULL,
("Invalid integer element size %d at position %llu (0x%llu)",
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
gst_buffer_unref (buf);
data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
if (size < 1 || size > 8) {
- gst_element_error (ebml, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, NULL,
("Invalid integer element size %d at position %llu (0x%llx)",
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
gst_buffer_unref (buf);
size = GST_BUFFER_SIZE (buf);
if (size != 4 && size != 8 && size != 10) {
- gst_element_error (ebml, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, NULL,
("Invalid float element size %d at position %llu (0x%llx)",
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
gst_buffer_unref (buf);
}
if (size == 10) {
- gst_element_error (ebml, CORE, NOT_IMPLEMENTED, NULL,
+ GST_ELEMENT_ERROR (ebml, CORE, NOT_IMPLEMENTED, NULL,
("FIXME! 10-byte floats unimplemented"));
gst_buffer_unref (buf);
return FALSE;
if (!(id = gst_ebml_peek_id (ebml, &level_up)))
return FALSE;
if (level_up != 0 || id != GST_EBML_ID_HEADER) {
- gst_element_error (ebml, STREAM, WRONG_TYPE, NULL, NULL);
+ GST_ELEMENT_ERROR (ebml, STREAM, WRONG_TYPE, NULL, NULL);
return FALSE;
}
if (!gst_ebml_read_master (ebml, &id))
return FALSE;
if (!doctype || strcmp (doctype, "matroska") != 0) {
- gst_element_error (demux, STREAM, WRONG_TYPE, NULL,
+ GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, NULL,
("Input is not a matroska stream (doctype=%s)",
doctype ? doctype : "none"));
g_free (doctype);
}
g_free (doctype);
if (version > 1) {
- gst_element_error (demux, STREAM, DEMUX, NULL,
+ GST_ELEMENT_ERROR (demux, STREAM, DEMUX, NULL,
("Demuxer version (1) is too old to read stream version %d",
version));
return FALSE;
/* first byte(s): blocknum */
if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) {
- gst_element_error (demux, STREAM, DEMUX, NULL, ("Data error"));
+ GST_ELEMENT_ERROR (demux, STREAM, DEMUX, NULL, ("Data error"));
gst_buffer_unref (buf);
res = FALSE;
break;
case 0x3: /* EBML lacing */ {
guint total;
if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) {
- gst_element_error (demux, STREAM, DEMUX, NULL, ("Data error"));
+ GST_ELEMENT_ERROR (demux, STREAM, DEMUX, NULL, ("Data error"));
res = FALSE;
break;
}
gint64 snum;
gint r;
if ((r = gst_matroska_ebmlnum_sint (data, size, &snum)) < 0) {
- gst_element_error (demux, STREAM, DEMUX, NULL, ("Data error"));
+ GST_ELEMENT_ERROR (demux, STREAM, DEMUX, NULL, ("Data error"));
res = FALSE;
break;
}
GST_DEBUG ("making new pad");
if (!gst_pad_is_negotiated (monoscope->srcpad)) {
if (gst_pad_renegotiate (monoscope->srcpad) <= 0) {
- gst_element_error (monoscope, CORE, NEGOTIATION, NULL, NULL);
+ GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, NULL, NULL);
return;
}
}
"framerate", G_TYPE_DOUBLE, smpte->fps, NULL);
if (!gst_pad_try_set_caps (smpte->srcpad, caps)) {
- gst_element_error (smpte, CORE, NEGOTIATION, NULL, NULL);
+ GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, NULL, NULL);
return;
}
}
if (!wavenc->setup) {
gst_buffer_unref (buf);
- gst_element_error (wavenc, CORE, NEGOTIATION, NULL, ("encoder not initialised (input is not audio?)"));
+ GST_ELEMENT_ERROR (wavenc, CORE, NEGOTIATION, NULL, ("encoder not initialised (input is not audio?)"));
return;
}
break;
default:
- gst_element_error (wavparse, STREAM, NOT_IMPLEMENTED, NULL, ("format %d not handled", wavparse->format));
+ GST_ELEMENT_ERROR (wavparse, STREAM, NOT_IMPLEMENTED, NULL, ("format %d not handled", wavparse->format));
return;
}
if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
gst_pad_event_default (wavparse->sinkpad, event);
} else {
- gst_element_error (element, RESOURCE, READ, NULL, NULL);
+ GST_ELEMENT_ERROR (element, RESOURCE, READ, NULL, NULL);
}
return;
}
case GST_WAVPARSE_START:
if (chunk.id != GST_RIFF_TAG_RIFF &&
chunk.type != GST_RIFF_RIFF_WAVE) {
- gst_element_error (element, STREAM, WRONG_TYPE, NULL,
+ GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, NULL,
("chunk.id %08x chunk.type %08x", chunk.id, chunk.type));
return;
}
if (oss->fd < 0) {
switch (errno) {
case EBUSY:
- gst_element_error (oss, RESOURCE, BUSY,
+ GST_ELEMENT_ERROR (oss, RESOURCE, BUSY,
(_("OSS device \"%s\" is already in use by another program"), oss->device), NULL);
break;
case EACCES:
case ETXTBSY:
if (mode == GST_OSSELEMENT_WRITE)
- gst_element_error (oss, RESOURCE, OPEN_WRITE,
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
(_("Could not access device \"%s\", check its permissions"), oss->device), GST_ERROR_SYSTEM);
else
- gst_element_error (oss, RESOURCE, OPEN_READ,
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
(_("Could not access device \"%s\", check its permissions"), oss->device), GST_ERROR_SYSTEM);
break;
case ENXIO:
case ENODEV:
case ENOENT:
- gst_element_error (oss, RESOURCE, NOT_FOUND,
+ GST_ELEMENT_ERROR (oss, RESOURCE, NOT_FOUND,
(_("Device \"%s\" does not exist"), oss->device), GST_ERROR_SYSTEM);
break;
default:
/* FIXME: strerror is not threadsafe */
if (mode == GST_OSSELEMENT_WRITE)
- gst_element_error (oss, RESOURCE, OPEN_WRITE,
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
(_("Could not open device \"%s\" for writing"), oss->device), GST_ERROR_SYSTEM);
else
- gst_element_error (oss, RESOURCE, OPEN_READ,
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
(_("Could not open device \"%s\" for reading"), oss->device), GST_ERROR_SYSTEM);
break;
}
if (!GST_OSSELEMENT (osssink)->bps) {
gst_buffer_unref (buf);
- gst_element_error (osssink, CORE, NEGOTIATION, NULL, ("format wasn't negotiated before chain function"));
+ GST_ELEMENT_ERROR (osssink, CORE, NEGOTIATION, NULL, ("format wasn't negotiated before chain function"));
return;
}
/* nothing was negotiated, we can decide on a format */
if (!gst_osssrc_negotiate (pad)) {
gst_buffer_unref (buf);
- gst_element_error (src, CORE, NEGOTIATION, NULL, NULL);
+ GST_ELEMENT_ERROR (src, CORE, NEGOTIATION, NULL, NULL);
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
}
if (GST_OSSELEMENT (src)->bps == 0) {
gst_buffer_unref (buf);
- gst_element_error (src, CORE, NEGOTIATION, NULL,
+ GST_ELEMENT_ERROR (src, CORE, NEGOTIATION, NULL,
("format wasn't negotiated before chain function"));
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
src->buffersize);
if (readbytes < 0) {
gst_buffer_unref (buf);
- gst_element_error (src, RESOURCE, READ, NULL, GST_ERROR_SYSTEM);
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, NULL, GST_ERROR_SYSTEM);
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
if (v4l2src->use_fixed_fps &&
(fps = gst_v4l2src_get_fps(v4l2src)) == 0) {
- gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL, ("could not get frame rate for element"));
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, NULL, ("could not get frame rate for element"));
return NULL;
}
switch (system(buff)) {
case -1:
- gst_element_error (v4l2element, RESOURCE, FAILED,
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED,
(_("Could not start v4l-conf")),
GST_ERROR_SYSTEM);
g_free(buff);
case 0:
break;
default:
- gst_element_error (v4l2element, RESOURCE, FAILED,
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED,
(_("Executing v4l-conf failed")),
GST_ERROR_SYSTEM);
g_free(buff);
fmt.fmt.win.bitmap = NULL;
if (ioctl(v4l2element->video_fd, VIDIOC_S_FMT, &fmt) < 0) {
- gst_element_error (v4l2element, RESOURCE, TOO_LAZY, NULL,
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, NULL,
("Failed to set the video window: %s", g_strerror (errno)));
return FALSE;
}
GST_V4L2_CHECK_OVERLAY(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_OVERLAY, &doit) < 0) {
- gst_element_error (v4l2element, RESOURCE, TOO_LAZY, NULL,
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, NULL,
("Failed to %s overlay display: %s",
enable?"enable":"disable", g_strerror (errno)));
return FALSE;
GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_QUERYCAP, &(v4l2element->vcap)) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Error getting %s capabilities: %s",
v4l2element->device, g_strerror(errno)));
return FALSE;
if (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get %d in input enumeration for %s: %s",
n, v4l2element->device,
g_strerror (errno)));
vtun.index = input.tuner;
if (ioctl(v4l2element->video_fd, VIDIOC_G_TUNER,
&vtun) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get tuner %d settings on %s: %s",
input.tuner,
v4l2element->device,
if (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get %d in output enumeration for %s: %s",
n, v4l2element->device,
g_strerror (errno)));
if (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get %d in norm enumeration for %s: %s",
n, v4l2element->device,
g_strerror (errno)));
else
break;
} else {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get %d in control enumeration for %s: %s",
n, v4l2element->device,
g_strerror (errno)));
if (errno == EINVAL)
break; /* end of enumeration */
else {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get %d in menu enumeration for %s: %s",
n, v4l2element->device,
g_strerror (errno)));
/* open the device */
v4l2element->video_fd = open(v4l2element->device, O_RDWR);
if (!GST_V4L2_IS_OPEN(v4l2element)) {
- gst_element_error (v4l2element, RESOURCE, OPEN_READ_WRITE,
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, OPEN_READ_WRITE,
(_("Could not open device \"%s\" for reading and writing"), v4l2element->device),
GST_ERROR_SYSTEM);
goto error;
/* do we need to be a capture device? */
if (GST_IS_V4L2SRC(v4l2element) &&
!(v4l2element->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
- gst_element_error (v4l2element, RESOURCE, NOT_FOUND,
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, NOT_FOUND,
(_("Device \"%s\" is not a capture device"), v4l2element->device),
("Capabilities: 0x%x", v4l2element->vcap.capabilities));
goto error;
GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_G_STD, norm) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get the current norm for device %s: %s",
v4l2element->device, g_strerror(errno)));
return FALSE;
GST_V4L2_CHECK_NOT_ACTIVE(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_S_STD, &norm) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to set norm 0x%llx for device %s: %s",
norm, v4l2element->device, g_strerror(errno)));
return FALSE;
GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_G_INPUT, &n) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get current input on device %s: %s",
v4l2element->device, g_strerror(errno)));
return FALSE;
GST_V4L2_CHECK_NOT_ACTIVE(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_S_INPUT, &input) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to set input %d on device %s: %s",
input, v4l2element->device, g_strerror(errno)));
return FALSE;
GST_V4L2_CHECK_OPEN(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_G_OUTPUT, &n) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get current output on device %s: %s",
v4l2element->device, g_strerror(errno)));
return FALSE;
GST_V4L2_CHECK_NOT_ACTIVE(v4l2element);
if (ioctl(v4l2element->video_fd, VIDIOC_S_OUTPUT, &output) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to set output %d on device %s: %s",
output, v4l2element->device, g_strerror(errno)));
return FALSE;
freq.tuner = tunernum;
if (ioctl(v4l2element->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get current tuner frequency for device %s: %s",
v4l2element->device, g_strerror(errno)));
return FALSE;
freq.frequency = frequency;
if (ioctl(v4l2element->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to set tuner frequency to %lu for device %s: %s",
frequency, v4l2element->device, g_strerror(errno)));
return FALSE;
tuner.index = tunernum;
if (ioctl(v4l2element->video_fd, VIDIOC_G_TUNER, &tuner) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get signal strength for device %s: %s",
v4l2element->device, g_strerror(errno)));
return FALSE;
control.id = attribute_num;
if (ioctl(v4l2element->video_fd, VIDIOC_G_CTRL, &control) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to get value for control %d on device %s: %s",
attribute_num, v4l2element->device, g_strerror(errno)));
return FALSE;
control.value = value;
if (ioctl(v4l2element->video_fd, VIDIOC_S_CTRL, &control) < 0) {
- gst_element_error (v4l2element, RESOURCE, SETTINGS, (""),
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (""),
("Failed to set value %d for control %d on device %s: %s",
value, attribute_num, v4l2element->device, g_strerror(errno)));
return FALSE;
#define GST_V4L2_CHECK_OPEN(element) \
if (!GST_V4L2_IS_OPEN(element)) \
{ \
- gst_element_error (element, RESOURCE, TOO_LAZY, \
+ GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
(_("Device is not open")), NULL); \
return FALSE; \
}
#define GST_V4L2_CHECK_NOT_OPEN(element) \
if (GST_V4L2_IS_OPEN(element)) \
{ \
- gst_element_error (element, RESOURCE, TOO_LAZY, \
+ GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
(_("Device is open")), NULL); \
return FALSE; \
}
#define GST_V4L2_CHECK_OVERLAY(element) \
if (!GST_V4L2_IS_OVERLAY(element)) \
{ \
- gst_element_error (element, RESOURCE, TOO_LAZY, \
+ GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
NULL, ("Device cannot handle overlay")); \
return FALSE; \
}
#define GST_V4L2_CHECK_ACTIVE(element) \
if (!GST_V4L2_IS_ACTIVE(element)) \
{ \
- gst_element_error (element, RESOURCE, SETTINGS, \
+ GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
NULL, ("Device is not in streaming mode")); \
return FALSE; \
}
#define GST_V4L2_CHECK_NOT_ACTIVE(element) \
if (GST_V4L2_IS_ACTIVE(element)) \
{ \
- gst_element_error (element, RESOURCE, SETTINGS, \
+ GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
NULL, ("Device is in streaming mode")); \
return FALSE; \
}
if (errno == EINVAL) {
break; /* end of enumeration */
} else {
- gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, NULL,
("failed to get number %d in pixelformat enumeration for %s: %s",
n, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
g_free (format);
GST_LOG_OBJECT (v4l2src, "queueing frame %u", i);
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_QBUF, &v4l2src->pool->buffers[i].buffer) < 0) {
- gst_element_error (v4l2src, RESOURCE, WRITE,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, WRITE,
(_("Could not write to device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device),
("Error queueing buffer %u on device %s", i, g_strerror(errno)));
return FALSE;
while (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_DQBUF, &buffer) < 0) {
/* if the sync() got interrupted, we can retry */
if (errno != EINTR) {
- gst_element_error (v4l2src, RESOURCE, SYNC, NULL, ("could not sync on a buffer on device %s: %s",
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, NULL, ("could not sync on a buffer on device %s: %s",
GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return -1;
}
v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_G_FMT, &v4l2src->format) < 0) {
- gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, NULL,
("failed to get pixelformat for device %s: %s",
GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return FALSE;
v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_S_FMT, &v4l2src->format) < 0) {
- gst_element_error (v4l2src, RESOURCE, SETTINGS, NULL,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, NULL,
("failed to set pixelformat to %s @ %dx%d for device %s: %s",
fmt->description, width, height, GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return FALSE;
v4l2src->breq.type = v4l2src->format.type;
v4l2src->breq.memory = V4L2_MEMORY_MMAP;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_REQBUFS, &v4l2src->breq) < 0) {
- gst_element_error (v4l2src, RESOURCE, READ,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ,
(_("Could not get buffers from device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device),
("error requesting %d buffers: %s", v4l2src->breq.count, g_strerror (errno)));
return FALSE;
}
if (v4l2src->breq.count < GST_V4L2_MIN_BUFFERS) {
- gst_element_error (v4l2src, RESOURCE, READ,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ,
(_("Could not get enough buffers from device \"%s\""), GST_V4L2ELEMENT(v4l2src)->device),
("we received %d, we want at least %d", v4l2src->breq.count, GST_V4L2_MIN_BUFFERS));
v4l2src->breq.count = buffers;
buffer->buffer.index = n;
buffer->buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_QUERYBUF, &buffer->buffer) < 0) {
- gst_element_error (v4l2src, RESOURCE, READ, NULL,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, NULL,
("Could not get buffer properties of buffer %d: %s", n, g_strerror (errno)));
gst_v4l2src_capture_deinit(v4l2src);
return FALSE;
buffer->start = mmap (0, buffer->buffer.length, PROT_READ|PROT_WRITE, MAP_SHARED,
GST_V4L2ELEMENT(v4l2src)->video_fd, buffer->buffer.m.offset);
if (buffer->start == MAP_FAILED) {
- gst_element_error (v4l2src, RESOURCE, READ, NULL,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, NULL,
("Could not mmap video buffer %d: %s", n, g_strerror (errno)));
buffer->start = 0;
gst_v4l2src_capture_deinit (v4l2src);
v4l2src->quit = FALSE;
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_STREAMON, &type) < 0) {
- gst_element_error (v4l2src, RESOURCE, OPEN_READ, NULL,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, OPEN_READ, NULL,
("Error starting streaming capture from device %s: %s",
GST_V4L2ELEMENT(v4l2src)->device, g_strerror(errno)));
return FALSE;
/* we actually need to sync on all queued buffers but not
* on the non-queued ones */
if (ioctl(GST_V4L2ELEMENT(v4l2src)->video_fd, VIDIOC_STREAMOFF, &type) < 0) {
- gst_element_error (v4l2src, RESOURCE, CLOSE, NULL,
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, CLOSE, NULL,
("Error stopping streaming capture from device %s: %s",
GST_V4L2ELEMENT(v4l2src)->device, g_strerror (errno)));
return FALSE;