本文整理汇总了C++中MediaObject类的典型用法代码示例。如果您正苦于以下问题:C++ MediaObject类的具体用法?C++ MediaObject怎么用?C++ MediaObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MediaObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/* Thread that does the buffering of segments */
void* DASHReceiver::DoBuffering (void *receiver)
{
DASHReceiver *dashreceiver = (DASHReceiver *) receiver;
uint32_t number = 0;
MediaObject *media = dashreceiver->logic->GetSegment(number);
while(media != NULL)
{
media->StartDownload();
media->WaitFinished();
dashreceiver->buffer->Push(media);
number++;
/* Just for demonstration purpose
*
* Do something with the HTTPHeader...
* e.g. parse it for "Content-Length:" to retrieve the segment size in bytes
*/
std::string header = media->GetHTTPTransactionList().at(0)->HTTPHeader();
media = dashreceiver->logic->GetSegment(number);
std::cout << "Buffer size in segments: " << dashreceiver->buffer->Length() << std::endl;
}
dashreceiver->buffer->SetEOS(true);
return NULL;
}
示例2: while
/* Thread that does the buffering of segments */
void* DASHReceiver::DoBuffering (void *receiver)
{
DASHReceiver *dashReceiver = (DASHReceiver *) receiver;
dashReceiver->DownloadInitSegment(dashReceiver->GetRepresentation());
MediaObject *media = dashReceiver->GetNextSegment();
//media = dashReceiver->GetNextSegment();
while(media != NULL && dashReceiver->isBuffering)
{
media->StartDownload();
if (!dashReceiver->buffer->PushBack(media))
{
delete(media);
media = NULL;
return NULL;
}
media->WaitFinished();
dashReceiver->NotifySegmentDownloaded();
media = dashReceiver->GetNextSegment();
}
dashReceiver->buffer->SetEOS(true);
return NULL;
}
示例3: while
/* Thread that does the buffering of segments */
void* DASHManager::DoBuffering (void *receiver)
{
DASHManager *dashmanager = (DASHManager *) receiver;
MediaObject *media = dashmanager->logic->GetSegment();
while(media != NULL && dashmanager->isDownloading)
{
media->StartDownload();
if (!dashmanager->buffer->PushBack(media))
return NULL;
media->WaitFinished();
/* Just for demonstration purpose
*
* Do something with the HTTPHeader...
* e.g. parse it for "Content-Length:" to retrieve the segment size in bytes
*/
std::string header = media->GetHTTPTransactionList().at(0)->HTTPHeader();
dashmanager->NotifySegmentDownloaded();
media = dashmanager->logic->GetSegment();
}
dashmanager->buffer->SetEOS(true);
return NULL;
}
示例4: main
int main(){
/* test des objets */
MediaObject* m = new MediaObject ("m",1,"C/Desktop");
m->print();
MediaObject** tab = new MediaObject*[5];
unsigned int count = 0;
tab[count++] = new Photo ("test_1",1 ,"C/Desktop", "Telecom");
tab[count++] = new Video ("test_2",2 ,"C/Desktop", 15);
tab[count++] = new Photo("test_3",3 ,"C/Desktop", "Bordeaux");
tab[count++] = new Video("test_4",4 ,"C/Desktop", 35);
tab[count++] = new Video("test_5",2 ,"C/Desktop", 40);
for(int i=0; i<5; i++) {
tab[i]->print();
cout << "\n";
}
cout << "\ntest de film et des tableaux";
int chapters [3] = {1, 2, 3};
Film* film_1= new Film ("premierFilm", 1258,"~/Desktop",50,3,chapters);
film_1->print();
chapters[0] = 5; // on verifie que le tableau a bien etait copie
film_1->print();
}
示例5: endConnectionChange
bool Backend::endConnectionChange(QSet<QObject *> objects)
{
//end of a transaction
for(QSet<QObject *>::const_iterator it = objects.begin(); it != objects.end(); ++it) {
if (BackendNode *node = qobject_cast<BackendNode*>(*it)) {
MediaObject *mo = node->mediaObject();
if (mo) {
switch(mo->transactionState)
{
case Phonon::ErrorState:
case Phonon::StoppedState:
case Phonon::LoadingState:
//nothing to do
break;
case Phonon::PausedState:
mo->transactionState = Phonon::StoppedState;
mo->pause();
break;
default:
mo->transactionState = Phonon::StoppedState;
mo->play();
break;
}
if (mo->state() == Phonon::ErrorState)
return false;
}
}
}
return true;
}
示例6: foreach
foreach (QObject *object, objects) {
MediaNode *sourceNode = qobject_cast<MediaNode *>(object);
MediaObject *media = sourceNode->root();
if (media) {
media->saveState();
return true;
}
}
示例7: connectNodes
bool Backend::connectNodes(QObject *node1, QObject *node2)
{
MediaObject *mediaObject = qobject_cast<MediaObject*> (node1);
AudioOutput *audioOutput = qobject_cast<AudioOutput*> (node2);
if (mediaObject && audioOutput)
mediaObject->setAudioOutput(audioOutput);
return true;
}
示例8: AudioOutput
MediaObject *createPlayer(Phonon::Category category, const MediaSource &source)
{
MediaObject *mo = new MediaObject;
AudioOutput *ao = new AudioOutput(category, mo);
createPath(mo, ao);
if (isPlayable(source.type())) {
mo->setCurrentSource(source);
}
return mo;
}
示例9: qWarning
void Player::handleMetadataChanged ()
{
MediaObject *object = qobject_cast<MediaObject*> (sender ());
if (!object)
{
qWarning () << Q_FUNC_INFO
<< "not a MediaObject"
<< object;
return;
}
MediaSource source = object->currentSource ();
for (int i = 0; i < QueueModel_->rowCount (); ++i)
{
QStandardItem *item = QueueModel_->item (i);
if (source == *item->data (SourceRole).value<MediaSource*> ())
{
QStringList title = object->metaData (TitleMetaData);
QStringList album = object->metaData (AlbumMetaData);
QStringList artist = object->metaData (ArtistMetaData);
QString text;
if (!title.isEmpty () &&
!title.at (0).isEmpty ())
{
text += title.at (0);
text += " - ";
}
if (!album.isEmpty () &&
!album.at (0).isEmpty ())
{
text += album.at (0);
text += " - ";
}
if (!artist.isEmpty () &&
!artist.at (0).isEmpty ())
{
text += artist.at (0);
text += " - ";
}
text = text.left (text.size () - 3);
if (!text.isEmpty ())
item->setText (text);
break;
}
}
if (object != Ui_.Player_->GetMediaObject ())
object->deleteLater ();
}
示例10: Q_ASSERT
/// Handle events (basically just pass it on)
void AudioDataOutput::upstreamEvent(Event *e)
{
Q_ASSERT(e);
if (e->type() == Event::IsThereAXineEngineForMe) {
// yes there is
MediaObject *mediaObject = dynamic_cast<MediaObject*>(m_source); //TODO; qobject_cast?
if (mediaObject) {
SourceNode::downstreamEvent(new HeresYourXineStreamEvent(mediaObject->stream()));
m_mediaObject = mediaObject;
}
} else
SourceNode::upstreamEvent(e);
}
示例11:
void DASHReceiver::DownloadInitSegment (IRepresentation* rep)
{
if (this->InitSegmentExists(rep))
return;
MediaObject *initSeg = NULL;
initSeg = this->GetInitSegment();
if (initSeg)
{
initSeg->StartDownload();
this->initSegments[rep] = initSeg;
}
}
示例12: debugMediaObject
static QByteArray debugMediaObject(const MediaObject& mediaObject)
{
QByteArray byteArray;
QTextStream stream(&byteArray);
const QMetaObject* metaObject = mediaObject.metaObject();
QMetaEnum phononStates = metaObject->enumerator(metaObject->indexOfEnumerator("PhononState"));
stream << "Phonon::MediaObject(";
stream << "State:" << phononStates.valueToKey(mediaObject.state());
stream << "| Current time:" << mediaObject.currentTime();
stream << "| Remaining time:" << mediaObject.remainingTime();
stream << "| Total time:" << mediaObject.totalTime();
stream << "| Meta-data:";
QMultiMap<QString, QString> map = mediaObject.metaData();
for (QMap<QString, QString>::const_iterator it = map.constBegin();
it != map.constEnd(); ++it) {
stream << "(" << it.key() << ", " << it.value() << ")";
}
stream << "| Has video:" << mediaObject.hasVideo();
stream << "| Is seekable:" << mediaObject.isSeekable();
stream << ")";
stream.flush();
return byteArray;
}
示例13: LOGE
bool DASHManager::CreateAVDecoder ()
{
MediaObject *mediaObject = this->buffer->GetFront();
// initSegForMediaObject may be NULL => BaseUrls
if (!mediaObject){
LOGE("Failed to fetch MediaObject");
return false;
}
MediaObject *initSegForMediaObject = this->receiver->FindInitSegment(mediaObject->GetRepresentation());
this->mediaObjectDecoder = new MediaObjectDecoder(initSegForMediaObject, mediaObject, this);
return this->mediaObjectDecoder->Start();
}
示例14:
int DASHReceiver::IORead (uint8_t *buf, int buf_size)
{
/* FFMpeg callback that consumes data from the buffer for decoding */
MediaObject *media = this->buffer->Front();
if(media == NULL)
return 0;
int ret = media->Read(buf, buf_size);
if(ret == 0)
this->buffer->Pop();
else
return ret;
return this->IORead(buf, buf_size);
}
示例15:
int DASHManager::Read (uint8_t *buf, int buf_size)
{
/* FFMpeg callback that consumes data from the buffer for decoding */
MediaObject *media = this->buffer->Front();
if(media == NULL)
return 0;
int ret = media->Read(buf, buf_size);
if(ret == 0)
this->buffer->PopFront();
else
return ret;
this->readSegmentCount++;
this->NotifySegmentDecodingStarted();
return this->Read(buf, buf_size);
}