コード例 #1
0
ファイル: burn-transcode.c プロジェクト: Elfindora/brasero
static void
brasero_transcode_error_on_pad_linking (BraseroTranscode *self,
                                        const gchar *function_name)
{
	BraseroTranscodePrivate *priv;
	GstMessage *message;
	GstBus *bus;

	priv = BRASERO_TRANSCODE_PRIVATE (self);

	BRASERO_JOB_LOG (self, "Error on pad linking");
	message = gst_message_new_error (GST_OBJECT (priv->pipeline),
					 g_error_new (BRASERO_BURN_ERROR,
						      BRASERO_BURN_ERROR_GENERAL,
						      /* Translators: This message is sent
						       * when brasero could not link together
						       * two gstreamer plugins so that one
						       * sends its data to the second for further
						       * processing. This data transmission is
						       * done through a pad. Maybe this is a bit
						       * too technical and should be removed? */
						      _("Impossible to link plugin pads")),
					 function_name);

	bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
	gst_bus_post (bus, message);
	g_object_unref (bus);
}
コード例 #2
0
ファイル: message.cpp プロジェクト: cyndis/qtgstreamer
ErrorMessagePtr ErrorMessage::create(const ObjectPtr & source,
                                     const QGlib::Error & error, const char *debug)
{
    //stupid GstMessage api takes non-const GError while it should
    GError *e = const_cast<GError*>(static_cast<const GError*>(error));
    return ErrorMessagePtr::wrap(gst_message_new_error(source, e, debug), false);
}
コード例 #3
0
ファイル: e-tools.c プロジェクト: Buzztrax/buzztrax
static void
test_bt_log_message_error (BT_TEST_ARGS)
{
  BT_TEST_START;
  GST_INFO ("-- arrange --");
  GstObject *src = (GstObject *) gst_element_factory_make ("fakesrc", NULL);
  GError *error = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_FAILED,
      "description");
  GstMessage *msg = gst_message_new_error (src, error, "debug");
  gchar *message, *description;

  GST_INFO ("-- act --");
  gboolean res = bt_gst_log_message_error (GST_CAT_DEFAULT, __FILE__, "",
      __LINE__, msg, &message, &description);

  GST_INFO ("-- assert --");
  fail_unless (res, NULL);
  fail_unless (description != NULL, NULL);
  ck_assert_str_eq (message, "description");

  GST_INFO ("-- cleanup --");
  g_free (message);
  g_free (description);
  gst_message_unref (msg);
  gst_object_unref (src);
  BT_TEST_END;
}
コード例 #4
0
static void
send_5app_1el_1err_2app_messages (guint interval_usecs)
{
  GstMessage *m;
  GstStructure *s;
  gint i;

  for (i = 0; i < 5; i++) {
    s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL);
    m = gst_message_new_application (NULL, s);
    GST_LOG ("posting application message");
    gst_bus_post (test_bus, m);
    g_usleep (interval_usecs);
  }
  for (i = 0; i < 1; i++) {
    s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL);
    m = gst_message_new_element (NULL, s);
    GST_LOG ("posting element message");
    gst_bus_post (test_bus, m);
    g_usleep (interval_usecs);
  }
  for (i = 0; i < 1; i++) {
    m = gst_message_new_error (NULL, NULL, "debug string");
    GST_LOG ("posting error message");
    gst_bus_post (test_bus, m);
    g_usleep (interval_usecs);
  }
  for (i = 0; i < 2; i++) {
    s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL);
    m = gst_message_new_application (NULL, s);
    GST_LOG ("posting application message");
    gst_bus_post (test_bus, m);
    g_usleep (interval_usecs);
  }
}
コード例 #5
0
ファイル: rbgst-message.c プロジェクト: msakai/ruby-gnome2
static VALUE
error_initialize(VALUE self, VALUE src, VALUE error, VALUE debug)
{
    G_INITIALIZE(self, gst_message_new_error(RVAL2GST_OBJ(src),
                                             RVAL2GERROR(error), /* FIXME */
                                             RVAL2CSTR(debug)));
    return Qnil;
}
コード例 #6
0
ファイル: gstvdpsink.c プロジェクト: spunktsch/svtplayer
static void
gst_vdp_sink_post_error (VdpSink * vdp_sink, GError * error)
{
  GstMessage *message;

  message = gst_message_new_error (GST_OBJECT (vdp_sink), error, NULL);
  gst_element_post_message (GST_ELEMENT (vdp_sink), message);
  g_error_free (error);
}
コード例 #7
0
static void
gst_vdp_vpp_post_error (GstVdpVideoPostProcess * vpp, GError * error)
{
  GstMessage *message;

  message = gst_message_new_error (GST_OBJECT (vpp), error, NULL);
  gst_element_post_message (GST_ELEMENT (vpp), message);
  g_error_free (error);
}
コード例 #8
0
ファイル: appsrc.c プロジェクト: jledet/gst-plugins-base
static gboolean
error_timeout (ProgramData * data)
{
  GstBus *bus;
  bus = gst_element_get_bus (data->sink);
  gst_bus_post (bus, gst_message_new_error (GST_OBJECT (data->sink), NULL,
          "test error"));
  gst_object_unref (bus);
  return FALSE;
}
コード例 #9
0
void rygel_gst_utils_post_error (GstElement* dest, GError* _error_) {
#line 144 "rygel-gst-utils.c"
	GstMessage* msg;
#line 45 "rygel-gst-utils.vala"
	g_return_if_fail (dest != NULL);
#line 46 "rygel-gst-utils.vala"
	msg = gst_message_new_error ((GstObject*) dest, _error_, _error_->message);
#line 47 "rygel-gst-utils.vala"
	gst_element_post_message (dest, _gst_message_ref0 (msg));
#line 152 "rygel-gst-utils.c"
	_gst_message_unref0 (msg);
}
コード例 #10
0
static int mfw_gst_vpuenc_init_encoder(GstPad *pad, enum v4l2_memory memory)
{
	GstVPU_Enc *vpu_enc = MFW_GST_VPU_ENC(GST_PAD_PARENT(pad));
	gchar *mime = "undef";
	gint ret;
	GstCaps *caps = NULL;
	struct v4l2_format fmt;
	int retval, i;

	if (!vpu_enc->codecTypeProvided) {
		GST_ERROR("Incomplete command line.\n");
		GError *error = NULL;
		GQuark domain = g_quark_from_string("mfw_vpuencoder");
		error = g_error_new(domain, 10, "fatal error");
		gst_element_post_message(GST_ELEMENT(vpu_enc),
					 gst_message_new_error
					 (GST_OBJECT(vpu_enc), error,
					  "Incomplete command line - codec type was not provided."));
		return GST_FLOW_ERROR;
	}

	fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
	fmt.fmt.pix.width = vpu_enc->width;
	fmt.fmt.pix.height = vpu_enc->height;
	fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YVU420;

	retval = ioctl(vpu_enc->vpu_fd, VIDIOC_S_FMT, &fmt);
	if (retval) {
		printf("VIDIOC_S_FMT failed: %s\n", strerror(errno));
		return GST_FLOW_ERROR;
	}

	reqs.memory = memory;
	retval = ioctl(vpu_enc->vpu_fd, VIDIOC_REQBUFS, &reqs);
	if (retval) {
		perror("VIDIOC_REQBUFS");
		return GST_FLOW_ERROR;
	}

	retval = ioctl(vpu_enc->vpu_fd, VPU_IOC_CODEC, vpu_enc->codec);
	if (retval) {
		perror("VPU_IOC_CODEC");
		return GST_FLOW_ERROR;
	}

	retval = ioctl(vpu_enc->vpu_fd, VPU_IOC_MJPEG_QUALITY, vpu_enc->mjpeg_quality);
	if (retval) {
		perror("VPU_IOC_MJPEG_QUALITY");
		return GST_FLOW_ERROR;
	}

	for (i = 0; i < NUM_BUFFERS; i++) {
		struct v4l2_buffer *buf = &vpu_enc->buf_v4l2[i];
		buf->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
		buf->memory = memory;
		buf->index = i;

		if (memory == V4L2_MEMORY_MMAP) {
			retval = ioctl(vpu_enc->vpu_fd, VIDIOC_QUERYBUF, buf);
			if (retval) {
				GST_ERROR("VIDIOC_QUERYBUF failed: %s\n", strerror(errno));
				return GST_FLOW_ERROR;
			}
			vpu_enc->buf_size[i] = buf->length;
			vpu_enc->buf_data[i] = mmap(NULL, buf->length,
					   PROT_READ | PROT_WRITE, MAP_SHARED,
					   vpu_enc->vpu_fd, vpu_enc->buf_v4l2[i].m.offset);
		}
	}

	switch (vpu_enc->codec) {
	case  STD_MPEG4:
		mime = "video/mpeg";
		break;
	case STD_AVC:
		mime = "video/x-h264";
		break;
	case STD_H263:
		mime = "video/x-h263";
		break;
	case STD_MJPG:
		mime = "image/jpeg";
		break;
	default:
		return GST_FLOW_ERROR;
	}

	caps = gst_caps_new_simple(mime,
			   "mpegversion", G_TYPE_INT, 4,
			   "systemstream", G_TYPE_BOOLEAN, FALSE,
			   "height", G_TYPE_INT, vpu_enc->height,
			   "width", G_TYPE_INT, vpu_enc->width,
			   "framerate", GST_TYPE_FRACTION, (gint32) (vpu_enc->framerate * 1000),
			   1000, NULL);

	gst_pad_set_caps(vpu_enc->srcpad, caps);

	vpu_enc->init = TRUE;

	return GST_FLOW_OK;
}