这篇教程C++ writeTag函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中writeTag函数的典型用法代码示例。如果您正苦于以下问题:C++ writeTag函数的具体用法?C++ writeTag怎么用?C++ writeTag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了writeTag函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: getTrackstatus CAFFile::writeDescription(){ Track *track = getTrack(); Tag desc("desc"); int64_t chunkLength = 32; double sampleRate = track->f.sampleRate; Tag formatID("lpcm"); uint32_t formatFlags = 0; if (track->f.byteOrder == AF_BYTEORDER_LITTLEENDIAN) formatFlags |= kCAFLinearPCMFormatFlagIsLittleEndian; if (track->f.isFloat()) formatFlags |= kCAFLinearPCMFormatFlagIsFloat; uint32_t bytesPerPacket = track->f.bytesPerFrame(false); uint32_t framesPerPacket = 1; uint32_t channelsPerFrame = track->f.channelCount; uint32_t bitsPerChannel = track->f.sampleWidth; if (track->f.compressionType == AF_COMPRESSION_G711_ULAW) { formatID = "ulaw"; formatFlags = 0; bytesPerPacket = channelsPerFrame; bitsPerChannel = 8; } else if (track->f.compressionType == AF_COMPRESSION_G711_ALAW) { formatID = "alaw"; formatFlags = 0; bytesPerPacket = channelsPerFrame; bitsPerChannel = 8; } else if (track->f.compressionType == AF_COMPRESSION_IMA) { formatID = "ima4"; formatFlags = 0; bytesPerPacket = track->f.bytesPerPacket; framesPerPacket = track->f.framesPerPacket; bitsPerChannel = 16; } if (!writeTag(&desc) || !writeS64(&chunkLength) || !writeDouble(&sampleRate) || !writeTag(&formatID) || !writeU32(&formatFlags) || !writeU32(&bytesPerPacket) || !writeU32(&framesPerPacket) || !writeU32(&channelsPerFrame) || !writeU32(&bitsPerChannel)) return AF_FAIL; return AF_SUCCEED;}
开发者ID:AlexandreRio,项目名称:weatherfax_pi,代码行数:53,
示例2: applyToAllTracksvoidTagDialog::saveTags(){ if( !m_perTrack ) { applyToAllTracks(); } else { storeTags(); } QMap<QString, MetaBundle>::ConstIterator endStore( storedTags.end() ); for(QMap<QString, MetaBundle>::ConstIterator it = storedTags.begin(); it != endStore; ++it ) { if( writeTag( it.data(), it == --storedTags.end() ) ) //update the collection browser if it's the last track Playlist::instance()->updateMetaData( it.data() ); else amaroK::StatusBar::instance()->longMessage( i18n( "Sorry, the tag for %1 could not be changed." ).arg( it.data().prettyURL() ), KDE::StatusBar::Error ); } QMap<QString, int>::ConstIterator endScore( storedScores.end() ); for(QMap<QString, int>::ConstIterator it = storedScores.begin(); it != endScore; ++it ) { CollectionDB::instance()->setSongPercentage( it.key(), it.data() ); } QMap<QString, int>::ConstIterator endRating( storedRatings.end() ); for(QMap<QString, int>::ConstIterator it = storedRatings.begin(); it != endRating; ++it ) { CollectionDB::instance()->setSongRating( it.key(), it.data() ); } QMap<QString, QString>::ConstIterator endLyrics( storedLyrics.end() ); for(QMap<QString, QString>::ConstIterator it = storedLyrics.begin(); it != endLyrics; ++it ) { CollectionDB::instance()->setLyrics( it.key(), it.data() ); emit lyricsChanged( it.key() ); }}
开发者ID:tmarques,项目名称:waheela,代码行数:34,
示例3: StringLogger FatalLogger::FatalLogger(SeverityType theSeverity, const char* theSourceFile, int theSourceLine, int theExitCode) : StringLogger(false, theExitCode) { // Create a tag for this fatal log message in our string stream writeTag(getStream(), theSeverity, theSourceFile, theSourceLine); }
开发者ID:Jose-Luis,项目名称:age,代码行数:7,
示例4: writeTagvoid FileLogger::logMessage(SeverityType severity, const char* sourceFile, int sourceLine, const char* message){ if(mFileStream.is_open()) { writeTag(mFileStream, severity, sourceFile, sourceLine); mFileStream << message << std::endl << std::endl; }}
开发者ID:juliencombattelli,项目名称:Project-RPG,代码行数:8,
示例5: /** * @brief Write the user data to the tag * * @param data Array of 16 bytes of user data * @returns True if commands could be sent to device */bool RWDH2::writeTagUserData(uint8_t* data) { for (uint8_t i = 0; i < 4; i++) { if (!writeTag(4+i, &data[i*4])) { return false; } } return true;}
开发者ID:ennui2342,项目名称:arduino-RWDH2,代码行数:14,
示例6: writeTag void FileLogger::logMessage( SeverityType severity, const std::string& sourceFile, int theSourceLine, const std::string& message ) { if(mFileStream.is_open() && isActive()) { writeTag(mFileStream, severity, sourceFile, theSourceLine); mFileStream << message << std::endl; } }
开发者ID:Ostkaka,项目名称:MGE,代码行数:8,
示例7: writeTag void StringLogger::logMessage( SeverityType theSeverity, const std::string& sourceFile, int sourceLine, const std::string& message ) { if(isActive()) { writeTag(mStringStream, theSeverity, sourceFile, sourceLine); mStringStream << message << std::endl; } }
开发者ID:Ostkaka,项目名称:ANT,代码行数:8,
示例8: appendTags void appendTags( QXmlStreamWriter &stream, const Billon &billon ) { stream.writeStartElement("tags"); writeTag(stream,"width",QString::number(billon.n_cols)); writeTag(stream,"height",QString::number(billon.n_rows)); writeTag(stream,"depth",QString::number(billon.n_slices)); writeTag(stream,"xspacing",QString::number(billon.voxelWidth())); writeTag(stream,"yspacing",QString::number(billon.voxelHeight())); writeTag(stream,"zspacing",QString::number(billon.voxelDepth())); writeTag(stream,"voxelwidth",QString::number(billon.voxelWidth())); writeTag(stream,"voxelheight",QString::number(billon.voxelHeight())); writeTag(stream,"voxeldepth",QString::number(billon.voxelDepth())); stream.writeEndElement(); }
开发者ID:kerautret,项目名称:TKDetection,代码行数:14,
示例9: writeTagvoid MyMoneyStorageXML::writeTags(QDomElement& tags){ const QList<MyMoneyTag> list = m_storage->tagList(); QList<MyMoneyTag>::ConstIterator it; tags.setAttribute("count", list.count()); for (it = list.begin(); it != list.end(); ++it) writeTag(tags, *it);}
开发者ID:CGenie,项目名称:kmymoney,代码行数:9,
示例10: writeTagvoid XMLWriter::breakLine() { if (!_openTags.empty()) { _openTags.back().empty = false; writeTag(); } _stream->writeString("/n"); _needIndent = true;}
开发者ID:EffWun,项目名称:xoreos-tools,代码行数:9,
示例11: indentvoid XMLWriter::openTag(const Common::UString &name) { if (!_openTags.empty()) { _openTags.back().empty = false; indent(_openTags.size()); writeTag(); } _openTags.push_back(Tag()); Tag &tag = _openTags.back(); tag.name = name; tag.empty = true;}
开发者ID:EffWun,项目名称:xoreos-tools,代码行数:15,
示例12: switch/* WriteMiscellaneous writes all the miscellaneous data chunks in a file handle structure to an IFF/8SVX file.*/status IFFFile::writeMiscellaneous(){ if (m_miscellaneousPosition == 0) m_miscellaneousPosition = m_fh->tell(); else m_fh->seek(m_miscellaneousPosition, File::SeekFromBeginning); for (int i=0; i<m_miscellaneousCount; i++) { Miscellaneous *misc = &m_miscellaneous[i]; Tag chunkType; uint32_t chunkSize; uint8_t padByte = 0; switch (misc->type) { case AF_MISC_NAME: chunkType = "NAME"; break; case AF_MISC_AUTH: chunkType = "AUTH"; break; case AF_MISC_COPY: chunkType = "(c) "; break; case AF_MISC_ANNO: chunkType = "ANNO"; break; } writeTag(&chunkType); chunkSize = misc->size; writeU32(&chunkSize); /* Write the miscellaneous buffer and then a pad byte if necessary. If the buffer is null, skip the space for now. */ if (misc->buffer != NULL) m_fh->write(misc->buffer, misc->size); else m_fh->seek(misc->size, File::SeekFromCurrent); if (misc->size % 2 != 0) writeU8(&padByte); } return AF_SUCCEED;}
开发者ID:Distrotech,项目名称:audiofile,代码行数:51,
示例13: initCompressionParamsstatus CAFFile::writeInit(AFfilesetup setup){ if (initFromSetup(setup) == AF_FAIL) return AF_FAIL; initCompressionParams(); Tag caff("caff"); if (!writeTag(&caff)) return AF_FAIL; const uint8_t versionAndFlags[4] = { 0, 1, 0, 0 }; if (m_fh->write(versionAndFlags, 4) != 4) return AF_FAIL; if (writeDescription() == AF_FAIL) return AF_FAIL; if (writeData(false) == AF_FAIL) return AF_FAIL; return AF_SUCCEED;}
开发者ID:AlexandreRio,项目名称:weatherfax_pi,代码行数:19,
示例14: sprintf//---------------------------------------------------------int ofXMLSettings::setValue(string tag, double value, int which){ char valueStr[255]; sprintf(valueStr, "%f", value); int tagID = writeTag(tag, valueStr, which) -1; return tagID;}
开发者ID:LeonFedotov,项目名称:L.A.S.E.R.-TAG-GRL,代码行数:7,
示例15: writeTag//---------------------------------------------------------int ofxXmlSettings::addValue(const string& tag, double value){ int tagID = writeTag(tag, ofToString(value, floatPrecision).c_str(), -1) -1; return tagID;}
开发者ID:AnnaKolla,项目名称:openFrameworks,代码行数:5,
示例16: writeLibTiff//.........这里部分代码省略......... { if (depth == CV_8U) icvCvt_BGR2RGB_8u_C3R( img.data + img.step*y, 0, buffer, 0, cvSize(width,1) ); else icvCvt_BGR2RGB_16u_C3R( (const ushort*)(img.data + img.step*y), 0, (ushort*)buffer, 0, cvSize(width,1) ); } else { if( channels == 4 ) { if (depth == CV_8U) icvCvt_BGRA2RGBA_8u_C4R( img.data + img.step*y, 0, buffer, 0, cvSize(width,1) ); else icvCvt_BGRA2RGBA_16u_C4R( (const ushort*)(img.data + img.step*y), 0, (ushort*)buffer, 0, cvSize(width,1) ); } } strm.putBytes( channels > 1 ? buffer : img.data + img.step*y, fileStep ); } stripCounts[i] = (short)(strm.getPos() - stripOffsets[i]); /*assert( stripCounts[i] == uncompressedRowSize || stripCounts[i] < uncompressedRowSize && i == stripCount - 1);*/ } if( stripCount > 2 ) { stripOffsetsOffset = strm.getPos(); for( i = 0; i < stripCount; i++ ) strm.putDWord( stripOffsets[i] ); stripCountsOffset = strm.getPos(); for( i = 0; i < stripCount; i++ ) strm.putWord( stripCounts[i] ); } else if(stripCount == 2) { stripOffsetsOffset = strm.getPos(); for (i = 0; i < stripCount; i++) { strm.putDWord (stripOffsets [i]); } stripCountsOffset = stripCounts [0] + (stripCounts [1] << 16); } else { stripOffsetsOffset = stripOffsets[0]; stripCountsOffset = stripCounts[0]; } if( channels > 1 ) { int bitsPerSamplePos = strm.getPos(); strm.putWord(bitsPerSample); strm.putWord(bitsPerSample); strm.putWord(bitsPerSample); if( channels == 4 ) strm.putWord(bitsPerSample); bitsPerSample = bitsPerSamplePos; } directoryOffset = strm.getPos(); // write header strm.putWord( 9 ); /* warning: specification 5.0 of Tiff want to have tags in ascending order. This is a non-fatal error, but this cause warning with some tools. So, keep this in ascending order */ writeTag( strm, TIFF_TAG_WIDTH, TIFF_TYPE_LONG, 1, width ); writeTag( strm, TIFF_TAG_HEIGHT, TIFF_TYPE_LONG, 1, height ); writeTag( strm, TIFF_TAG_BITS_PER_SAMPLE, TIFF_TYPE_SHORT, channels, bitsPerSample ); writeTag( strm, TIFF_TAG_COMPRESSION, TIFF_TYPE_LONG, 1, TIFF_UNCOMP ); writeTag( strm, TIFF_TAG_PHOTOMETRIC, TIFF_TYPE_SHORT, 1, channels > 1 ? 2 : 1 ); writeTag( strm, TIFF_TAG_STRIP_OFFSETS, TIFF_TYPE_LONG, stripCount, stripOffsetsOffset ); writeTag( strm, TIFF_TAG_SAMPLES_PER_PIXEL, TIFF_TYPE_SHORT, 1, channels ); writeTag( strm, TIFF_TAG_ROWS_PER_STRIP, TIFF_TYPE_LONG, 1, rowsPerStrip ); writeTag( strm, TIFF_TAG_STRIP_COUNTS, stripCount > 1 ? TIFF_TYPE_SHORT : TIFF_TYPE_LONG, stripCount, stripCountsOffset ); strm.putDWord(0); strm.close(); if( m_buf ) { (*m_buf)[4] = (uchar)directoryOffset; (*m_buf)[5] = (uchar)(directoryOffset >> 8); (*m_buf)[6] = (uchar)(directoryOffset >> 16); (*m_buf)[7] = (uchar)(directoryOffset >> 24); } else {
开发者ID:Skolo,项目名称:opencv,代码行数:101,
示例17: writeTag//---------------------------------------------------------int ofXMLSettings::addTag(string tag){ int tagID = writeTag(tag, "", -1) -1; return tagID; }
开发者ID:LeonFedotov,项目名称:L.A.S.E.R.-TAG-GRL,代码行数:5,
示例18: assertstatus WAVEFile::writeMiscellaneous(){ if (miscellaneousCount != 0) { uint32_t miscellaneousBytes; uint32_t chunkSize; /* Start at 12 to account for 'LIST', size, and 'INFO'. */ miscellaneousBytes = 12; /* Then calculate the size of the whole INFO chunk. */ for (int i=0; i<miscellaneousCount; i++) { Tag miscid; // Skip miscellaneous data of an unsupported type. if (!misc_type_to_wave(miscellaneous[i].type, &miscid)) continue; // Account for miscellaneous type and size. miscellaneousBytes += 8; miscellaneousBytes += miscellaneous[i].size; // Add a pad byte if necessary. if (miscellaneous[i].size % 2 != 0) miscellaneousBytes++; assert(miscellaneousBytes % 2 == 0); } if (miscellaneousStartOffset == 0) miscellaneousStartOffset = fh->tell(); else fh->seek(miscellaneousStartOffset, File::SeekFromBeginning); totalMiscellaneousSize = miscellaneousBytes; /* Write the data. On the first call to this function (from _af_wave_write_init), the data won't be available, fh->seek is used to reserve space until the data has been provided. On subseuent calls to this function (from _af_wave_update), the data will really be written. */ /* Write 'LIST'. */ fh->write("LIST", 4); /* Write the size of the following chunk. */ chunkSize = miscellaneousBytes-8; writeU32(&chunkSize); /* Write 'INFO'. */ fh->write("INFO", 4); /* Write each miscellaneous chunk. */ for (int i=0; i<miscellaneousCount; i++) { uint32_t miscsize = miscellaneous[i].size; Tag miscid; // Skip miscellaneous data of an unsupported type. if (!misc_type_to_wave(miscellaneous[i].type, &miscid)) continue; writeTag(&miscid); writeU32(&miscsize); if (miscellaneous[i].buffer != NULL) { uint8_t zero = 0; fh->write(miscellaneous[i].buffer, miscellaneous[i].size); // Pad if necessary. if ((miscellaneous[i].size%2) != 0) writeU8(&zero); } else { int size; size = miscellaneous[i].size; // Pad if necessary. if ((size % 2) != 0) size++; fh->seek(size, File::SeekFromCurrent); } } } return AF_SUCCEED;}
开发者ID:matthiasr,项目名称:audiofile,代码行数:93,
注:本文中的writeTag函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ writeText函数代码示例 C++ writeStringAttr函数代码示例 |