void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t* streamer, guint max_bitrate, guint avg_bitrate)
{
	debug_fenter();

	return_if_fail(streamer);

       /* Note : Update buffering criterion bytes
         *      1. maximum bitrate is considered first.
         *      2. average bitrage * 3 is next.
         *      3. if there are no updated bitrate, use default buffering limit.
         */
        if (max_bitrate > 0 && streamer->buffer_max_bitrate != max_bitrate)
        {
              debug_log("set maximum bitrate(%dbps).\n", max_bitrate);
              streamer->buffer_max_bitrate = max_bitrate;

		streamer->need_update = TRUE;
        }

        if (avg_bitrate > 0 && streamer->buffer_avg_bitrate != avg_bitrate)
	{
              debug_log("set averate bitrate(%dbps).\n", avg_bitrate);
              streamer->buffer_avg_bitrate = avg_bitrate;

		streamer->need_update = TRUE;
	}

	debug_fleave();

	return;
}
static void
streaming_set_buffering_time(mm_player_streaming_t* streamer, gdouble buffering_time)
{
	gdouble buffer_buffering_time = DEFAULT_BUFFERING_TIME;

	debug_fenter();

	return_if_fail(streamer);

	if (buffering_time < MIN_BUFFERING_TIME)
		buffer_buffering_time = MIN_BUFFERING_TIME;
	else if (buffering_time > MAX_BUFFERING_TIME)
		buffer_buffering_time = MAX_BUFFERING_TIME;
	else
		buffer_buffering_time = buffering_time;

	if (streamer->buffering_time != buffer_buffering_time)
	{
		debug_log("set buffer buffering time from %2.1f to %2.1f.", streamer->buffering_time, buffer_buffering_time);

		streamer->buffering_time = buffer_buffering_time;
	}

	debug_fleave();

	return;
}
void __mm_player_streaming_set_buffer(mm_player_streaming_t* streamer, GstElement * buffer,
	gboolean use_buffering, guint buffer_size, gdouble low_percent, gdouble high_percent, gdouble buffering_time,
	gboolean use_file, gchar * file_path, guint64 content_size)
{
	debug_fenter();

	return_if_fail(streamer);

	if (buffer)
	{
		streamer->buffer = buffer;

		debug_log("buffer element is %s.", GST_ELEMENT_NAME(buffer));

		g_object_set ( G_OBJECT (streamer->buffer), "use-buffering", use_buffering, NULL );
	}

	streaming_set_buffer_size(streamer, buffer_size);
	streaming_set_buffer_percent(streamer, low_percent, high_percent);
	streaming_set_buffer_type (streamer, use_file, file_path, content_size);
	streaming_set_buffering_time(streamer, buffering_time);

	debug_fleave();

	return;
}
示例#4
0
void test_pthread(void)
{
	pthread_t consumer_t = 0;
	pthread_t producer_t = 0;
	Locker *wrlock = locker_pthread_create();
	Locker *nest_lock = locker_pthread_nest_create(wrlock, (ReadSelfId)pthread_self);
#ifdef RW_LOCK
	Locker *rdlock = locker_pthread_create();
	RWLock *rwlock = rwlock_create(wrlock, rdlock);
#endif
	DList *head = NULL;
	
#ifdef RW_LOCK
	head = dlist_create(rwlock);
#else
	head = dlist_create(wrlock);
#endif
	return_if_fail(head != NULL);
	
	pthread_create(&producer_t, NULL, producer_thread, head);
	pthread_create(&consumer_t, NULL, consumer_thread, head);

	pthread_join(consumer_t, NULL);
	pthread_join(producer_t, NULL);
}
示例#5
0
/*
 * mowgli_object_unref
 *
 * Decrement the reference counter on an object.
 *
 * Inputs:
 *      - the object to refcount
 *
 * Outputs:
 *      - none
 *
 * Side Effects:
 *      - if the refcount is 0, the object is destroyed.
 */
void
mowgli_object_unref(void *object)
{
	mowgli_object_t *obj = mowgli_object(object);

	return_if_fail(object != NULL);

	obj->refcount--;

	if (obj->refcount <= 0)
	{
		mowgli_object_message_broadcast(obj, "destroy");

		if (obj->name != NULL)
			free(obj->name);

		if (obj->klass != NULL)
		{
			mowgli_destructor_t destructor = obj->klass->destructor;

			if (obj->klass->dynamic == TRUE)
				mowgli_object_class_destroy(obj->klass);

			if (destructor != NULL)
				destructor(obj);
			else
				free(obj);
		}
		else
		{
			mowgli_log_warning("invalid object class");
		}
	}
}
示例#6
0
void CMediaSession::unregister_fd_cb(sgs_connection *conn, int fd, short events)
{
    sgs_context *ctx = sgs_connection_get_context(conn);
    CMediaSession *thiz = (CMediaSession *) sgs_context_get_priv(ctx);
    return_if_fail(thiz);
    thiz->unregisterFdCB(conn, fd, events);
}
PRIVATE void add_polygon_path(SvgPolygonRenderObject* render_object, GraphicsPath* path){
	ARRAY point_array = {0};
	return_if_fail(render_object && path);

	point_array = svg_polygon_render_object_get_point_array(render_object);
	path->AddPolygon((PointF*)point_array.data, point_array.length);
}
示例#8
0
static void ini_parser_error(INIParser* thiz, int line, int row, char* message)
{
	return_if_fail(thiz != NULL && thiz->builder != NULL);

	ini_builder_on_error(thiz->builder, line, row, message);
	return;
}
示例#9
0
void ftk_widget_set_type(FtkWidget* thiz, int type)
{
	return_if_fail(thiz != NULL && thiz->priv != NULL);
	thiz->priv->type = type;

	return;
}
示例#10
0
static void ini_parser_subkey(INIParser* thiz)
{
	return_if_fail(thiz != NULL && thiz->builder != NULL);

	ini_builder_on_subkey(thiz->builder, thiz->subkey_start);
	return;
}
示例#11
0
static void ini_parser_value(INIParser* thiz)
{
	return_if_fail(thiz != NULL && thiz->builder != NULL);

	ini_builder_on_value(thiz->builder, thiz->value_start);
	return;
}
示例#12
0
void
db_close(database_handle_t *db)
{
	return_if_fail(db_mod != NULL);

	return db_mod->db_close(db);
}
示例#13
0
void ini_parser_set_builder(INIParser* thiz, INIBuilder* builder)
{
	return_if_fail(thiz != NULL && builder != NULL);

	thiz->builder = builder;
	return;
}
示例#14
0
static void opensex_db_close(database_handle_t *db)
{
	opensex_t *rs;
	int errno1;
	char oldpath[BUFSIZE], newpath[BUFSIZE];

	return_if_fail(db != NULL);
	rs = db->priv;

	mowgli_strlcpy(oldpath, db->file, sizeof oldpath);
	mowgli_strlcat(oldpath, ".new", sizeof oldpath);

	mowgli_strlcpy(newpath, db->file, sizeof newpath);

	fclose(rs->f);

	if (db->txn == DB_WRITE)
	{
		/* now, replace the old database with the new one, using an atomic rename */
		if (srename(oldpath, newpath) < 0)
		{
			errno1 = errno;
			slog(LG_ERROR, "db_save(): cannot rename services.db.new to services.db: %s", strerror(errno1));
			wallops(_("\2DATABASE ERROR\2: db_save(): cannot rename services.db.new to services.db: %s"), strerror(errno1));
		}

		hook_call_db_saved();
	}

	free(rs->buf);
	free(rs);
	free(db->file);
	free(db);
}
示例#15
0
/*
 * mowgli_object_init
 *
 * Populates the object manager part of an object.
 *
 * Inputs:
 *      - pointer to object manager area
 *      - (optional) name of object
 *      - (optional) class of object
 *      - (optional) custom destructor
 *
 * Outputs:
 *      - none
 *
 * Side Effects:
 *      - none
 */
void
mowgli_object_init(mowgli_object_t *obj, const char *name, mowgli_object_class_t *klass, mowgli_destructor_t des)
{
	return_if_fail(obj != NULL);

	if (name != NULL)
		obj->name = mowgli_strdup(name);

	if (klass != NULL)
	{
		obj->klass = klass;
	}
	else
	{
		mowgli_object_class_t *tmp = mowgli_alloc(sizeof *tmp);
		mowgli_object_class_init(tmp, name, des, TRUE);
		obj->klass = tmp;
	}

	obj->refcount = 1;

	obj->message_handlers.head = NULL;
	obj->message_handlers.tail = NULL;
	obj->message_handlers.count = 0;

	obj->metadata.head = NULL;
	obj->metadata.tail = NULL;
	obj->metadata.count = 0;

	mowgli_object_message_broadcast(obj, "create");
}
示例#16
0
static void
on_channel_mode(hook_channel_mode_t *data)
{
	mychan_t *mc;

	return_if_fail(data != NULL);
	return_if_fail(data->c != NULL);

	mc = mychan_from(data->c);

	if (mc == NULL || mc->flags & MC_NOSYNC)
		return;

	if (do_channel_sync != NULL)
		do_channel_sync(mc, NULL);
}
示例#17
0
void ftk_widget_ref_self(FtkWidget* thiz)
{
	return_if_fail(thiz != NULL);
	thiz->ref++;

	return;
}
示例#18
0
static void ini_parser_comment(INIParser* thiz)
{
	return_if_fail(thiz != NULL && thiz->builder != NULL);

	ini_builder_on_comment(thiz->builder, thiz->comment_start);
	return;
}
示例#19
0
void ftk_widget_show(FtkWidget* thiz, int visible)
{
	FtkEvent event = {0};
	
	return_if_fail(thiz != NULL && thiz->priv != NULL);
	if(thiz->priv->visible == visible) return;
	
	thiz->priv->visible = visible;
	event.type = visible ? FTK_EVT_SHOW : FTK_EVT_HIDE;

	ftk_widget_event(thiz, &event);

	if(!ftk_widget_is_parent_visible(thiz))
	{
		return;
	}

	if(visible)
	{
		ftk_widget_paint(thiz);
	}
	else
	{
		/*FIXME: now, as ftk not support clip, repaint the whole parent surface.*/
		ftk_widget_paint(ftk_widget_parent(thiz));
	}

	return;
}
示例#20
0
void fl_xml_free_context(fl_xml_ctx_t *ctx)
{
    return_if_fail(ctx);

    xml_ctx_free(ctx->xml);
    fclose(ctx->fp);
    free(ctx);
}
示例#21
0
文件: asuka.c 项目: atheme/atheme
/* protocol-specific stuff to do on login */
static void asuka_on_login(user_t *u, myuser_t *account, const char *wantedhost)
{
    return_if_fail(u != NULL);

    sts("%s AC %s %s %lu", me.numeric, u->uid, entity(u->myuser)->name,
        (unsigned long)account->registered);
    check_hidehost(u);
}
示例#22
0
void ftk_widget_set_canvas(FtkWidget* thiz, FtkCanvas* canvas)
{
	return_if_fail(thiz != NULL && thiz->priv != NULL);

	thiz->priv->canvas = canvas;

	return;
}
示例#23
0
ret_t
cherokee_vrule_configure (cherokee_vrule_t       *vrule,
			  cherokee_config_node_t *conf,
			  void                   *vsrv)
{
	ret_t ret;

	return_if_fail (vrule, ret_error);
	return_if_fail (vrule->configure, ret_error);

	ret = configure_base (vrule, conf);
	if (ret != ret_ok) return ret;

	/* Call the real method
	 */
	return vrule->configure (vrule, conf, VSERVER(vsrv));
}
示例#24
0
void    ftk_widget_set_gc(FtkWidget* thiz, FtkWidgetState state, FtkGc* gc)
{
	return_if_fail(thiz != NULL && state < FTK_WIDGET_STATE_NR && gc != NULL);

	ftk_gc_copy(thiz->priv->gc+state, gc);

	return;
}
示例#25
0
void
mowgli_mutex_destroy(mowgli_mutex_t *mutex)
{
	return_if_fail(mutex != NULL);

	mowgli_mutex_uninit(mutex);
	mowgli_free(mutex);
}
示例#26
0
void ftk_widget_set_id(FtkWidget* thiz, int id)
{
	return_if_fail(thiz != NULL && thiz->priv != NULL);
	
	thiz->priv->id = id;

	return;
}
PRIVATE void add_circle_path(SvgCircleRenderObject* render_object, GraphicsPath* path){
	NUMBER cx, cy, radius;
	return_if_fail(render_object && path);
	cx = svg_circle_render_object_get_center_x(render_object);
	cy = svg_circle_render_object_get_center_y(render_object);
	radius = svg_circle_render_object_get_radius(render_object);
	path->AddEllipse(cx - radius, cy - radius, radius * 2, radius * 2);
}
示例#28
0
void ftk_widget_set_insensitive(FtkWidget* thiz, int insensitive)
{
	return_if_fail(thiz != NULL && thiz->priv != NULL);

	thiz->priv->state = insensitive ? FTK_WIDGET_INSENSITIVE : FTK_WIDGET_NORMAL;

	return;
}
示例#29
0
	void set_value(const k3d::double_t Value)
	{
		return_if_fail(m_writable_data);

		k3d::rectangle value = boost::any_cast<k3d::rectangle>(m_readable_data.property_internal_value());
		value.*m_value = Value;
		m_writable_data->property_set_value(value);
	}
static void
streaming_set_buffer_type (mm_player_streaming_t* streamer, gboolean use_file, gchar * file_path, guint64 content_size)
{
	guint64 storage_available_size = 0L; //bytes
	guint64 file_buffer_size = 0L;  //bytes
	gchar file_buffer_name[MAX_FILE_BUFFER_NAME_LEN] = {0};
	struct statfs buf = {0};

	debug_fenter();

	return_if_fail(streamer && streamer->buffer);

	if (!use_file)
	{
		debug_log("use memory for buffering. streaming is played on push-based. \n"
				"buffering position would not be updated.\n"
				"buffered data would be flushed after played.\n"
				"seeking and getting duration could be failed due to file format.");
		return;
	}

	debug_log("use file for buffering. streaming is played on pull-based. \n");

	if (!file_path || strlen(file_path) <= 0)
		file_path = g_strdup(DEFAULT_FILE_BUFFER_PATH);

	sprintf( file_buffer_name, "%s/XXXXXX", file_path );
	debug_log("the buffering file name is %s.\n", file_buffer_name);

	if (statfs((const char *)file_path, &buf) < 0)
	{
		debug_warning ("fail to get availabe storage capacity. just use file buffer.\n");
		file_buffer_size = 0L;
	}
	else
	{
		storage_available_size = (guint64)buf.f_bavail * (guint64)buf.f_bsize; //bytes

		debug_log ("the number of available blocks : %"G_GUINT64_FORMAT", the block size is %"G_GUINT64_FORMAT".\n",
			(guint64)buf.f_bavail, (guint64)buf.f_bsize);
		debug_log ("calculated availabe storage size is %"G_GUINT64_FORMAT" Bytes.\n", storage_available_size);

		if (content_size <= 0 || content_size >= storage_available_size)
			file_buffer_size = storage_available_size;
		else
			file_buffer_size = 0L;
	}

	if (file_buffer_size>0)
		debug_log("use file ring buffer for buffering.");

	g_object_set (G_OBJECT(streamer->buffer), "temp-template", file_buffer_name, NULL);
	g_object_set (G_OBJECT(streamer->buffer), "file-buffer-max-size", file_buffer_size, NULL);

	debug_fleave();

	return;
}