[Matroska-devel] yet another matroska api

Steve Lhomme slhomme at matroska.org
Wed Apr 21 09:23:47 CEST 2010


Hi Pavel,

I will add that to the list of possible libraries on the website soon.
Thanks for the info and good job :)

Steve

On Wed, Apr 21, 2010 at 12:26 AM, Pavel Koshevoy <
pkoshevoy at sorensonmedia.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.matroska.org/pipermail/matroska-devel/attachments/20100421/f489f7a9/attachment.html>


More information about the Matroska-devel mailing list