Hi all,

        I added new constructor for MediaRendition so that it can add Media
Clip Data to the Rendition actions. So it will be useful for embedding video
in to the pdf.
Please give all your suggestions to improve this.

Thanks
--
A Srinivas
Index: poppler-0.16.2/poppler/Rendition.cc
===================================================================
--- poppler-0.16.2/poppler/Rendition.cc	(revision 14)
+++ poppler-0.16.2/poppler/Rendition.cc	(working copy)
@@ -23,6 +23,7 @@
 //*********************************************************************************
 
 #include <math.h>
+#include "XRef.h"
 #include "Rendition.h"
 #include "FileSpec.h"
 
@@ -266,6 +267,8 @@
   if (contentType)
     delete contentType;
 
+  mediaRendition.free();
+
   if (embeddedStream && (!embeddedStream->decRef())) {
     delete embeddedStream;
   }
@@ -281,6 +284,8 @@
   isEmbedded = gFalse;
   embeddedStream = NULL;
 
+  obj->copy(&mediaRendition);
+
   //
   // Parse media clip data
   //
@@ -366,6 +371,34 @@
   tmp2.free();
 }
 
+MediaRendition::MediaRendition(XRef *xrefA, const char *fileNameA, const char *mimeType) {
+  Object obj;
+  Ref newRef;
+  
+  fileName = new GooString(fileNameA); 
+  contentType = new GooString(mimeType);
+
+  mediaRendition.initDict(xrefA);
+  mediaRendition.dictSet("S", obj.initName("MR"));
+  
+  // Media Clip Dictionary
+  Object mclipDict;
+  mclipDict.initDict(xrefA);
+  mclipDict.dictSet("S", obj.initName("MCD"));
+
+  if (createFilespec (xrefA, fileName, &obj)) {
+    mclipDict.dictSet("D", &obj);
+    if (mimeType)
+      mclipDict.dictSet("CT", obj.initString(contentType));
+  }
+  
+  newRef = xrefA->addIndirectObject(&mclipDict);
+  obj.initRef(newRef.num, newRef.gen);
+  mediaRendition.dictSet("C", &obj);
+
+  ref = xrefA->addIndirectObject(&mediaRendition);
+}
+
 void MediaRendition::outputToFile(FILE* fp) {
   if (!isEmbedded)
     return;
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to