2 Copyright (C) 2012 Simon A. Eugster (Granjow) <simon.eu@gmail.com>
3 This file is part of kdenlive. See www.kdenlive.org.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
11 #include "audioStreamInfo.h"
17 AudioStreamInfo::AudioStreamInfo(Mlt::Producer *producer, int audioStreamIndex) :
18 m_audioStreamIndex(audioStreamIndex)
22 key = QString::fromLatin1("meta.media.%1.codec.sample_fmt").arg(audioStreamIndex).toLocal8Bit();
23 m_samplingFormat = QString::fromLatin1(producer->get(key.data()));
25 key = QString::fromLatin1("meta.media.%1.codec.sample_rate").arg(audioStreamIndex).toLocal8Bit();
26 m_samplingRate = atoi(producer->get(key.data()));
28 key = QString::fromLatin1("meta.media.%1.codec.bit_rate").arg(audioStreamIndex).toLocal8Bit();
29 m_bitRate = atoi(producer->get(key.data()));
31 key = QString::fromLatin1("meta.media.%1.codec.channels").arg(audioStreamIndex).toLocal8Bit();
32 m_channels = atoi(producer->get(key.data()));
34 key = QString::fromLatin1("meta.media.%1.codec.name").arg(audioStreamIndex).toLocal8Bit();
35 m_codecName = QString::fromLatin1(producer->get(key.data()));
37 key = QString::fromLatin1("meta.media.%1.codec.long_name").arg(audioStreamIndex).toLocal8Bit();
38 m_codecLongName = QString::fromLatin1(producer->get(key.data()));
41 AudioStreamInfo::~AudioStreamInfo()
45 int AudioStreamInfo::streamIndex() const
47 return m_audioStreamIndex;
50 int AudioStreamInfo::samplingRate() const
52 return m_samplingRate;
55 int AudioStreamInfo::channels() const
60 int AudioStreamInfo::bitrate() const
65 const QString& AudioStreamInfo::codecName(bool longName) const
68 return m_codecLongName;
74 void AudioStreamInfo::dumpInfo() const
76 qDebug() << "Info for audio stream " << m_audioStreamIndex
77 << "\n\tCodec: " << m_codecLongName.toLocal8Bit().data() << " (" << m_codecName.toLocal8Bit().data() << ")"
78 << "\n\tChannels: " << m_channels
79 << "\n\tSampling rate: " << m_samplingRate
80 << "\n\tBit rate: " << m_bitRate;