Draft: RichMediaInstance: add Asset field
After seeing Okular's handling of (Flash) Rich Media (https://invent.kde.org/graphics/okular/-/blob/master/generators/poppler/generator_pdf.cpp#L244-335), I thought it wouldn't be hard to add support of plain Rich Media, e.g.: (read objects from bottom)
2 0 obj
<<
/Type /Filespec
/F (video.mp4)
/Desc (video.mp4)
/EF <<
/F 1 0 R
>>
>>
endobj
3 0 obj
<<
/Type /RichMediaInstance
/Subtype /Video
/Asset 2 0 R
>>
endobj
4 0 obj
<<
/Type /RichMediaConfiguration
/Subtype /Video
/Instances [ 3 0 R ]
>>
endobj
8 0 obj
<<
/Type /Annot
/Subtype /RichMedia
/RichMediaSettings <<
/Activation <<
/Condition /PV
>>
/Deactivation <<
/Condition /XD
>>
>>
/RichMediaContent <<
/Assets <<
/Names [ (video.mp4) 2 0 R ]
>>
/Configurations [ 4 0 R ]
>>
/AP <<
/N 5 0 R
>>
/Border [ 0 0 0 ]
/NM (video.mp4)
/Contents (rm 'video.mp4')
/Rect [ 70.866 317.48 524.409 771.024 ]
>>
endobj
Poppler however, currently doesn't expose the /Asset
field of RichMediaInstance. The /Asset
should be also contained in the /Assets
array. I know nothing about handling of object / indirect references in poppler, so my first naive attempt was to keep it simple and not share it. Also maybe some fields from /Presentation
dictionary (nested in /Activation
) will be useful, but I need to confirm this.
I tried to adapt Okular with these changes applied, but no luck so far -- maybe I didn't manage to use the custom compiled library, or the code is flawed.
If this code is unusable and somebody has an easy way to do it please do. If not I will try to get this done (for possible use in Okular and Evince), but maybe no sooner than at end of July.
Complete demo file is attached: simple.pdf