[Poppler-bugs] [Bug 5452] support for embedded media (e.g. videos and sound)
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Sat May 29 06:17:38 PDT 2010
https://bugs.freedesktop.org/show_bug.cgi?id=5452
--- Comment #8 from iloveyoutaiwanmb at yahoo.com.tw 2010-05-29 06:17:38 PDT ---
QList<Poppler::Link*> pageLinks = doc->page(currentPage)->links();
if (pageLinks.isEmpty()){
QLabel *msgLabel = new QLabel(tr("No L's"));
msgLabel->setVisible(true);
}
else{
//QLabel *msgLabel = new QLabel(tr("W L's"));
//msgLabel->setVisible(true);
int linkCount = pageLinks.count();
QString outStr;
foreach (Poppler::Link* link, pageLinks){
bool firstMP3 = true;
if (link==0){
;
}
if ( link != 0 ){
switch (link->linkType()){
case Poppler::Link::Sound:{
outStr.append( "Sound" );
void *linktmp = (void*) link;
Poppler::LinkSound* ls = (Poppler::LinkSound *)(linktmp);
Poppler::SoundObject *so = ls->sound();
double volume = ls->volume();
QRectF linkArea = ls->linkArea();
bool mix = ls->mix();
if ( so->soundType() == Poppler::SoundObject::Embedded ){
if ( so->data().size() > 0 ){
QByteArray soByteArray(so->data());
int balen = soByteArray.size();
Poppler::SoundObject::SoundEncoding se =
so->soundEncoding();
double samplingRate = so->samplingRate();
int channels = so->channels();
int bitsPerSample = so->bitsPerSample();
QFile destFile("./test.raw");
destFile.open(QIODevice::WriteOnly);
destFile.write(soByteArray.data(),
soByteArray.size());
if ( firstMP3==true ){
firstMP3 = false;
/*
QWidget *widget = new QWidget;
widget->setWindowTitle("Video Player");
widget->resize(400,400);
widget->show();
Phonon::VideoPlayer *player = new
Phonon::VideoPlayer(Phonon::VideoCategory, this);
player->load(Phonon::MediaSource(soByteArray));
player->play();
*/
}
else{
}
}
else{
}
}
break;
}
-------------
I've saved the RAW data into a file "./test.raw". Then, the file was
transformed into WAV format by SOX. But, after all, it's full of noise!
Cobra
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Poppler-bugs
mailing list