[NTG-context] embedded sounds

Pablo Rodriguez oinos at gmx.es
Tue Oct 9 19:19:25 CEST 2018


Hi Hans,

this is a lighter version from sound-001.tex from your test samples:

    \definerenderingwindow
      [example]
      [width=0pt,height=0pt,frame=off]

    \setupinteraction[state=start]

    \useexternalrendering
      [mysound]
      [audio/x-mp3] % audio/x-mp3
      [sound.mp3]
      %~ [embed]

    \definereference [StartSoundTrack] [StartRendering{mysound}]
    \definereference [StopSoundTrack]  [StopRendering{mysound}]

    \definelayer[resources][width=\paperwidth,height=\paperheight]

    \setupbackgrounds[page][background=resources]

    \setupbodyfont[100pt]

    \starttext\bf\ss

        \setlayer[resources]{\placerenderingwindow[example][mysound]}

        \startTEXpage
            \button{start}[StartSoundTrack]
            \button{stop}[StopSoundTrack]
        \stopTEXpage

    \stoptext

As reported before
(https://mailman.ntg.nl/pipermail/ntg-context/2018/092327.html), sound
is played fine when not embedded. But it won’t play embedded files.

Without embedded sound, the relevant /Filespec reads:

    7 0 obj
    <<
      /F (sound.mp3)
      /Type /Filespec
    >>
    endobj

With an embedded sound, /Filespec and /EmbeddedFile read:

    7 0 obj
    <<
      /Subtype /audio#2Fx-mp3
      /Type /EmbeddedFile
      /Length 49006
    >>
    stream
    endstream
    endobj

    8 0 obj
    <<
      /EF <<
        /F 7 0 R
      >>
      /F (sound.mp3)
      /Type /Filespec
      /UF (\376\377\000s\000o\000u\000n\000d\000.\000m\000p\0003)
    >>
    endobj

    10 0 obj
    <<
      /EF 8 0 R
      /F (sound.mp3)
      /Type /Filespec
    >>
    endobj

I don’t know why there are two /Filespec objects, since they are duplicated.

In any case, the value for the /EF entry has to be a dictionary that
points to the /EmbeddedFile (such as in object 8).

I’m afraid that the code that generates the second /Filespec object
(object 10 in the code above) is wrong.

I attach a modified file fixing the issue from the PDF document
generated by ConTeXt.

I hope this help to fix the issue.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: embedded-mp3-sound.pdf
Type: application/pdf
Size: 57381 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20181009/b6cbe54e/attachment-0001.pdf>


More information about the ntg-context mailing list