[poppler] Patch for embedding videos in to the pdf.

Albert Astals Cid aacid at kde.org
Tue Feb 15 11:50:51 PST 2011


A Dimarts, 15 de febrer de 2011, srinivas adicherla va escriure:
> Hi all,
> 
>     I made a patch for embedding videos into the pdf file. I created a
> Screen annotation, and add a Rendition action to it. For appearance I took
> the image from the user (only accepting png), later I will do for others
> also. I tested opening the embedded pdf files using Adobe and Foxit Reader
> it was successfully opened for me. I tried for swf and mpg files.
> I am asking the user to specify the image because there are lot of video
> formats, so its time consuming for creating an image from the video frame
> for all types. ( May be in the future i add that or anybody can help me in
> that).
> 
> I added the same in bugzilla.
> 
> Please give me suggestions to make this successful.

Some quick things:
 * You use png.h unconditionally that is not going to work, you need to use 
the proper defines to see if configure/cmake found it.
 * FILE *f;; <- extra ;
 * png_structp read_png;; <- again
 * error(-1, "The file could not be recognized as a PNG file."); <-- You don't 
close f here
 * You don't delete imgbuf
 * Wihtout having any idea png_create_info_struct seems like you should call 
destroy afterwards in the structure it returns
 * After
   MemStream *imgStream = load_from_png (img_file, &imgXObj, xrefA);
   if (!imgStream)
     return gFalse;
   you need to free all the Obj you've allocated
 * I'm pretty sure
   annotObj.dictSet("T", obj.initString(new GooString(video_name)));
   annotObj.dictSet("Contents", obj.initString(new GooString(video_name)));
   annotObj.dictSet("F", obj.initInt(4));
   is leaking memory as Object is not supposed to be reused without freeing it 
first, please use valgrind to detect leaks in your code

Albert

> 
> Thanks in Advance.
> A Srinivas


More information about the poppler mailing list