当前位置: 首页>>代码示例>>C++>>正文


C++ Media::unref方法代码示例

本文整理汇总了C++中Media::unref方法的典型用法代码示例。如果您正苦于以下问题:C++ Media::unref方法的具体用法?C++ Media::unref怎么用?C++ Media::unref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Media的用法示例。


在下文中一共展示了Media::unref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetMediaReffed

bool
Mp3Demuxer::RequestMoreData (MediaCallback *callback, guint32 count)
{
	guint64 start = 0;
	guint32 left = 0;
	guint64 previous_read_position = next_read_position;
	
	g_return_val_if_fail (!waiting_for_read, false);
	
	if (read_closure != NULL) {
		if (read_closure->GetCount () != read_closure->GetData ()->GetSize ()) {
			/* The last read didn't read everything we requested, so there is nothing more to read */
			LOG_MP3 ("Mp3Demuxer::RequestMoreData (): the last read didn't read everything we requested, so we reached eof.\n");
			return false;
		}
	
		gint64 position = read_closure->GetData ()->GetPosition ();	
		left = read_closure->GetData ()->GetRemainingSize ();
		start = read_closure->GetOffset () + position;
		read_closure->unref ();
		read_closure = NULL;
	}

	if (next_read_position != G_MAXUINT64) {
		start = next_read_position;
		next_read_position = G_MAXUINT64;
	}
	
	Media *media = GetMediaReffed ();
	read_closure = new MediaReadClosure (media, callback, this, start, count + left);
	media->unref ();
	
	LOG_MP3 ("Mp3Demuxer::RequestMoreData (%u) requesting: %u at offset %" G_GINT64_FORMAT " (left: %u next read position: %" G_GUINT64_FORMAT ")\n", 
		count, read_closure->GetCount (), read_closure->GetOffset (), left, previous_read_position);

	waiting_for_read = true;
	current_position = start;
	source->ReadAsync (read_closure);

	return true;
}
开发者ID:kangaroo,项目名称:moon,代码行数:41,代码来源:mp3.cpp


注:本文中的Media::unref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。