コード例 #1
0
ファイル: PipelineManager.cpp プロジェクト: xhy20070406/PDAL
boost::uint64_t PipelineManager::execute()
{
    if (!isWriterPipeline())
        throw pdal_error("This pipeline does not have a writer, unable to execute");
    getWriter()->initialize();
    return getWriter()->write(0);
}
コード例 #2
0
ファイル: item.cpp プロジェクト: HeberPcL/forgottenserver
bool Item::serializeAttr(PropWriteStream& propWriteStream) const
{
	if (isStackable() || isFluidContainer() || isSplash()) {
		uint8_t _count = getSubType();
		propWriteStream.ADD_UCHAR(ATTR_COUNT);
		propWriteStream.ADD_UCHAR(_count);
	}

	if (hasCharges()) {
		uint16_t _count = getCharges();
		propWriteStream.ADD_UCHAR(ATTR_CHARGES);
		propWriteStream.ADD_USHORT(_count);
	}

	if (!isNotMoveable()) {
		uint16_t _actionId = getActionId();
		if (_actionId) {
			propWriteStream.ADD_UCHAR(ATTR_ACTION_ID);
			propWriteStream.ADD_USHORT(_actionId);
		}
	}

	const std::string& _text = getText();
	if (!_text.empty()) {
		propWriteStream.ADD_UCHAR(ATTR_TEXT);
		propWriteStream.ADD_STRING(_text);
	}

	const time_t _writtenDate = getDate();
	if (_writtenDate > 0) {
		propWriteStream.ADD_UCHAR(ATTR_WRITTENDATE);
		propWriteStream.ADD_ULONG(_writtenDate);
	}

	const std::string& _writer = getWriter();
	if (!_writer.empty()) {
		propWriteStream.ADD_UCHAR(ATTR_WRITTENBY);
		propWriteStream.ADD_STRING(_writer);
	}

	const std::string& _specialDesc = getSpecialDescription();
	if (!_specialDesc.empty()) {
		propWriteStream.ADD_UCHAR(ATTR_DESC);
		propWriteStream.ADD_STRING(_specialDesc);
	}

	if (hasAttribute(ATTR_ITEM_DURATION)) {
		uint32_t duration = getDuration();
		propWriteStream.ADD_UCHAR(ATTR_DURATION);
		propWriteStream.ADD_ULONG(duration);
	}

	ItemDecayState_t decayState = getDecaying();
	if (decayState == DECAYING_TRUE || decayState == DECAYING_PENDING) {
		propWriteStream.ADD_UCHAR(ATTR_DECAYING_STATE);
		propWriteStream.ADD_UCHAR(decayState);
	}

	return true;
}
コード例 #3
0
ファイル: renderer.cpp プロジェクト: jorik041/alacarte
void Renderer::renderMetaTile(RenderAttributes& map, const shared_ptr<MetaTile>& tile)
{
	const shared_ptr<MetaIdentifier>& id = tile->getIdentifier();
	int width = id->getWidth() * TILE_SIZE;
	int height = id->getHeight() * TILE_SIZE;
	int zoom = id->getZoom();
	TileIdentifier::Format format = id->getIdentifiers()[0]->getImageFormat();

	shared_ptr<ImageWriter> writer = getWriter(format, width, height);

	FixedRect area;
	tileToMercator(id->getX(), id->getY(), zoom, area.minX, area.minY);
	tileToMercator(id->getX() + id->getWidth(),
				   id->getY() + id->getHeight(),
				   zoom, area.maxX, area.maxY);

#if OLD_CAIRO
	renderLock.lock();
#endif

	AssetCache cache;

	CairoLayer layers[LAYER_NUM];
	setupLayers(layers, writer, cache);

	paintBackground(layers[0], map.getCanvasStyle());

	renderArea(area, layers, width, height, map, cache);

#if OLD_CAIRO
	renderLock.unlock();
#endif

	tile->setData(layers[0].surface);
}
コード例 #4
0
ファイル: renderer.cpp プロジェクト: jorik041/alacarte
void Renderer::sliceTile(const shared_ptr<MetaTile>& meta, const shared_ptr<Tile>& tile) const
{
	const shared_ptr<MetaIdentifier>& mid = meta->getIdentifier();
	const Cairo::RefPtr<Cairo::Surface>& surface = meta->getData();
	int tx0 = mid->getX();
	int ty0 = mid->getY();

	surface->flush();

	shared_ptr<ImageWriter> writer = getWriter(mid->getImageFormat(), TILE_SIZE, TILE_SIZE);
	Tile::ImageType buffer = boost::make_shared<Tile::ImageType::element_type>();
	// optimized for png images in the default stylesheet
	buffer->reserve(10*1024);
	CairoLayer layer = CairoLayer(writer, buffer);

	const shared_ptr<TileIdentifier>& tid = tile->getIdentifier();
	int dx = (tid->getX() - tx0) * TILE_SIZE;
	int dy = (tid->getY() - ty0) * TILE_SIZE;

	layer.cr->set_source(surface, -dx, -dy);
	layer.cr->paint();

#if DEBUG_BUILD
	printTileId(layer.cr, tile->getIdentifier());
#endif

	writer->write(layer.surface);
	tile->setImage(buffer);
}
コード例 #5
0
ファイル: renderer.cpp プロジェクト: jorik041/alacarte
void Renderer::renderEmptyTile(RenderAttributes& map, const shared_ptr<Tile>& tile)
{
	const shared_ptr<TileIdentifier>& id = tile->getIdentifier();
	shared_ptr<ImageWriter> writer = getWriter(id->getImageFormat(), TILE_SIZE, TILE_SIZE);

	Tile::ImageType buffer = boost::make_shared<Tile::ImageType::element_type>();
	// optimized for png images in the default stylesheet
	buffer->reserve(10*1024);

#if OLD_CAIRO
	renderLock.lock();
#endif

	CairoLayer layer(writer, buffer);
	paintBackground(layer, map.getCanvasStyle());

#if DEBUG_BUILD
	printTileId(layer.cr, tile->getIdentifier());
#endif

#if OLD_CAIRO
	renderLock.unlock();
#endif

	writer->write(layer.surface);
	tile->setImage(buffer);
}
コード例 #6
0
ファイル: Filesystem.cpp プロジェクト: gabloe/RapidStash
// Remove a file from the filesystem
bool STORAGE::Filesystem::unlink(File f) {
	std::string thisName;
	bool merged = false;
	lock(f, IO::EXCLUSIVE);
	{
		// Save info about the file
		FilePosition pos = dir->files[f];
		FileSize size = dir->headers[f].size;
		FileSize vsize = dir->headers[f].virtualSize;
		thisName = std::string(dir->headers[f].name);

		// Overwrite the file with the last file
		FilePosition lastFilePos = dir->files[dir->numFiles - 1];
		FileHeader lastFileHeader = readHeader(lastFilePos);
		File &lastFile = lookup[std::string(lastFileHeader.name)];
		lock(lastFile, IO::EXCLUSIVE);
		{
			dir->files[f] = dir->files[lastFile];
			dir->headers[f] = dir->headers[lastFile];
			dir->locks[f] = dir->locks[lastFile];
			lookup[std::string(dir->headers[lastFile].name)] = f;
		}
		unlock(lastFile, IO::EXCLUSIVE);

		// Validate that the next header is valid.  Otherwise we cannot reclaim the space.
		FileHeader nextHeader = readHeader(pos + size + FileHeader::SIZE);
		if (strcmp(nextHeader.name, "") != 0 ||
			lookup.find(std::string(nextHeader.name, strlen(nextHeader.name))) != lookup.end()) {
			File nextFile = lookup[std::string(nextHeader.name)];
			FileHeader &nextFileHeader = dir->headers[nextFile];
			auto reader = getReader(nextFile);
			auto writer = getWriter(nextFile);
			lock(nextFile, IO::EXCLUSIVE);
			{
				char *buf = reader.readRaw();
				dir->files[nextFile] = pos;	// Update the file position
				dir->headers[nextFile].virtualSize += vsize + FileHeader::SIZE;
				writer.write(buf, nextFileHeader.size);
				writeHeader(nextFile);
			}
			unlock(nextFile, IO::EXCLUSIVE);
			merged = true;
		}
	}
	unlock(f, IO::EXCLUSIVE);

	// Remove the lookup info and fix the directory metadata
	{
		std::unique_lock<std::mutex> lk(dirLock);
		lookup.erase(thisName);
		dir->numFiles--;
		dir->nextSpot--;
	}

	return merged;
}
コード例 #7
0
ファイル: linuxdvb.c プロジェクト: FFTEAM/evolux-spark-sh4
static int reset(Context_t  *context)
{
	int ret = cERR_LINUXDVB_NO_ERROR;
	Writer_t*   writer = NULL;
	char * Encoding = NULL;

	context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);

	writer = getWriter(Encoding);

	if (writer == NULL)
	{
		linuxdvb_err("unknown video codec %s\n",Encoding);
		ret = cERR_LINUXDVB_ERROR;
	} 
	else
	{
		writer->reset();
	}

	free(Encoding);

	context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);

	writer = getWriter(Encoding);

	if (writer == NULL)
	{
		linuxdvb_err("unknown audio codec %s\n",Encoding);
		ret = cERR_LINUXDVB_ERROR;
	} 
	else
	{
		writer->reset();
	}

	free(Encoding);

	return ret;
}
コード例 #8
0
void CanvasProcessor::saveImageLayer(std::string snapshotPath) {
    if (auto layer = getSelectedLayer()) {
        if (auto writer = getWriter(filesystem::getFileExtension(snapshotPath))) {
            try {
                writer->setOverwrite(true);
                writer->writeData(layer, snapshotPath);
                LogInfo("Canvas layer exported to disk: " << snapshotPath);
            } catch (DataWriterException const& e) {
                LogError(e.getMessage());
            }
        } else {
            LogError("Error: Could not find a writer for the specified extension and data type");
        }
    } else {
        LogError("Error: Could not find a layer to write out");
    }
}
コード例 #9
0
std::unique_ptr<std::vector<unsigned char>> CanvasProcessor::getLayerAsCodedBuffer(
    LayerType layerType, std::string& type, size_t idx) {
    if (!inport_.hasData()) return nullptr;
    auto image = inport_.getData();
    
    if (auto layer = image->getLayer(layerType, idx)) {
        if (auto writer = getWriter(type)) {
            try {
                return writer->writeDataToBuffer(layer, type);
            } catch (DataWriterException const& e) {
                LogError(e.getMessage());
            }
        } else {
            LogError("Error: Could not find a writer for the specified data type");
        }
    } else {
        LogError("Error: Could not find layer to write");
    }

    return nullptr;
}
コード例 #10
0
void VerbatimXmlComponent::renderBegin() const {
	auto context = getContext();

	auto attribs = getRenderAttributes(context);

	/*we ALWAYS use the provided id for plain xml tags, regardless of naming
	 *containers etc. this means plain html will always work as expected - and
	 *no plain html component needs its id for anything other than css!*/
	auto& id = attribs["id"];
	auto sepPos = id.find_last_of(Component::NAMING_SEPARATOR);
	if (sepPos != id.npos) {
		id = id.substr(sepPos + 1);
	}
	
	//the root element needs to declare the xhtml namespace
	if (getTagName() == "html"
		&& attribs.find("xmlns") == attribs.end()) {
		attribs["xmlns"] = "http://www.w3.org/1999/xhtml";
	}

	getWriter() <<"<" <<impl->getOriginalTag() <<Util::toString(attribs) <<">"
			<<context->evaluateString(getTextValue());
}
コード例 #11
0
ファイル: item.cpp プロジェクト: cp1337/devland
xmlNodePtr Item::serialize()
{
	xmlNodePtr nodeItem = xmlNewNode(NULL,(const xmlChar*)"item");

	std::stringstream ss;
	ss.str("");
	ss << getID();
	xmlSetProp(nodeItem, (const xmlChar*)"id", (const xmlChar*)ss.str().c_str());

	if(hasSubType()){
		ss.str("");
		ss << (int32_t)getSubType();
		xmlSetProp(nodeItem, (const xmlChar*)"count", (const xmlChar*)ss.str().c_str());
	}

	if(getSpecialDescription() != ""){
		ss.str("");
		ss << getSpecialDescription();
		xmlSetProp(nodeItem, (const xmlChar*)"special_description", (const xmlChar*)ss.str().c_str());
	}


	if(getText() != ""){
		ss.str("");
		ss << getText();
		xmlSetProp(nodeItem, (const xmlChar*)"text", (const xmlChar*)ss.str().c_str());
	}

	if(getWrittenDate() != 0){
		ss.str("");
		ss << getWrittenDate();
		xmlSetProp(nodeItem, (const xmlChar*)"written_date", (const xmlChar*)ss.str().c_str());
	}

	if(getWriter() != ""){
		ss.str("");
		ss << getWriter();
		xmlSetProp(nodeItem, (const xmlChar*)"writer", (const xmlChar*)ss.str().c_str());
	}

	if(!isNotMoveable() /*moveable*/){
		if(getActionId() != 0){
			ss.str("");
			ss << getActionId();
			xmlSetProp(nodeItem, (const xmlChar*)"actionId", (const xmlChar*)ss.str().c_str());
		}
	}

	if(hasAttribute(ATTR_ITEM_DURATION)){
		uint32_t duration = getDuration();
		ss.str("");
		ss << duration;
		xmlSetProp(nodeItem, (const xmlChar*)"duration", (const xmlChar*)ss.str().c_str());
	}

	uint32_t decayState = getDecaying();
	if(decayState == DECAYING_TRUE || decayState == DECAYING_PENDING){
		ss.str("");
		ss << decayState;
		xmlSetProp(nodeItem, (const xmlChar*)"decayState", (const xmlChar*)ss.str().c_str());
	}

	return nodeItem;
}
コード例 #12
0
 void writeFact(const Predicate &pred,
                const refmode_t &refmode,
                const V& val, const Vs&... vals)
 {
     getWriter(pred)->write(refmode, val, vals...);
 }
コード例 #13
0
ファイル: linuxdvb.c プロジェクト: FFTEAM/evolux-spark-sh4
// Write to decoder
static int Write(void  *_context, void* _out)
{
	Context_t          *context  = (Context_t  *) _context;
	AudioVideoOut_t    *out      = (AudioVideoOut_t*) _out;
	int                ret       = cERR_LINUXDVB_NO_ERROR;
	int                res       = 0;
	unsigned char      video     = 0;
	unsigned char      audio     = 0;
	Writer_t *          writer = NULL;
	WriterAVCallData_t call;

	if (out == NULL)
	{
		linuxdvb_err("null pointer passed\n");
		return cERR_LINUXDVB_ERROR;
	}
    
	video = !strcmp("video", out->type);
	audio = !strcmp("audio", out->type);
  
	linuxdvb_printf(20, "DataLength=%u PrivateLength=%u Pts=%llu FrameRate=%f\n", 
                                                    out->len, out->extralen, out->pts, out->frameRate);
	linuxdvb_printf(20, "v%d a%d\n", video, audio);

	if (video) 
	{
		char * Encoding = NULL;
		context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);

		linuxdvb_printf(20, "Encoding = %s\n", Encoding);

		writer = getWriter(Encoding);

		if (writer == NULL)
		{
			linuxdvb_printf(20, "searching default writer ... %s\n", Encoding);
			writer = getDefaultVideoWriter();
		}

		if (writer == NULL)
		{
			linuxdvb_err("unknown video codec and no default writer %s\n",Encoding);
			ret = cERR_LINUXDVB_ERROR;
		} 
		else
		{
			call.fd           = videofd;
			call.data         = out->data;
			call.len          = out->len;
			call.Pts          = out->pts;
			call.private_data = out->extradata;
			call.private_size = out->extralen;
			call.FrameRate    = out->frameRate;
			call.FrameScale   = out->timeScale;
			call.Width        = out->width;
			call.Height       = out->height;
			call.Version      = 0; // is unsingned char

			if (writer->writeData)
				res = writer->writeData(&call);

			if (res <= 0)
			{
				linuxdvb_err("failed to write data %d - %d\n", res, errno);
				linuxdvb_err("%s\n", strerror(errno));
				ret = cERR_LINUXDVB_ERROR;
			}
		}

		free(Encoding);
	} 
	else if (audio) 
	{
		char * Encoding = NULL;
		context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);

		linuxdvb_printf(20, "%s::%s Encoding = %s\n", FILENAME, __FUNCTION__, Encoding);

		writer = getWriter(Encoding);

		if (writer == NULL)
		{
			linuxdvb_printf(20, "searching default writer ... %s\n", Encoding);
			writer = getDefaultAudioWriter();
		}

		if (writer == NULL)
		{
			linuxdvb_err("unknown audio codec %s and no default writer\n",Encoding);
			ret = cERR_LINUXDVB_ERROR;
		} 
		else
		{
			call.fd             = audiofd;
			call.data           = out->data;
			call.len            = out->len;
			call.Pts            = out->pts;
			call.private_data   = out->extradata;
			call.private_size   = out->extralen;
			call.FrameRate      = out->frameRate;
			call.FrameScale     = out->timeScale;
			call.Version        = 0; /* -1; unsigned char cannot be negative */

			if (writer->writeData)
				res = writer->writeData(&call);

			if (res <= 0)
			{
				linuxdvb_err("failed to write data %d - %d\n", res, errno);
				linuxdvb_err("%s\n", strerror(errno));
				ret = cERR_LINUXDVB_ERROR;
			}
		}

		free(Encoding);
	}

	return ret;
}
コード例 #14
0
void VolumeSerializer::save(const std::string& filename, VolumeHandle* volumeHandle) const throw (tgt::FileException)
{
    VolumeWriter* writer = getWriter(filename);
    writer->write(filename, volumeHandle);
}
コード例 #15
0
 void writeFact(const Predicate &pred,
                const refmode_t &refmode)
 {
     getWriter(pred)->write(refmode);
 }
コード例 #16
0
ファイル: linuxdvb.c プロジェクト: FFTEAM/evolux-spark-sh4
int LinuxDvbPlay(Context_t  *context, char * type) 
{
	int ret = cERR_LINUXDVB_NO_ERROR;
	Writer_t * writer = NULL;

	unsigned char video = !strcmp("video", type);
	unsigned char audio = !strcmp("audio", type);

	linuxdvb_printf(10, "v%d a%d\n", video, audio);

	if (video && videofd != -1) 
	{
		char * Encoding = NULL;
		context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);

		linuxdvb_printf(10, "V %s\n", Encoding);

		writer = getWriter(Encoding);

		if (writer == NULL)
		{
			linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
#ifdef __sh__			
			if (ioctl( videofd, VIDEO_SET_ENCODING, (void*) VIDEO_ENCODING_AUTO) == -1)
#else
			if (ioctl( videofd, VIDEO_SET_STREAMTYPE, (VIDEO_FORMAT) VIDEO_STREAMTYPE_MPEG2 ) == -1)
#endif			  
			{
				linuxdvb_err("ioctl failed with errno %d\n", errno);
				linuxdvb_err("VIDEO_SET_ENCODING: %s\n", strerror(errno));
				ret = cERR_LINUXDVB_ERROR;
			}
		} 
		else
		{
			linuxdvb_printf(20, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
			
#ifdef __sh__			
			if (ioctl( videofd, VIDEO_SET_ENCODING, (void*) writer->caps->dvbEncoding) == -1)
#else
			if (ioctl( videofd, VIDEO_SET_STREAMTYPE, (VIDEO_FORMAT) writer->caps->dvbEncoding) == -1)
#endif
			{
				linuxdvb_err("ioctl failed with errno %d\n", errno);
				linuxdvb_err("VIDEO_SET_ENCODING: %s\n", strerror(errno));
				ret = cERR_LINUXDVB_ERROR;
			}
			
		}

		if (ioctl(videofd, VIDEO_PLAY, NULL) == -1)
		{
			linuxdvb_err("ioctl failed with errno %d\n", errno);
			linuxdvb_err("VIDEO_PLAY: %s\n", strerror(errno));
			ret = cERR_LINUXDVB_ERROR;
		}
		free(Encoding);
	}
	
	if (audio && audiofd != -1) 
	{
		char * Encoding = NULL;
		context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);

		linuxdvb_printf(20, "0 A %s\n", Encoding);

		writer = getWriter(Encoding);

		if (writer == NULL)
		{
			linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
			
#ifdef __sh__			
			if (ioctl( audiofd, AUDIO_SET_ENCODING, (void*)AUDIO_ENCODING_MP3) == -1)
#else
			if (ioctl( audiofd, AUDIO_SET_BYPASS_MODE, (AUDIO_FORMAT)AUDIO_STREAMTYPE_MPEG) == -1)
#endif
			{
				linuxdvb_err("ioctl failed with errno %d\n", errno);
				linuxdvb_err("AUDIO_SET_ENCODING: %s\n", strerror(errno));
				ret = cERR_LINUXDVB_ERROR;
			}
		} 
		else
		{
			linuxdvb_printf(20, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
			
#ifdef __sh__			
			if (ioctl( audiofd, AUDIO_SET_ENCODING, (void*) writer->caps->dvbEncoding) == -1)
#else
			if (ioctl( audiofd, AUDIO_SET_BYPASS_MODE, (AUDIO_FORMAT) writer->caps->dvbEncoding) == -1)
#endif
			{
				linuxdvb_err("ioctl failed with errno %d\n", errno);
				linuxdvb_err("AUDIO_SET_ENCODING: %s\n", strerror(errno));
				ret = -1;
			}		
		}

		if (ioctl(audiofd, AUDIO_PLAY, NULL) == -1)
		{
			linuxdvb_err("ioctl failed with errno %d\n", errno);
			linuxdvb_err("AUDIO_PLAY: %s\n", strerror(errno));
			ret = cERR_LINUXDVB_ERROR;
		}
		free(Encoding);
	}

	return ret;
}
コード例 #17
0
ファイル: linuxdvb.c プロジェクト: FFTEAM/evolux-spark-sh4
int LinuxDvbSwitch(Context_t  *context, char * type) 
{
	unsigned char audio = !strcmp("audio", type);
	unsigned char video = !strcmp("video", type);
	Writer_t * writer = NULL;

	linuxdvb_printf(10, "v%d a%d\n", video, audio);

	if ( (video && videofd != -1) || (audio && audiofd != -1) ) 
	{
		getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);

		if (audio && audiofd != -1) 
		{
			char * Encoding = NULL;
			if (context && context->manager && context->manager->audio) 
			{
				context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);

				linuxdvb_printf(10, "A %s\n", Encoding);

				writer = getWriter(Encoding);

				if (ioctl(audiofd, AUDIO_STOP ,NULL) == -1)
				{
					linuxdvb_err("ioctl failed with errno %d\n", errno);
					linuxdvb_err("AUDIO_STOP: %s\n", strerror(errno));
				}
				
				#if 0 //FIXME: do we need really to clear buffer ???
				if (ioctl(audiofd, AUDIO_CLEAR_BUFFER ,NULL) == -1)
				{
					linuxdvb_err("ioctl failed with errno %d\n", errno);
					linuxdvb_err("AUDIO_CLEAR_BUFFER: %s\n", strerror(errno));
				}
				#endif
				
				if (writer == NULL)
				{
					linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
					
#ifdef __sh__					
					if (ioctl( audiofd, AUDIO_SET_ENCODING, (void*) AUDIO_ENCODING_MP3) == -1)
#else
					if (ioctl( audiofd, AUDIO_SET_BYPASS_MODE, (AUDIO_FORMAT) AUDIO_STREAMTYPE_MPEG) == -1)
#endif
					{
						linuxdvb_err("ioctl failed with errno %d\n", errno);
						linuxdvb_err("AUDIO_SET_ENCODING: %s\n", strerror(errno));
					}
				} 
				else
				{
					linuxdvb_printf(10, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
					
#ifdef __sh__					
					if (ioctl( audiofd, AUDIO_SET_ENCODING, (void*) writer->caps->dvbEncoding) == -1)
#else
					if (ioctl( audiofd, AUDIO_SET_BYPASS_MODE, (AUDIO_FORMAT) writer->caps->dvbEncoding) == -1)
#endif
					{
						linuxdvb_err("ioctl failed with errno %d\n", errno);
						linuxdvb_err("AUDIO_SET_ENCODING: %s\n", strerror(errno));
					}				
				}

				if (ioctl(audiofd, AUDIO_PLAY, NULL) == -1)
				{
					linuxdvb_err("ioctl failed with errno %d\n", errno);
					linuxdvb_err("AUDIO_PLAY: %s\n", strerror(errno));
				}
				free(Encoding);
			}
			else
				linuxdvb_printf(20, "no context for Audio\n");
		}

		if (video && videofd != -1) 
		{
			char * Encoding = NULL;
			if (context && context->manager && context->manager->video) 
			{
				context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);

				if (ioctl(videofd, VIDEO_STOP ,NULL) == -1)
				{
					linuxdvb_err("ioctl failed with errno %d\n", errno);
					linuxdvb_err("VIDEO_STOP: %s\n", strerror(errno));
				}

				#if 0 //FIXME: do we need this ???
				if (ioctl(videofd, VIDEO_CLEAR_BUFFER ,NULL) == -1)
				{
					linuxdvb_err("ioctl failed with errno %d\n", errno);
					linuxdvb_err("VIDEO_CLEAR_BUFFER: %s\n", strerror(errno));
				}
				#endif

				linuxdvb_printf(10, "V %s\n", Encoding);

				writer = getWriter(Encoding);

				if (writer == NULL)
				{
					linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
					
#ifdef __sh__					
					if (ioctl( videofd, VIDEO_SET_ENCODING, (void*) VIDEO_ENCODING_AUTO) == -1)
#else
					if (ioctl( videofd, VIDEO_SET_STREAMTYPE, (VIDEO_FORMAT)VIDEO_STREAMTYPE_MPEG2 ) == -1)
#endif
					{
						linuxdvb_err("ioctl failed with errno %d\n", errno);
						linuxdvb_err("VIDEO_SET_ENCODING: %s\n", strerror(errno));
					}
				} 
				else
				{
					linuxdvb_printf(10, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
					
#ifdef __sh__					
					if (ioctl( videofd, VIDEO_SET_ENCODING, (void*) writer->caps->dvbEncoding) == -1)
#else
					if (ioctl( videofd, VIDEO_SET_STREAMTYPE, (VIDEO_FORMAT) writer->caps->dvbEncoding) == -1)
#endif
					{
						linuxdvb_err("ioctl failed with errno %d\n", errno);
						linuxdvb_err("VIDEO_SET_ENCODING: %s\n", strerror(errno));
					}					
				}

				if (ioctl(videofd, VIDEO_PLAY, NULL) == -1)
				{
					/* konfetti: fixme: think on this, I think we should
					* return an error here and stop the playback mode
					*/
					linuxdvb_err("ioctl failed with errno %d\n", errno);
					linuxdvb_err("VIDEO_PLAY: %s\n", strerror(errno));
				}
				free(Encoding);
			}
			else
				linuxdvb_printf(20, "no context for Video\n");
		}

		releaseLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
	}

	linuxdvb_printf(10, "exiting\n");

	return cERR_LINUXDVB_NO_ERROR;
}
コード例 #18
0
ファイル: CFilterBuffer.cpp プロジェクト: pombredanne/Depth
/*--------------------------------------------------------------------------*/
Tbool CFilterBuffer::setReadBuffer(const Tuint a_cSize, const Tbool a_cStatic)
{ CALL
  // Check if the current reader is disconnected or not opened.
  ASSERT(((getReader() == NULL) || !getReader()->isOpened()), STR("Cannot set read buffer parameters for opened reader."))
  {
    return false;
  }

  return m_ReadBuffer.set(a_cSize, a_cStatic);
}
/*--------------------------------------------------------------------------*/
Tbool CFilterBuffer::setWriteBuffer(const Tuint a_cSize, const Tbool a_cStatic)
{ CALL
  // Check if the current writer is disconnected or not opened.
  ASSERT(((getWriter() == NULL) || !getWriter()->isOpened()), STR("Cannot set write buffer parameters for opened writer."))
  {
    return false;
  }

  return m_WriteBuffer.set(a_cSize, a_cStatic);
}
/*--------------------------------------------------------------------------*/
Tbool CFilterBuffer::onOpen(const EOpenType a_cOpenType)
{ CALL
  // Try to open base filter.
  if (!IFilter::onOpen(a_cOpenType))
    return false;

  // Reset sizes of the buffers.
  m_ReadBufferIndex = 0;
コード例 #19
0
void VerbatimXmlComponent::renderEnd() const {
	getWriter() <<"</" <<impl->getOriginalTag() <<">";
}
コード例 #20
0
ファイル: ProxyPort.hpp プロジェクト: jmachowinski/orocos_cpp
 RTT::OutputPort<T> &getWriter()
 {
     return getWriter(port->getDefaultPolicy());
 }