1 /***************************************************************************
2 * Copyright (C) 2012 by Simon Andreas Eugster (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 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
11 #include "audioStreamInfo.h"
16 AudioStreamInfo::AudioStreamInfo(Mlt::Producer *producer, int audioStreamIndex) :
17 m_audioStreamIndex(audioStreamIndex)
22 key = QString("meta.media.%1.codec.sample_fmt").arg(audioStreamIndex).toStdString();
23 m_samplingFormat = QString(producer->get(key.c_str()));
25 key = QString("meta.media.%1.codec.sample_rate").arg(audioStreamIndex).toStdString();
26 m_samplingRate = atoi(producer->get(key.c_str()));
28 key = QString("meta.media.%1.codec.bit_rate").arg(audioStreamIndex).toStdString();
29 m_bitRate = atoi(producer->get(key.c_str()));
31 key = QString("meta.media.%1.codec.channels").arg(audioStreamIndex).toStdString();
32 m_channels = atoi(producer->get(key.c_str()));
34 key = QString("meta.media.%1.codec.name").arg(audioStreamIndex).toStdString();
35 m_codecName = QString(producer->get(key.c_str()));
37 key = QString("meta.media.%1.codec.long_name").arg(audioStreamIndex).toStdString();
38 m_codecLongName = QString(producer->get(key.c_str()));
40 AudioStreamInfo::~AudioStreamInfo()
44 int AudioStreamInfo::streamIndex() const { return m_audioStreamIndex; }
45 int AudioStreamInfo::samplingRate() const { return m_samplingRate; }
46 int AudioStreamInfo::channels() const { return m_channels; }
47 int AudioStreamInfo::bitrate() const { return m_bitRate; }
48 const QString& AudioStreamInfo::codecName(bool longName) const
51 return m_codecLongName;
57 void AudioStreamInfo::dumpInfo() const
59 std::cout << "Info for audio stream " << m_audioStreamIndex << std::endl
60 << "\tCodec: " << m_codecLongName.toStdString() << " (" << m_codecName.toStdString() << ")" << std::endl
61 << "\tChannels: " << m_channels << std::endl
62 << "\tSampling rate: " << m_samplingRate << std::endl
63 << "\tBit rate: " << m_bitRate << std::endl