Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:23:50

0001 //*********************************************************************************
0002 //                               Rendition.h
0003 //---------------------------------------------------------------------------------
0004 //
0005 //---------------------------------------------------------------------------------
0006 // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008
0007 // Carlos Garcia Campos <carlosgc@gnome.org> (c) 2010
0008 // Albert Astals Cid <aacid@kde.org> (C) 2017, 2018, 2021
0009 //
0010 // This program is free software; you can redistribute it and/or modify
0011 // it under the terms of the GNU General Public License as published by
0012 // the Free Software Foundation; either version 2 of the License, or
0013 // (at your option) any later version.
0014 //
0015 // This program is distributed in the hope that it will be useful,
0016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018 // GNU General Public License for more details.
0019 //
0020 // You should have received a copy of the GNU General Public License
0021 // along with this program; if not, write to the Free Software
0022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0023 //*********************************************************************************
0024 
0025 #ifndef _RENDITION_H_
0026 #define _RENDITION_H_
0027 
0028 #include "Object.h"
0029 
0030 struct MediaWindowParameters
0031 {
0032 
0033     MediaWindowParameters();
0034     ~MediaWindowParameters();
0035 
0036     // parse from a floating window parameters dictionary
0037     void parseFWParams(Object *obj);
0038 
0039     enum MediaWindowType
0040     {
0041         windowFloating = 0,
0042         windowFullscreen,
0043         windowHidden,
0044         windowEmbedded
0045     };
0046 
0047     enum MediaWindowRelativeTo
0048     {
0049         windowRelativeToDocument = 0,
0050         windowRelativeToApplication,
0051         windowRelativeToDesktop
0052     };
0053 
0054     // DEFAULT VALUE
0055 
0056     MediaWindowType type; // movieWindowEmbedded
0057 
0058     int width; // -1
0059     int height; // -1
0060 
0061     // floating window position
0062     MediaWindowRelativeTo relativeTo; // windowRelativeToDocument (or to desktop)
0063     double XPosition; // 0.5
0064     double YPosition; // 0.5
0065 
0066     bool hasTitleBar; // true
0067     bool hasCloseButton; // true
0068     bool isResizeable; // true
0069 };
0070 
0071 struct MediaParameters
0072 {
0073 
0074     MediaParameters();
0075     ~MediaParameters();
0076 
0077     // parse from a "Media Play Parameters" dictionary
0078     void parseMediaPlayParameters(Object *playObj);
0079     // parse from a "Media Screen Parameters" dictionary
0080     void parseMediaScreenParameters(Object *screenObj);
0081 
0082     enum MediaFittingPolicy
0083     {
0084         fittingMeet = 0,
0085         fittingSlice,
0086         fittingFill,
0087         fittingScroll,
0088         fittingHidden,
0089         fittingUndefined
0090     };
0091 
0092     struct Color
0093     {
0094         double r, g, b;
0095     };
0096 
0097     int duration; // 0
0098 
0099     int volume; // 100
0100 
0101     // defined in media play parameters, p 770
0102     // correspond to 'fit' SMIL's attribute
0103     MediaFittingPolicy fittingPolicy; // fittingUndefined
0104 
0105     bool autoPlay; // true
0106 
0107     // repeat count, can be real values, 0 means forever
0108     double repeatCount; // 1.0
0109 
0110     // background color                      // black = (0.0 0.0 0.0)
0111     Color bgColor;
0112 
0113     // opacity in [0.0 1.0]
0114     double opacity; // 1.0
0115 
0116     bool showControls; // false
0117 
0118     MediaWindowParameters windowParams;
0119 };
0120 
0121 class POPPLER_PRIVATE_EXPORT MediaRendition
0122 {
0123 public:
0124     explicit MediaRendition(Object *obj);
0125     MediaRendition(const MediaRendition &other);
0126     ~MediaRendition();
0127     MediaRendition &operator=(const MediaRendition &) = delete;
0128 
0129     bool isOk() const { return ok; }
0130 
0131     const MediaParameters *getMHParameters() const { return &MH; }
0132     const MediaParameters *getBEParameters() const { return &BE; }
0133 
0134     const GooString *getContentType() const { return contentType; }
0135     const GooString *getFileName() const { return fileName; }
0136 
0137     bool getIsEmbedded() const { return isEmbedded; }
0138     Stream *getEmbbededStream() const { return isEmbedded ? embeddedStreamObject.getStream() : nullptr; }
0139     const Object *getEmbbededStreamObject() const { return isEmbedded ? &embeddedStreamObject : nullptr; }
0140     // write embedded stream to file
0141     void outputToFile(FILE *);
0142 
0143     MediaRendition *copy() const;
0144 
0145 private:
0146     bool ok;
0147 
0148     // "Must Honor" parameters
0149     MediaParameters MH;
0150     // "Best Effort" parameters
0151     MediaParameters BE;
0152 
0153     bool isEmbedded;
0154 
0155     GooString *contentType;
0156 
0157     // if it's embedded
0158     Object embeddedStreamObject;
0159 
0160     // if it's not embedded
0161     GooString *fileName;
0162 };
0163 
0164 #endif /* _RENDITION_H_ */