[poppler] poppler/poppler: Link.cc, 1.4, 1.5 Link.h, 1.2,
1.3 Makefile.am, 1.25, 1.26 Page.cc, 1.12, 1.13 Page.h, 1.5,
1.6 Sound.cc, NONE, 1.1 Sound.h, NONE, 1.1
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Oct 8 13:38:49 PDT 2006
- Previous message: [poppler] poppler: ChangeLog,1.436,1.437
- Next message: [poppler] poppler/qt4/src: Makefile.am, 1.13, 1.14 poppler-link.cc,
1.4, 1.5 poppler-link.h, 1.3, 1.4 poppler-page.cc, 1.26,
1.27 poppler-qt4.h, 1.34, 1.35 poppler-sound.cc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/poppler/poppler/poppler
In directory kemper:/tmp/cvs-serv16976/poppler
Modified Files:
Link.cc Link.h Makefile.am Page.cc Page.h
Added Files:
Sound.cc Sound.h
Log Message:
* poppler/Link.cc:
* poppler/Link.h:
* poppler/Makefile.am:
* poppler/Page.cc:
* poppler/Page.h:
* poppler/Sound.cc:
* poppler/Sound.h: Make poppler able to read Sound objects, Sound
actions and Opening/Closing page actions. Patch by Pino Toscano.
* qt4/src/Makefile.am:
* qt4/src/poppler-link.cc:
* qt4/src/poppler-link.h:
* qt4/src/poppler-qt4.h:
* qt4/src/poppler-page.cc:
* qt4/src/poppler-sound.cc: Support for sounds, sound links and page
actions in the Qt4 backend. Patch by Pino Toscano.
Index: Link.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Link.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Link.cc 18 Jan 2006 22:32:13 -0000 1.4
+++ Link.cc 8 Oct 2006 20:38:47 -0000 1.5
@@ -21,6 +21,7 @@
#include "Array.h"
#include "Dict.h"
#include "Link.h"
+#include "Sound.h"
#include "UGooString.h"
//------------------------------------------------------------------------
@@ -88,6 +89,10 @@
obj3.free();
obj4.free();
+ // Sound action
+ } else if (obj2.isName("Sound")) {
+ action = new LinkSound(obj);
+
// unknown action
} else if (obj2.isName()) {
action = new LinkUnknown(obj2.getName());
@@ -626,6 +631,54 @@
}
//------------------------------------------------------------------------
+// LinkSound
+//------------------------------------------------------------------------
+
+LinkSound::LinkSound(Object *soundObj) {
+ volume = 1.0;
+ sync = gFalse;
+ repeat = gFalse;
+ mix = gFalse;
+ sound = NULL;
+ if (soundObj->isDict())
+ {
+ Object tmp;
+ // volume
+ soundObj->dictLookup("Volume", &tmp);
+ if (tmp.isNum()) {
+ volume = tmp.getNum();
+ }
+ tmp.free();
+ // sync
+ soundObj->dictLookup("Synchronous", &tmp);
+ if (tmp.isBool()) {
+ sync = tmp.getBool();
+ }
+ tmp.free();
+ // repeat
+ soundObj->dictLookup("Repeat", &tmp);
+ if (tmp.isBool()) {
+ repeat = tmp.getBool();
+ }
+ tmp.free();
+ // mix
+ soundObj->dictLookup("Mix", &tmp);
+ if (tmp.isBool()) {
+ mix = tmp.getBool();
+ }
+ tmp.free();
+ // 'Sound' object
+ soundObj->dictLookup("Sound", &tmp);
+ sound = Sound::parseSound(&tmp);
+ tmp.free();
+ }
+}
+
+LinkSound::~LinkSound() {
+ delete sound;
+}
+
+//------------------------------------------------------------------------
// LinkUnknown
//------------------------------------------------------------------------
Index: Link.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Link.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Link.h 18 Jan 2006 22:32:13 -0000 1.2
+++ Link.h 8 Oct 2006 20:38:47 -0000 1.3
@@ -19,6 +19,7 @@
class UGooString;
class Array;
class Dict;
+class Sound;
//------------------------------------------------------------------------
// LinkAction
@@ -31,6 +32,7 @@
actionURI, // URI
actionNamed, // named action
actionMovie, // movie action
+ actionSound, // sound action
actionUnknown // anything else
};
@@ -276,6 +278,36 @@
};
//------------------------------------------------------------------------
+// LinkSound
+//------------------------------------------------------------------------
+
+class LinkSound: public LinkAction {
+public:
+
+ LinkSound(Object *soundObj);
+
+ virtual ~LinkSound();
+
+ virtual GBool isOk() { return sound != NULL; }
+
+ virtual LinkActionKind getKind() { return actionSound; }
+
+ double getVolume() { return volume; }
+ GBool getSynchronous() { return sync; }
+ GBool getRepeat() { return repeat; }
+ GBool getMix() { return mix; }
+ Sound *getSound() { return sound; }
+
+private:
+
+ double volume;
+ GBool sync;
+ GBool repeat;
+ GBool mix;
+ Sound *sound;
+};
+
+//------------------------------------------------------------------------
// LinkUnknown
//------------------------------------------------------------------------
Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Makefile.am,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- Makefile.am 18 Sep 2006 15:40:50 -0000 1.25
+++ Makefile.am 8 Oct 2006 20:38:47 -0000 1.26
@@ -156,6 +156,7 @@
UGooString.h \
UTF8.h \
XpdfPluginAPI.h \
+ Sound.h \
poppler-config.h
endif
@@ -208,6 +209,7 @@
PageLabelInfo.cc \
SecurityHandler.cc \
UGooString.cc \
+ Sound.cc \
XpdfPluginAPI.cc
EXTRA_DIST = gen-unicode-tables.py
Index: Page.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Page.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Page.cc 16 Mar 2006 22:04:56 -0000 1.12
+++ Page.cc 8 Oct 2006 20:38:47 -0000 1.13
@@ -230,6 +230,14 @@
num, thumb.getTypeName());
thumb.initNull();
}
+
+ // actions
+ pageDict->lookupNF("AA", &actions);
+ if (!(actions.isDict() || actions.isNull())) {
+ error(-1, "Page additional action object (page %d) is wrong type (%s)",
+ num, actions.getTypeName());
+ actions.initNull();
+ }
return;
Index: Page.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Page.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Page.h 30 Oct 2005 20:29:05 -0000 1.5
+++ Page.h 8 Oct 2006 20:38:47 -0000 1.6
@@ -151,6 +151,9 @@
// Get transition.
Object *getTrans(Object *obj) { return trans.fetch(xref, obj); }
+ // Get actions
+ Object *getActions(Object *obj) { return actions.fetch(xref, obj); }
+
Gfx *createGfx(OutputDev *out, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
@@ -194,6 +197,7 @@
Object contents; // page contents
Object thumb; // page thumbnail
Object trans; // page transition
+ Object actions; // page addiction actions
GBool ok; // true if page is valid
};
--- NEW FILE: Sound.cc ---
/* Sound.cc - an object that holds the sound structure
* Copyright (C) 2006, Pino Toscano <pino at kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include "GooString.h"
#include "Object.h"
#include "Sound.h"
#include "Stream.h"
Sound *Sound::parseSound(Object *obj)
{
// let's try to see if this Object is a Sound, according to the PDF specs
// (section 9.2)
Stream *str = NULL;
// the Object must be a Stream
if (obj->isStream()) {
str = obj->getStream();
} else {
return NULL;
}
// the Stream must have a Dict
Dict *dict = str->getDict();
if (dict == NULL)
return NULL;
Object tmp;
// the Dict must have the 'R' key of type num
dict->lookup("R", &tmp);
if (tmp.isNum()) {
return new Sound(obj);
} else {
return NULL;
}
}
Sound::Sound(Object *obj)
{
streamObj = new Object();
streamObj->initNull();
obj->copy(streamObj);
}
Sound::~Sound()
{
streamObj->free();
}
Stream *Sound::getStream()
{
return streamObj->getStream();
}
--- NEW FILE: Sound.h ---
/* Sound.h - an object that holds the sound structure
* Copyright (C) 2006, Pino Toscano <pino at kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef Sound_H
#define Sound_H
class Object;
class Stream;
//------------------------------------------------------------------------
class Sound
{
public:
// Try to parse the Object s
static Sound *parseSound(Object *s);
// Destructor
~Sound();
Object *getObject() { return streamObj; }
Stream *getStream();
private:
// Create a sound. The Object obj is ensured to be a Stream with a Dict
Sound(Object *obj);
Object *streamObj;
};
#endif
- Previous message: [poppler] poppler: ChangeLog,1.436,1.437
- Next message: [poppler] poppler/qt4/src: Makefile.am, 1.13, 1.14 poppler-link.cc,
1.4, 1.5 poppler-link.h, 1.3, 1.4 poppler-page.cc, 1.26,
1.27 poppler-qt4.h, 1.34, 1.35 poppler-sound.cc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the poppler
mailing list