15 #ifndef ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGDECODER_H_ 16 #define ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGDECODER_H_ 20 #include <condition_variable> 28 #include <libavutil/samplefmt.h> 37 struct AVCodecContext;
39 struct AVFormatContext;
45 struct AVFilterContext;
48 namespace mediaPlayer {
73 static std::unique_ptr<FFmpegDecoder>
create(
74 std::unique_ptr<FFmpegInputControllerInterface> inputController,
80 std::pair<Status, size_t>
read(
Byte* buffer,
size_t size)
override;
81 void abort()
override;
109 std::unique_ptr<FFmpegInputControllerInterface> inputController,
110 AVSampleFormat format,
128 enum class DecodingState {
144 friend std::ostream&
operator<<(std::ostream& stream,
const DecodingState state);
151 void setState(DecodingState nextState);
165 UnreadData(AVSampleFormat format,
LayoutMask layout,
int sampleRate);
179 int getOffset()
const;
186 void resize(
size_t minimumCapacity);
193 bool isEmpty()
const;
200 void setOffset(
int offset);
210 std::shared_ptr<AVFrame> m_frame;
222 size_t readData(
Byte* buffer,
size_t size,
size_t bytesRead);
229 void resample(std::shared_ptr<AVFrame> inputFrame);
245 void readDecodedFrame(std::shared_ptr<AVFrame>& decodedFrame);
259 bool initializeFilters();
273 bool transitionStateUsingStatus(
int status, DecodingState nextState,
const std::string& functionName);
276 std::atomic<DecodingState> m_state;
279 std::unique_ptr<FFmpegInputControllerInterface> m_inputController;
282 const AVSampleFormat m_outputFormat;
288 const int m_outputRate;
291 std::shared_ptr<AVFormatContext> m_formatContext;
294 std::shared_ptr<AVCodecContext> m_codecContext;
297 std::shared_ptr<SwrContext> m_swrContext;
300 std::shared_ptr<AVFilterGraph> m_filterGraph;
305 std::shared_ptr<AVFilterContext> m_filterInput;
306 std::shared_ptr<AVFilterContext> m_filterOutput;
309 UnreadData m_unreadData;
315 std::condition_variable m_abortCondition;
318 std::chrono::time_point<std::chrono::steady_clock> m_initializeStartTime;
324 long long m_decodedSampleTime = 0;
331 #endif // ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGDECODER_H_
::std::string string
Definition: gtest-port.h:1097
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36