AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
FFmpegStreamInputController.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 #ifndef ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGSTREAMINPUTCONTROLLER_H_
16 #define ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGSTREAMINPUTCONTROLLER_H_
17 
18 #include <istream>
19 #include <memory>
20 
22 
23 struct AVIOContext;
24 
25 namespace alexaClientSDK {
26 namespace mediaPlayer {
27 namespace android {
28 
36 public:
44  static std::unique_ptr<FFmpegStreamInputController> create(std::shared_ptr<std::istream> stream, bool repeat);
45 
48  bool hasNext() const override;
49  bool next() override;
50  std::tuple<Result, std::shared_ptr<AVFormatContext>, std::chrono::milliseconds> getCurrentFormatContext() override;
52 
57 
58 private:
65  FFmpegStreamInputController(std::shared_ptr<std::istream> stream, bool repeat);
66 
74  int read(uint8_t* buffer, int bufferSize);
75 
84  static int feedBuffer(void* userData, uint8_t* buffer, int bufferSize);
85 
87  const std::shared_ptr<std::istream> m_stream;
88 
90  std::shared_ptr<AVIOContext> m_ioContext;
91 
93  const bool m_repeat;
94 };
95 
96 } // namespace android
97 } // namespace mediaPlayer
98 } // namespace alexaClientSDK
99 
100 #endif // ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_FFMPEGSTREAMINPUTCONTROLLER_H_
Definition: FFmpegInputControllerInterface.h:37
Definition: FFmpegStreamInputController.h:35
static std::unique_ptr< FFmpegStreamInputController > create(std::shared_ptr< std::istream > stream, bool repeat)
std::tuple< Result, std::shared_ptr< AVFormatContext >, std::chrono::milliseconds > getCurrentFormatContext() override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0