#include "audioInfo.h"
#include "audioStreamInfo.h"
-#include <iostream>
+#include <QString>
#include <cstdlib>
-AudioInfo::AudioInfo(Mlt::Producer *producer)
+AudioInfo::AudioInfo(Mlt::Producer *producer) :
+ m_producer(NULL)
{
// Since we already receive an MLT producer, we do not need to initialize MLT:
// Mlt::Factory::init(NULL);
// Get the number of streams and add the information of each of them if it is an audio stream.
- int streams = atoi(producer->get("meta.media.nb_streams"));
- for (int i = 0; i < streams; i++) {
- std::string propertyName = QString("meta.media.%1.stream.type").arg(i).toStdString();
-
- if (strcmp("audio", producer->get(propertyName.c_str())) == 0) {
+ int streams = producer->get_int("meta.media.nb_streams");
+ for (int i = 0; i < streams; ++i) {
+ QByteArray propertyName = QString::fromLatin1("meta.media.%1.stream.type").arg(i).toLocal8Bit();
+ const char* streamtype = producer->get(propertyName.data());
+ if (streamtype && strcmp("audio", streamtype) == 0) {
m_list << new AudioStreamInfo(producer, i);
}
-
}
}