File indexing completed on 2024-04-28 04:51:59

0001 /*
0002 SPDX-FileCopyrightText: 2012 Simon A. Eugster (Granjow)  <simon.eu@gmail.com>
0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QString>
0009 #include <QMap>
0010 #include <memory>
0011 #include <mlt++/Mlt.h>
0012 
0013 /** @class AudioStreamInfo
0014     @brief Provides easy access to properties of an audio stream.
0015   */
0016 class AudioStreamInfo
0017 {
0018 public:
0019     // TODO make that access a shared ptr instead of raw
0020     AudioStreamInfo(const std::shared_ptr<Mlt::Producer> &producer, int audioStreamIndex, bool playlist = false);
0021     ~AudioStreamInfo();
0022 
0023     int samplingRate() const;
0024     int channels() const;
0025     /** @brief returns a list of audio stream index > stream description */
0026     QMap <int, QString> streams() const;
0027     /** @brief returns a list of audio stream index > channels per stream */
0028     QMap <int, int> streamChannels() const;
0029     /** @brief returns the channel count for a stream */
0030     int channelsForStream(int stream) const;
0031     /** @brief returns a list of audio channels per active stream */
0032     QList <int> activeStreamChannels() const;
0033     /** @brief returns a list of enabled audio stream indexes > stream description */
0034     QMap <int, QString> activeStreams() const;
0035     int bitrate() const;
0036     const QString &samplingFormat() const;
0037     int audio_index() const;
0038     int ffmpeg_audio_index() const;
0039     void dumpInfo() const;
0040     void setAudioIndex(const std::shared_ptr<Mlt::Producer> &producer, int ix);
0041     QMap<int, QString> streamInfo(Mlt::Properties sourceProperties);
0042     void updateActiveStreams(const QString &activeStreams);
0043     void renameStream(int ix, const QString &streamName);
0044 
0045 private:
0046     int m_audioStreamIndex;
0047     QMap <int, QString> m_audioStreams;
0048     QMap <int, int> m_audioChannels;
0049     QList <int> m_activeStreams;
0050     int m_ffmpegAudioIndex;
0051     int m_samplingRate;
0052     int m_channels;
0053     int m_bitRate;
0054     QString m_samplingFormat;
0055 };