Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/audaspace/plugins/ffmpeg/FFMPEGReader.h')
-rw-r--r--extern/audaspace/plugins/ffmpeg/FFMPEGReader.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h
index d613457c220..70f13911eca 100644
--- a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h
+++ b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h
@@ -29,9 +29,11 @@
#include "respec/ConverterFunctions.h"
#include "IReader.h"
#include "util/Buffer.h"
+#include "file/FileInfo.h"
#include <string>
#include <memory>
+#include <vector>
struct AVCodecContext;
extern "C" {
@@ -55,22 +57,6 @@ private:
int m_position;
/**
- * The start offset in seconds relative to the media container start time.
- * IE how much the sound should be delayed to be kept in sync with the rest of the containter streams.
- */
- double m_start_offset;
-
- /**
- * The start time pts of the stream. All packets before this timestamp shouldn't be played back (only decoded).
- */
- int64_t m_st_time;
-
- /**
- * The duration of the audio stream in samples.
- */
- int64_t m_duration;
-
- /**
* The specification of the audio data.
*/
DeviceSpecs m_specs;
@@ -136,6 +122,13 @@ private:
bool m_tointerleave;
/**
+ * Converts an ffmpeg sample format to an audaspace one.
+ * \param format The AVSampleFormat sample format.
+ * \return The sample format as SampleFormat.
+ */
+ AUD_LOCAL static SampleFormat convertSampleFormat(AVSampleFormat format);
+
+ /**
* Decodes a packet into the given buffer.
* \param packet The AVPacket to decode.
* \param buffer The target buffer.
@@ -145,8 +138,9 @@ private:
/**
* Initializes the object.
+ * \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/
- AUD_LOCAL void init();
+ AUD_LOCAL void init(int stream);
// delete copy constructor and operator=
FFMPEGReader(const FFMPEGReader&) = delete;
@@ -156,18 +150,20 @@ public:
/**
* Creates a new reader.
* \param filename The path to the file to be read.
+ * \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the file specified does not exist or
* cannot be read with ffmpeg.
*/
- FFMPEGReader(std::string filename);
+ FFMPEGReader(std::string filename, int stream = 0);
/**
* Creates a new reader.
* \param buffer The buffer to read from.
+ * \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the buffer specified cannot be read
* with ffmpeg.
*/
- FFMPEGReader(std::shared_ptr<Buffer> buffer);
+ FFMPEGReader(std::shared_ptr<Buffer> buffer, int stream = 0);
/**
* Destroys the reader and closes the file.
@@ -175,6 +171,13 @@ public:
virtual ~FFMPEGReader();
/**
+ * Queries the streams of a sound file.
+ * \return A vector with as many streams as there are in the file.
+ * \exception Exception Thrown if the file specified cannot be read.
+ */
+ virtual std::vector<StreamInfo> queryStreams();
+
+ /**
* Reads data to a memory buffer.
* This function is used for avio only.
* @param opaque The FFMPEGReader.
@@ -198,7 +201,6 @@ public:
virtual void seek(int position);
virtual int getLength() const;
virtual int getPosition() const;
- virtual double getStartOffset() const;
virtual Specs getSpecs() const;
virtual void read(int& length, bool& eos, sample_t* buffer);
};