Hi Carlos,<br><br>            Thank you for your valuable suggestions. I made the changes according to that. I attached a new patch with this.<br><br>-  I have some doubt when setting a &#39;Rendition&#39; action, we have two options one is to set &#39;OP&#39; other one is &#39;JS&#39;. I am asking the user to pass the Javascript and set it as a stream here. <br>
<br>- One more is i wrote a new function &#39;get_file_name_from_path&#39; is it fine? what is the good place to add this function.<br><br>Please give suggestions again.<br><br>Thanks<br>--<br>A Srinivas<br><br><div class="gmail_quote">
On Mon, Mar 21, 2011 at 12:30 AM,  <span dir="ltr">&lt;<a href="mailto:poppler-request@lists.freedesktop.org">poppler-request@lists.freedesktop.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Send poppler mailing list submissions to<br>
        <a href="mailto:poppler@lists.freedesktop.org">poppler@lists.freedesktop.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.freedesktop.org/mailman/listinfo/poppler" target="_blank">http://lists.freedesktop.org/mailman/listinfo/poppler</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:poppler-request@lists.freedesktop.org">poppler-request@lists.freedesktop.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:poppler-owner@lists.freedesktop.org">poppler-owner@lists.freedesktop.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of poppler digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Re: [PATCH] Simplify the GCC compiler flags/warnings<br>
      (Albert Astals Cid)<br>
   2. Re: glib/poppler-annot.cc glib/poppler-annot.h<br>
      poppler/Annot.cc poppler/Annot.h (Carlos Garcia Campos)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sun, 20 Mar 2011 13:59:24 +0000<br>
From: Albert Astals Cid &lt;<a href="mailto:aacid@kde.org">aacid@kde.org</a>&gt;<br>
Subject: Re: [poppler] [PATCH] Simplify the GCC compiler<br>
        flags/warnings<br>
To: <a href="mailto:poppler@lists.freedesktop.org">poppler@lists.freedesktop.org</a><br>
Message-ID: &lt;<a href="mailto:201103201359.24744.aacid@kde.org">201103201359.24744.aacid@kde.org</a>&gt;<br>
Content-Type: Text/Plain;  charset=&quot;iso-8859-1&quot;<br>
<br>
A Diumenge, 13 de mar? de 2011, Albert Astals Cid va escriure:<br>
&gt; A Diumenge, 13 de mar? de 2011, Pino Toscano va escriure:<br>
&gt; &gt; Alle domenica 13 marzo 2011, Albert Astals Cid ha scritto:<br>
&gt; &gt; &gt; A Dissabte, 12 de mar? de 2011, Pino Toscano va escriure:<br>
&gt; &gt; &gt; &gt; Alle sabato 12 marzo 2011, Hib Eris ha scritto:<br>
&gt; &gt; &gt; &gt; &gt; Two more remarks:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; +if test &quot;x$GCC&quot; == xyes; then<br>
&gt; &gt; &gt; &gt; &gt; +  extra_cxxflags=&quot;-Wall -Wno-write-strings -Woverloaded-virtual<br>
&gt; &gt; &gt; &gt; &gt; \ +                  -Wnon-virtual-dtor -Wcast-align<br>
&gt; &gt; &gt; &gt; &gt; -fno-exceptions \ +                  -fno-check-new -fno-common&quot;<br>
&gt; &gt; &gt; &gt; &gt; +  case &quot;$enable_compile_warnings&quot; in<br>
&gt; &gt; &gt; &gt; &gt; +    yes)<br>
&gt; &gt; &gt; &gt; &gt; +      extra_cxxflags=&quot;$extra_cxxflags \<br>
&gt; &gt; &gt; &gt; &gt; +                      -D_XOPEN_SOURCE=600 -D_BSD_SOURCE \<br>
&gt; &gt; &gt; &gt; &gt; +                      -W -Wno-long-long -Wundef -Wconversion<br>
&gt; &gt; &gt; &gt; &gt; -Wpointer-arith \ +                      -Wwrite-strings<br>
&gt; &gt; &gt; &gt; &gt; -Wformat-security \<br>
&gt; &gt; &gt; &gt; &gt; +                      -Wmissing-format-attribute&quot;<br>
&gt; &gt; &gt; &gt; &gt; +      ;;<br>
&gt; &gt; &gt; &gt; &gt; +    esac<br>
&gt; &gt; &gt; &gt; &gt; +  CXXFLAGS=&quot;$extra_cxxflags $CXXFLAGS&quot;<br>
&gt; &gt; &gt; &gt; &gt; +fi<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; 1. In the &#39;yes&#39; case, you end up with both  -Wno-write-strings<br>
&gt; &gt; &gt; &gt; &gt; and -Wwrite-strings, it is at least not obvious which one the<br>
&gt; &gt; &gt; &gt; &gt; compiler will pick.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; The last of course.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I disagree with that. It will result in people sending patches to<br>
&gt; &gt; &gt; move all char * to const char* which adds nothing but noise to the<br>
&gt; &gt; &gt; git history.<br>
&gt; &gt;<br>
&gt; &gt; -Write-strings is in the new &quot;yes&quot;, which is the equivalent of the<br>
&gt; &gt; current &quot;kde&quot;, so nothing changes for the default configuration.<br>
&gt;<br>
&gt; True, but the current &quot;kde&quot; is something noone uses, if you name it &quot;enable<br>
&gt; warnings&quot; everyone will think it is our default &quot;warnings&quot; setting.<br>
<br>
Since it seems noone else cares i&#39;d suggest you go my &quot;simple&quot; way with only<br>
one set of warnings, if we ever need more we can reintroduce the other &quot;yes&quot;<br>
warnings.<br>
<br>
Albert<br>
<br>
&gt;<br>
&gt; Albert<br>
&gt;<br>
&gt; &gt; &gt; I&#39;d just scrap the &quot;extra warnings&quot; setting and by default enable the<br>
&gt; &gt; &gt; ones we think make sense and that&#39;s it.<br>
&gt; &gt;<br>
&gt; &gt; That may be another idea -- other opinions?<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; poppler mailing list<br>
&gt; <a href="mailto:poppler@lists.freedesktop.org">poppler@lists.freedesktop.org</a><br>
&gt; <a href="http://lists.freedesktop.org/mailman/listinfo/poppler" target="_blank">http://lists.freedesktop.org/mailman/listinfo/poppler</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sun, 20 Mar 2011 16:16:26 +0100<br>
From: Carlos Garcia Campos &lt;<a href="mailto:carlosgc@gnome.org">carlosgc@gnome.org</a>&gt;<br>
Subject: Re: [poppler] glib/poppler-annot.cc glib/poppler-annot.h<br>
        poppler/Annot.cc poppler/Annot.h<br>
To: aacid &lt;<a href="mailto:aacid@kemper.freedesktop.org">aacid@kemper.freedesktop.org</a>&gt;<br>
Cc: poppler &lt;<a href="mailto:poppler@lists.freedesktop.org">poppler@lists.freedesktop.org</a>&gt;<br>
Message-ID: &lt;1300629799-sup-5028@charizard&gt;<br>
Content-Type: text/plain; charset=&quot;utf8&quot;<br>
<br>
Excerpts from aacid&#39;s message of jue mar 17 21:10:41 +0100 2011:<br>
&gt;  glib/poppler-annot.cc |   33 ++++<br>
&gt;  glib/poppler-annot.h  |    5<br>
&gt;  poppler/Annot.cc      |  377 ++++++++++++++++++++++++++++++++++++++++++++++++++<br>
&gt;  poppler/Annot.h       |    2<br>
&gt;  4 files changed, 417 insertions(+)<br>
&gt;<br>
&gt; New commits:<br>
&gt; commit 66575c990f379871e4b796befc899de178332670<br>
&gt; Author: Srinivas Adicherla &lt;<a href="mailto:srinivas.adicherla@gmail.com">srinivas.adicherla@gmail.com</a>&gt;<br>
&gt; Date:   Thu Mar 17 20:14:05 2011 +0000<br>
&gt;<br>
&gt;     Patch for embedding videos in to the pdf<br>
&gt;<br>
&gt; diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc<br>
&gt; index 62a0879..c714288 100644<br>
&gt; --- a/glib/poppler-annot.cc<br>
&gt; +++ b/glib/poppler-annot.cc<br>
&gt; @@ -332,6 +332,39 @@ _poppler_annot_screen_new (Annot *annot)<br>
&gt;    return poppler_annot;<br>
&gt;  }<br>
<br>
I&#39;m sorry I didn&#39;t find the time to review previous patches and I was<br>
on vacation when Albert asked for approval before commiting it. There<br>
are some problems with the patch, I&#39;ll comment inline.<br>
<br>
&gt; +/**<br>
&gt; + * poppler_annot_screen_new:<br>
&gt; + * @doc: a #PopplerDocument<br>
&gt; + * @rect: a #PopplerRectangle<br>
&gt; + * @video_file: pass the path of the video to be embed<br>
&gt; + * @mimetype: pass the mimetype of the video to put in the Media Clip Dictionary<br>
&gt; + * @img_file: pass png/jpeg image file for poster<br>
&gt; + *<br>
&gt; + * Creates a new Screen annotation that will be<br>
&gt; + * located on @rect when added to a page. See<br>
&gt; + * poppler_page_add_annot()<br>
&gt; + *<br>
&gt; + * Return value: A newly created #PopplerAnnotScreen annotation<br>
&gt; + *<br>
&gt; + * Since: 0.18<br>
&gt; + */<br>
&gt; +PopplerAnnot *<br>
&gt; +poppler_annot_screen_new (PopplerDocument  *doc,<br>
&gt; +              PopplerRectangle *rect,<br>
&gt; +              const char* video_file,<br>
&gt; +              const char* mimetype,<br>
&gt; +              const char* img_file)<br>
<br>
A screen annotation can be used to trigger any action, not only<br>
rendition actions. This should be just<br>
<br>
PopplerAnnot *<br>
poppler_annot_screen_new (PopplerDocument  *doc, PopplerRectangle<br>
*rect);<br>
<br>
And another method to set the action<br>
poppler_annot_screen_set_action(), since the activation action is not<br>
required in a screen annotation.<br>
<br>
&gt; +{<br>
&gt; +  AnnotScreen *annot;<br>
&gt; +  PDFRectangle pdf_rect(rect-&gt;x1, rect-&gt;y1,<br>
&gt; +            rect-&gt;x2, rect-&gt;y2);<br>
&gt; +<br>
&gt; +  annot = new AnnotScreen (doc-&gt;doc-&gt;getXRef(), &amp;pdf_rect, doc-&gt;doc-&gt;getCatalog());<br>
&gt; +  if (annot-&gt;setAction(video_file, mimetype, img_file))<br>
&gt; +    return _poppler_annot_screen_new ((Annot*)annot);<br>
&gt; +  else<br>
&gt; +    return NULL;<br>
<br>
This function should never return NULL, since the action is optional<br>
there could be a screen annot without an action.<br>
<br>
&gt; +<br>
&gt; +GBool AnnotScreen::setAction(const char *video_file, const char *mimetype, const char *img_file) {<br>
<br>
There&#39;s a AnnotScreen::getAction() method that returns the LinkAction<br>
associated with the annotation, but this method doesn&#39;t update the<br>
current annotation action. Since the action might be of any type, I<br>
think this should be<br>
<br>
void AnnotScreen::setAction(LinkAction *action)<br>
<br>
if the annotation already had an action it will be replaced by the new<br>
one and the annot dictionary will be updated using Annot::update()<br>
<br>
&gt; +  if (!video_file) {<br>
&gt; +    error(-1, &quot;Need to pass the video file&quot;);<br>
&gt; +    return gFalse;<br>
&gt; +  }<br>
&gt; +<br>
&gt; +  FILE *fs;<br>
&gt; +  unsigned int size = 0;<br>
&gt; +  if (!(fs = fopen(video_file, &quot;rb&quot;))) {<br>
&gt; +    error(-1, &quot;Couldn&#39;t open video file &#39;%s&#39;&quot;, video_file);<br>
&gt; +    return gFalse;<br>
&gt; +  }<br>
&gt; +  fseek(fs, 0, SEEK_END);<br>
&gt; +  size = ftell(fs);<br>
&gt; +<br>
&gt; +  // Extract the video name from the file uri<br>
&gt; +  const char *video_name = strrchr(video_file, &#39;/&#39;);<br>
&gt; +  if (video_name) {<br>
&gt; +    video_name++;<br>
&gt; +  } else {<br>
&gt; +    video_name = video_file;<br>
&gt; +  }<br>
&gt; +<br>
&gt; +  Object obj1, obj2, obj3, obj4;<br>
&gt; +<br>
&gt; +  annotObj.dictSet(&quot;T&quot;, obj1.initString(new  GooString(video_name))); // title<br>
<br>
This should be another method AnnotScreen::setTitle() instead of<br>
always using the vodeo name. Since this is optional it&#39;s not a problem<br>
if the entry is not present unless the user explicitely calls setTitle()<br>
<br>
&gt; +  annotObj.dictSet(&quot;Contents&quot;, obj2.initString(new GooString(video_name))); // alternate text to be dispalyed for the<br>
&gt; annotation<br>
<br>
The same here, we already have Annot::setContents(), use it to make sure<br>
the contents are correctly encoded and that the contents variable is<br>
correctly updated.<br>
<br>
&gt; +  annotObj.dictSet(&quot;F&quot;, obj3.initInt(4)); // No Zoom<br>
<br>
4 is the bit position within the flag word, not the value itself. The<br>
spec doesn&#39;t say<br>
<br>
&gt; +  Object formXObj;<br>
&gt; +  formXObj.initDict(xref);<br>
&gt; +<br>
&gt; +  formXObj.dictSet(&quot;Type&quot;, obj1.initName(&quot;XObject&quot;));<br>
&gt; +  formXObj.dictSet(&quot;Subtype&quot;, obj2.initName(&quot;Form&quot;));<br>
&gt; +<br>
&gt; +  Object bbox;<br>
&gt; +  bbox.initArray(xref);<br>
&gt; +  bbox.arrayAdd(obj1.initReal(0.0000));<br>
&gt; +  bbox.arrayAdd(obj2.initReal(0.0000));<br>
&gt; +  bbox.arrayAdd(obj3.initReal(1.0000));<br>
&gt; +  bbox.arrayAdd(obj4.initReal(1.0000));<br>
&gt; +  formXObj.dictSet(&quot;BBox&quot;, &amp;bbox);<br>
<br>
why is BBox 0, 0, 1, 1, shouldn&#39;t you use the annotation rectangle?<br>
something like<br>
<br>
bbox[0] = bbox[1] = 0;<br>
bbox[2] = rect-&gt;x2 - rect-&gt;x1;<br>
bbox[3] = rect-&gt;y2 - rect-&gt;y1;<br>
<br>
not that we already have Annot::createForm() that might help here<br>
too.<br>
<br>
&gt; +  Ref imgRef;<br>
&gt; +  Object imgXObj;<br>
&gt; +  imgXObj.initDict(xref);<br>
&gt; +  imgXObj.dictSet(&quot;Type&quot;, obj1.initName(&quot;XObject&quot;));<br>
&gt; +  imgXObj.dictSet(&quot;Subtype&quot;, obj2.initName(&quot;Image&quot;));<br>
&gt; +<br>
&gt; +  if (img_file) { //show the poster, else do not show anything<br>
&gt; +    FILE *imgfp;<br>
&gt; +    if (!(imgfp = fopen(img_file, &quot;rb&quot;))) {<br>
&gt; +      error(-1, &quot;Couldn&#39;t open file: %s&quot;, img_file);<br>
&gt; +      return gFalse;<br>
&gt; +    }<br>
&gt; +    unsigned char h[10];<br>
&gt; +    fread(h, 1, 10, imgfp);<br>
&gt; +    fseek(imgfp, 0, SEEK_SET);<br>
&gt; +<br>
&gt; +    MemStream *imgStream = NULL;<br>
&gt; +    // Load the stream from the png file<br>
&gt; +    if (h[0] == 0x89 &amp;&amp; h[1] == 0x50 &amp;&amp; h[2] == 0x4E &amp;&amp; h[3] == 0x47) {<br>
&gt; +      imgStream = load_from_png (imgfp, &amp;imgXObj);<br>
&gt; +    // Load the stream from the jpeg file<br>
&gt; +    } else if(h[0] == 0xFF &amp;&amp; h[1] == 0xD8 &amp;&amp; h[6] == 0x4A &amp;&amp; h[7] == 0x46 &amp;&amp; h[8] == 0x49 &amp;&amp; h[9] == 0x46) {<br>
&gt; +      imgStream = load_from_jpeg (imgfp, &amp;imgXObj);<br>
&gt; +    } else {<br>
&gt; +      error(-1, &quot;Image format cannot be supported, only png/jpeg\n&quot;);<br>
&gt; +      return gFalse;<br>
&gt; +    }<br>
&gt; +<br>
&gt; +    if (!imgStream) {<br>
&gt; +      obj1.free();<br>
&gt; +      obj2.free();<br>
&gt; +      obj3.free();<br>
&gt; +      obj4.free();<br>
&gt; +      bbox.free();<br>
&gt; +      imgXObj.free();<br>
&gt; +      return gFalse;<br>
<br>
the AP entry is optional, you can have a screen annotation with a<br>
rendition action associated that doesn&#39;t have an appearance stream, so<br>
I don&#39;t think we should return here.<br>
<br>
&gt; +    }<br>
&gt; +<br>
&gt; +    obj1.initStream(imgStream);<br>
&gt; +    imgRef = xref-&gt;addIndirectObject(&amp;obj1);<br>
&gt; +<br>
&gt; +    obj2.initDict(xref); // Image XObject<br>
&gt; +    obj2.dictSet(&quot;Im1&quot;, obj3.initRef(imgRef.num, imgRef.gen));<br>
&gt; +    obj4.initDict(xref);<br>
&gt; +    obj4.dictSet(&quot;XObject&quot;, &amp;obj2);<br>
&gt; +<br>
&gt; +    formXObj.dictSet(&quot;Resources&quot;, &amp;obj4);<br>
&gt; +<br>
&gt; +    GooString *newString = new GooString();<br>
&gt; +    newString-&gt;append(&quot;/Im1 Do&quot;);<br>
&gt; +    formXObj.dictSet(&quot;Length&quot;, obj1.initInt(newString-&gt;getLength()));<br>
&gt; +<br>
&gt; +    MemStream *fstream = new MemStream(copyString(newString-&gt;getCString()), 0, newString-&gt;getLength(), &amp;formXObj);<br>
&gt; +    fstream-&gt;setNeedFree(gTrue);<br>
&gt; +    delete(newString);<br>
&gt; +<br>
&gt; +    obj1.initStream(fstream);<br>
&gt; +    Ref appRef = xref-&gt;addIndirectObject(&amp;obj1);<br>
&gt; +<br>
&gt; +    obj2.initDict(xref);<br>
&gt; +    obj2.dictSet(&quot;N&quot;, obj3.initRef(appRef.num, appRef.gen));<br>
&gt; +    obj2.dictSet(&quot;R&quot;, obj3.initRef(appRef.num, appRef.gen));<br>
<br>
The spec says:<br>
<br>
&quot;The AP entry refers to an appearance dictionary (see Table 168) whose<br>
normal appearance provides the<br>
visual appearance for a screen annotation that shall be used for<br>
printing and default display when a media<br>
clip is not being played. If AP is not present, the screen annotation<br>
shall not have a default visual<br>
appearance and shall not be printed.&quot;<br>
<br>
it talks about the normal appearance, I don&#39;t think we need to set<br>
the rollover appearance too.<br>
<br>
&gt; +    annotObj.dictSet(&quot;AP&quot;, &amp;obj2);<br>
<br>
I think this should be moved to a generic method Annot::setAppearanceFromImage(const char *imageFile);<br>
or something like that.<br>
<br>
&gt; +    formXObj.initDict(xref);<br>
&gt; +    formXObj.dictSet(&quot;Type&quot;, obj3.initName(&quot;XObject&quot;));<br>
&gt; +    formXObj.dictSet(&quot;Subtype&quot;, obj4.initName(&quot;Form&quot;));<br>
&gt; +<br>
&gt; +    bbox.initArray(xref);<br>
&gt; +    bbox.arrayAdd(obj1.initReal(0.0000));<br>
&gt; +    bbox.arrayAdd(obj2.initReal(0.0000));<br>
&gt; +    bbox.arrayAdd(obj3.initReal(1.0000));<br>
&gt; +    bbox.arrayAdd(obj4.initReal(1.0000));<br>
&gt; +    formXObj.dictSet(&quot;BBox&quot;, &amp;bbox);<br>
<br>
Why 0, 0, 1, 1 here again?<br>
<br>
&gt; +    obj2.initDict(xref);<br>
&gt; +    obj2.dictSet(&quot;Im1&quot;, obj3.initRef(imgRef.num, imgRef.gen));<br>
&gt; +    obj1.initDict(xref);<br>
&gt; +    obj1.dictSet(&quot;XObject&quot;, &amp;obj2);<br>
&gt; +    formXObj.dictSet(&quot;Resources&quot;, &amp;obj1);<br>
&gt; +<br>
&gt; +    newString = new GooString();<br>
&gt; +    newString-&gt;append(&quot;/Im1 Do&quot;);<br>
&gt; +    formXObj.dictSet(&quot;Length&quot;, obj1.initInt(newString-&gt;getLength()));<br>
&gt; +<br>
&gt; +    fstream = new MemStream(copyString(newString-&gt;getCString()), 0, newString-&gt;getLength(), &amp;formXObj);<br>
&gt; +    fstream-&gt;setNeedFree(gTrue);<br>
&gt; +    delete(newString);<br>
&gt; +<br>
&gt; +    obj1.initStream(fstream);<br>
&gt; +    appRef = xref-&gt;addIndirectObject(&amp;obj1);<br>
&gt; +<br>
&gt; +    obj2.initDict(xref); // MK dictionary<br>
&gt; +    obj2.dictSet(&quot;I&quot;, obj3.initRef(appRef.num, appRef.gen));<br>
&gt; +    annotObj.dictSet(&quot;MK&quot;, &amp;obj2);<br>
<br>
There&#39;s a AnnotScreen::getAppearCharacs() method that should refelct<br>
this change too<br>
<br>
&gt; +  }<br>
&gt; +<br>
&gt; +  // Rendition Action to be add<br>
&gt; +  Object actionDict;<br>
&gt; +  actionDict.initDict(xref);<br>
&gt; +  actionDict.dictSet(&quot;Type&quot;, obj1.initName(&quot;Action&quot;));<br>
&gt; +  actionDict.dictSet(&quot;S&quot;, obj2.initName(&quot;Rendition&quot;));<br>
&gt; +  actionDict.dictSet(&quot;OP&quot;, obj3.initInt(0));<br>
<br>
OP = 0 means: play the rendition specified by R, associating it with<br>
the annotation specified by AN, which makes AN a required field. AN<br>
should be an indirect reference to the screen annotation.<br>
<br>
I think we could add a new constructor to LinkRendition() that takes<br>
the required fields of a rendition action like we currenlty do with<br>
annotations. Then this method would simply take the action object and<br>
update the A entry with the indirect reference to the action.<br>
<br>
&gt; +  // Media Rendition<br>
&gt; +  Object MRendition;<br>
&gt; +  MRendition.initDict(xref);<br>
&gt; +  MRendition.dictSet(&quot;S&quot;, obj1.initName(&quot;MR&quot;));<br>
&gt; +  MRendition.dictSet(&quot;N&quot;, obj2.initString(new GooString(video_name)));<br>
<br>
Same here, we could have a new constructor for MediaRendition that<br>
creates the new media rendition object.<br>
<br>
&gt; +  // Media Clip Dictionary<br>
&gt; +  Object MClipDict;<br>
&gt; +  MClipDict.initDict(xref);<br>
&gt; +  MClipDict.dictSet(&quot;S&quot;, obj1.initName(&quot;MCD&quot;));<br>
&gt; +  MClipDict.dictSet(&quot;N&quot;, obj2.initString(new GooString(video_name)));<br>
&gt; +<br>
&gt; +  if (mimetype) {<br>
&gt; +    MClipDict.dictSet(&quot;CT&quot;, obj3.initString(new GooString(mimetype)));<br>
&gt; +  }<br>
&gt; +<br>
&gt; +  obj4.initString(new GooString(&quot;TEMPACCESS&quot;));<br>
&gt; +  obj1.initDict(xref);<br>
&gt; +  obj1.dictSet(&quot;TF&quot;, &amp;obj4);<br>
&gt; +  MClipDict.dictSet(&quot;P&quot;, &amp;obj1);<br>
&gt; +<br>
&gt; +  // File Specification Dictionary<br>
&gt; +  Object fsDict;<br>
&gt; +  fsDict.initDict(xref);<br>
&gt; +  fsDict.dictSet(&quot;Type&quot;, obj1.initName(&quot;Filespec&quot;));<br>
&gt; +  fsDict.dictSet(&quot;F&quot;, obj2.initName((char*)video_name));<br>
&gt; +  fsDict.dictSet(&quot;UF&quot;, obj3.initName((char*)video_name));<br>
<br>
The UF entry should be encoded using PDFDocEncoding or UTF-16BE with a<br>
leading byte-order marker (as defined in 7.9.2.2, &quot;Text String Type&quot;).<br>
<br>
&gt; +<br>
&gt; +  obj3.initDict(xref); // file stream eictionary<br>
&gt; +  obj3.dictSet(&quot;DL&quot;, obj1.initInt(size));<br>
&gt; +  obj3.dictSet(&quot;Length&quot;, obj2.initInt(size));<br>
&gt; +<br>
&gt; +  FileStream *stream = new FileStream(fs, 0, 0, size, &amp;obj3);<br>
&gt; +  obj1.initStream(stream);<br>
&gt; +<br>
&gt; +  Ref newRef;<br>
&gt; +  newRef = xref-&gt;addIndirectObject(&amp;obj1);<br>
&gt; +  obj2.initRef(newRef.num, newRef.gen);<br>
&gt; +  obj1.initDict(xref);<br>
&gt; +  obj1.dictSet(&quot;F&quot;, &amp;obj2);<br>
&gt; +  fsDict.dictSet(&quot;EF&quot;, &amp;obj1);<br>
<br>
This code could be useful for other annots, like FileAttachment<br>
annotations, so I think it could be moved to a protected method in<br>
Annot, something like<br>
<br>
void Annot::createFilespec(const char *filename);<br>
<br>
&gt; +  newRef = xref-&gt;addIndirectObject(&amp;fsDict);<br>
&gt; +  obj1.initRef(newRef.num, newRef.gen);<br>
&gt; +  MClipDict.dictSet(&quot;D&quot;, &amp;obj1);<br>
&gt; +<br>
&gt; +  newRef = xref-&gt;addIndirectObject(&amp;MClipDict);<br>
&gt; +  obj1.initRef(newRef.num, newRef.gen);<br>
&gt; +  MRendition.dictSet(&quot;C&quot;, &amp;obj1);<br>
&gt; +<br>
&gt; +  newRef = xref-&gt;addIndirectObject(&amp;MRendition);<br>
&gt; +  obj1.initRef(newRef.num, newRef.gen);<br>
&gt; +  actionDict.dictSet(&quot;R&quot;, &amp;obj1);<br>
&gt; +<br>
&gt; +  newRef = xref-&gt;addIndirectObject(&amp;actionDict);<br>
&gt; +  obj1.initRef(newRef.num, newRef.gen);<br>
&gt; +  annotObj.dictSet(&quot;A&quot;, &amp;obj1);<br>
&gt; +<br>
&gt; +  return gTrue;<br>
&gt; +}<br>
&gt; +<br>
<br>
Thank you very much for the patch, and sorry again for not reviewing<br>
it before.<br>
<br>
Regards,<br>
--<br>
Carlos Garcia Campos<br>
PGP key: <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x523E6462" target="_blank">http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x523E6462</a><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: signature.asc<br>
Type: application/pgp-signature<br>
Size: 198 bytes<br>
Desc: not available<br>
URL: &lt;<a href="http://lists.freedesktop.org/archives/poppler/attachments/20110320/5c61136e/attachment-0001.pgp" target="_blank">http://lists.freedesktop.org/archives/poppler/attachments/20110320/5c61136e/attachment-0001.pgp</a>&gt;<br>

<br>
------------------------------<br>
<br>
_______________________________________________<br>
poppler mailing list<br>
<a href="mailto:poppler@lists.freedesktop.org">poppler@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/poppler" target="_blank">http://lists.freedesktop.org/mailman/listinfo/poppler</a><br>
<br>
<br>
End of poppler Digest, Vol 73, Issue 27<br>
***************************************<br>
</blockquote></div><br>