[poppler] Patch for embedding videos in to the pdf

Albert Astals Cid aacid at kde.org
Thu Feb 24 10:52:58 PST 2011


A Dijous, 24 de febrer de 2011, srinivas adicherla va escriure:
> Hi Albert
> 
>              Thank you for giving me tips.
>   I included #if defined(ENABLE_PNG)
>                  #include "PNGWriter.h"
>                  #endif
> 
>   that is what in some places you were doing.

Your code will not compile if png.h is not there, right?

>   About Object's freeing issue. It is not setting the value at all if we
> free it in the function.
>   I saw in other places also if we initialize the objects then they are not
> freeing, but if we get some value in to the objects
> usng dict.lookup("key", &obj); then they are freeing it. This is what I
> found.

Sorry, my bad both dictSet and arrayAdd do shallow copies of the objects so 
you don't need to free them.

Albert

> 
> 
> So please give me update on this.
> 
> Thank you
> A Srinivas
> 
> On Wed, Feb 23, 2011 at 5:46 PM, <poppler-
request at lists.freedesktop.org>wrote:
> > Send poppler mailing list submissions to
> > 
> >        poppler at lists.freedesktop.org
> > 
> > To subscribe or unsubscribe via the World Wide Web, visit
> > 
> >        http://lists.freedesktop.org/mailman/listinfo/poppler
> > 
> > or, via email, send a message with subject or body 'help' to
> > 
> >        poppler-request at lists.freedesktop.org
> > 
> > You can reach the person managing the list at
> > 
> >        poppler-owner at lists.freedesktop.org
> > 
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of poppler digest..."
> > 
> > Today's Topics:
> >   1. Re: Font substitution in Poppler (Albert Astals Cid)
> >   2. Re: Patch for embedding videos in to the pdf. (srinivas adicherla)
> > 
> > ----------------------------------------------------------------------
> > 
> > Message: 1
> > Date: Tue, 22 Feb 2011 20:23:44 +0000
> > From: Albert Astals Cid <aacid at kde.org>
> > Subject: Re: [poppler] Font substitution in Poppler
> > To: poppler at lists.freedesktop.org
> > Message-ID: <201102222023.44914.aacid at kde.org>
> > Content-Type: Text/Plain;  charset="iso-8859-1"
> > 
> > A Dimarts, 22 de febrer de 2011, jose.aliste at gmail.com va escriure:
> > > Hi,
> > > 
> > > while reading GlobalParams.cc in poppler directory, I've noticed that
> > > when substituting, we only take into account substitutions for a given
> > > font that are ttf or pfb. So I wondered  why is this so? and, what
> > > would be the path to implement support for otf substitutions?
> > 
> > Before worrying about the substitution have you checked if a pdf with a
> > otf font embedded renders correctly?
> > 
> > Albert
> > 
> > > Greetings
> > > 
> > > Jos?
> > > _______________________________________________
> > > poppler mailing list
> > > poppler at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/poppler
> > 
> > ------------------------------
> > 
> > Message: 2
> > Date: Wed, 23 Feb 2011 17:46:52 +0530
> > From: srinivas adicherla <srinivas.adicherla at gmail.com>
> > Subject: Re: [poppler] Patch for embedding videos in to the pdf.
> > To: poppler at lists.freedesktop.org
> > 
> > Message-ID:
> >        <AANLkTimtinmd__D762OhdiJQ0JAnDDzTi-rxq4XtZykp at mail.gmail.com>
> > 
> > Content-Type: text/plain; charset="iso-8859-1"
> > 
> > Hi Albert
> > 
> >          Thank you for your suggestions. Sorry it was long gap since you
> > 
> > gave those suggestions. I was so busy after that.
> > 
> > - about "#include <png.h>". I don't know how to check for those in
> > configure/cmake files.
> > If any one can give me any ideas how to do, it will be really helpful. I
> > just check for #ENABLE_PNG and including it. I don't know whether it is
> > right or not.
> > 
> > - Other things I used valgrind for memory leaks. Still in some places
> > like "object.initDict(xref)" it is showing definitely leak some bytes.
> > 
> >  How to overcome those things. Not only in my code still in poppler some
> > 
> > places it is showing leaking memory for initDict(xref) or
> > initArray(xref).
> > 
> >  But we cannot free those objects explicitly in our code, if we do like
> > 
> > that. If we delete like that that value for that dictionary key it is not
> > setting.
> > 
> > So is it fine?
> > 
> > Please kindly give suggestios.
> > 
> > Thank you all in advance.
> > 
> > --
> > A Srinivas
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Wed, Feb 16, 2011 at 1:30 AM, <poppler-request at lists.freedesktop.org
> > 
> > >wrote:
> > > Send poppler mailing list submissions to
> > > 
> > >        poppler at lists.freedesktop.org
> > > 
> > > To subscribe or unsubscribe via the World Wide Web, visit
> > > 
> > >        http://lists.freedesktop.org/mailman/listinfo/poppler
> > > 
> > > or, via email, send a message with subject or body 'help' to
> > > 
> > >        poppler-request at lists.freedesktop.org
> > > 
> > > You can reach the person managing the list at
> > > 
> > >        poppler-owner at lists.freedesktop.org
> > > 
> > > When replying, please edit your Subject line so it is more specific
> > > than "Re: Contents of poppler digest..."
> > > 
> > > Today's Topics:
> > >   1. Re: Patch for embedding videos in to the pdf. (Albert Astals Cid)
> > >   2. Re: pdf import in Inkscap using poppler_glib and
> > >   
> > >      poppler_cairo (Albert Astals Cid)
> > >   
> > >   3. Re: Patch for embedding videos in to the pdf. (Albert Astals Cid)
> > > 
> > > ----------------------------------------------------------------------
> > > 
> > > Message: 1
> > > Date: Tue, 15 Feb 2011 19:13:09 +0000
> > > From: Albert Astals Cid <aacid at kde.org>
> > > Subject: Re: [poppler] Patch for embedding videos in to the pdf.
> > > To: poppler at lists.freedesktop.org
> > > Message-ID: <201102151913.10014.aacid at kde.org>
> > > Content-Type: Text/Plain;  charset="us-ascii"
> > > 
> > > A Dimarts, 15 de febrer de 2011, srinivas adicherla va escriure:
> > > > Hi all,
> > > 
> > > Hi
> > > 
> > > >     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.
> > > 
> > > Bad idea, don't do this. Either do it here or in the bugzilla but not
> > > in both.
> > > In two places just makes more difficult to follow the dicussion.
> > > 
> > > Albert
> > > 
> > > > Please give me suggestions to make this successful.
> > > > 
> > > > Thanks in Advance.
> > > > A Srinivas
> > > 
> > > ------------------------------
> > > 
> > > Message: 2
> > > Date: Tue, 15 Feb 2011 19:23:42 +0000
> > > From: Albert Astals Cid <aacid at kde.org>
> > > Subject: Re: [poppler] pdf import in Inkscap using poppler_glib and
> > > 
> > >        poppler_cairo
> > > 
> > > To: poppler at lists.freedesktop.org
> > > Message-ID: <201102151923.43633.aacid at kde.org>
> > > Content-Type: Text/Plain;  charset="iso-8859-1"
> > > 
> > > A Dimarts, 15 de febrer de 2011, Pino Toscano va escriure:
> > > > Hi,
> > > > 
> > > > Alle marted? 15 febbraio 2011, the Adib ha scritto:
> > > > > currently Inkscape uses poppler internal API to read in pdf files.
> > > > > Those API breaks/changes from time to time.
> > > > > 
> > > > > Now I try importing pdf via poppler cairo surface and those cairo
> > > > > surface as svg backend. So far that works.
> > > > > 
> > > > > But I do not have any control over the process:
> > > > > - I can not set bitmap dpi
> > > > > - I can not specify if text stays text or convert to path
> > > > > etc.
> > > > > 
> > > > > Do you have any sugestions?
> > > > 
> > > > What I proposed more than one year ago:
> > > > http://sourceforge.net/mailarchive/message.php?msg_id=24162410
> > > 
> > > That'd work me too :D
> > > 
> > > Also if your custom inkscape converter does not depend in inkscape i
> > > see
> > 
> > no
> > 
> > > reason why we could not have it inside poppler too if you commit to
> > > maintaining it here (this way you'd be much safer to API changes)
> > > 
> > > Albert
> > > 
> > > 
> > > ------------------------------
> > > 
> > > Message: 3
> > > Date: Tue, 15 Feb 2011 19:50:51 +0000
> > > From: Albert Astals Cid <aacid at kde.org>
> > > Subject: Re: [poppler] Patch for embedding videos in to the pdf.
> > > To: poppler at lists.freedesktop.org
> > > Message-ID: <201102151950.51464.aacid at kde.org>
> > > Content-Type: Text/Plain;  charset="us-ascii"
> > > 
> > > 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
> > > 
> > > ------------------------------
> > > 
> > > _______________________________________________
> > > poppler mailing list
> > > poppler at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/poppler
> > > 
> > > 
> > > End of poppler Digest, Vol 72, Issue 21
> > > ***************************************
> > 
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: <
> > http://lists.freedesktop.org/archives/poppler/attachments/20110223/5ee0f3
> > 1c/attachment.html
> > 
> > -------------- next part --------------
> > A non-text attachment was scrubbed...
> > Name: srinivas_video_embedd.patch
> > Type: text/x-patch
> > Size: 11746 bytes
> > Desc: not available
> > URL: <
> > http://lists.freedesktop.org/archives/poppler/attachments/20110223/5ee0f3
> > 1c/attachment.bin
> > 
> > 
> > ------------------------------
> > 
> > _______________________________________________
> > poppler mailing list
> > poppler at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/poppler
> > 
> > 
> > End of poppler Digest, Vol 72, Issue 29
> > ***************************************


More information about the poppler mailing list