[Matroska-devel] yet another matroska api

Steve Lhomme slhomme at matroska.org
Tue Apr 27 10:00:36 CEST 2010


I added a link to your SourceForge page in our Downloads links. Should
it be mentioned that it's supported by Sorenson Media ?

On 4/21/10, Christian Wiesner <chris at matroska.org> wrote:
> Hi Pavel,
>
> good job, thank you for that ! One question: What license type is your
> library ? BSD ?
>
> Christian
>
> 2010/4/21 Pavel Koshevoy <pkoshevoy at sorensonmedia.com>
>
>> Hi,
>>
>> I'd like to announce Yet Another Matroska API --
>> https://sourceforge.net/projects/yamka/
>>
>> It's not quiet complete yet -- CRC-32 isn't done right, and default
>> payload values are not set for most of the elements.
>>
>> It's cross-platform, written in C++, depends on Boost (headers only, at
>> least right now). It's concise and straight forward to use, something
>> like this (note: I didn't try to compile this example)
>>
>>
>> > // yamka includes:
>> > #include <yamka.h>
>> >
>> > // yamka shortcuts:
>> > typedef Yamka::MatroskaDoc::TSegment TSegment;
>> > typedef Yamka::Segment::TInfo TSegInfo;
>> > typedef Yamka::Segment::TTracks TTracks;
>> > typedef Yamka::Segment::TSeekHead TSeekHead;
>> > typedef Yamka::Segment::TCluster TCluster;
>> > typedef Yamka::Segment::TCues TCues;
>> > typedef Yamka::Cues::TCuePoint TCuePoint;
>> > typedef Yamka::Tracks::TTrack TTrackEntry;
>> >
>> > using Yamka::File;
>> > using Yamka::FileStorage;
>> > using Yamka::uint64;
>> > using Yamka::MatroskaDoc;
>> > using Yamka::SimpleBlock
>> > using Yamka::Cluster;
>> >
>> > void blah()
>> > {
>> >   // load matroska document from "testYamka.mkv"
>> >   FileStorage mkvSrc(std::string("testYamka.mkv"), File::kReadOnly);
>> >   uint64 mkvSrcSize = mkvSrc.file_.size();
>> >
>> >   MatroskaDoc matroska;
>> >   uint64 bytesRead = matroska.load(mkvSrc, mkvSrcSize);
>> >
>> >   // in the first cluster only -- dump SimpleBlock payload attributes
>> >   // (trackNo, lacing, frame sizes, etc...) to stdout:
>> >   typedef std::deque<Cluster::TSimpleBlock>::const_iterator
>> TSimpleBlockIter;
>> >   for (TSimpleBlockIter i = matroska.
>> >          segments_.front().payload_.
>> >          clusters_.front().payload_.
>> >          simpleBlocks_.begin();
>> >        i != matroska.
>> >          segments_.front().payload_.
>> >          clusters_.front().payload_.
>> >          simpleBlocks_.end();
>> >        ++i)
>> >   {
>> >     const Cluster::TSimpleBlock & elt = *i;
>> >
>> >     Bytes importData;
>> >     if (elt.payload_.get(importData))
>> >     {
>> >       SimpleBlock sb;
>> >       if (sb.importData(importData))
>> >       {
>> >         std::cout << sb << std::endl;
>> >       }
>> >     }
>> >   }
>> >
>> >   // modify the document:
>> >   TSegment & segment = matroska.segments_.back();
>> >   TSegInfo & segInfo = segment.payload_.info_;
>> >   segInfo.payload_.writingApp_.payload_.
>> >     set("Sorenson Media Matroska formatter SCAPI plugin");
>> >
>> >   // save matroska document to "testYamkaOut.mkv"
>> >   FileStorage mkvSrcOut(std::string("testYamkaOut.mkv"),
>> File::kReadWrite);
>> >   FileStorage::IReceiptPtr receipt = matroska.save(mkvSrcOut);
>> >
>> >   std::cout << "bytes saved: " << receipt->numBytes() << std::endl;
>> > }
>>
>>
>>
>> Hope this is useful to someone besides me.
>>        Pavel.
>> _______________________________________________
>> Matroska-devel mailing list
>> Matroska-devel at lists.matroska.org
>> http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-devel
>> Read Matroska-Devel on GMane:
>> http://dir.gmane.org/gmane.comp.multimedia.matroska.devel
>>
>



More information about the Matroska-devel mailing list