16 #ifndef ALEXA_CLIENT_SDK_PLAYLISTPARSER_INCLUDE_PLAYLISTPARSER_URLCONTENTTOATTACHMENTCONVERTER_H_ 17 #define ALEXA_CLIENT_SDK_PLAYLISTPARSER_INCLUDE_PLAYLISTPARSER_URLCONTENTTOATTACHMENTCONVERTER_H_ 36 namespace playlistParser {
68 virtual void onWriteComplete() = 0;
91 static std::shared_ptr<UrlContentToAttachmentConverter>
create(
92 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface> contentFetcherFactory,
94 std::shared_ptr<ErrorObserverInterface> observer,
95 std::chrono::milliseconds startTime = std::chrono::milliseconds::zero(),
96 std::shared_ptr<WriteCompleteObserverInterface> writeCompleteObserver =
nullptr,
97 size_t numOfReaders = 1);
104 std::shared_ptr<avsCommon::avs::attachment::InProcessAttachment>
getAttachment();
137 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface> contentFetcherFactory,
139 std::shared_ptr<ErrorObserverInterface> observer,
140 std::chrono::milliseconds startTime,
141 std::shared_ptr<WriteCompleteObserverInterface> writeCompleteObserver,
142 size_t numOfReaders);
154 void notifyWriteComplete();
174 bool writeDecryptedUrlContentIntoStream(
176 std::vector<std::string> headers,
178 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterface> contentFetcher);
191 const std::vector<std::string>& headers,
192 std::shared_ptr<avsCommon::avs::attachment::AttachmentWriter> streamWriter,
193 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterface> contentFetcher);
206 const std::vector<std::string>& headers,
208 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterface> contentFetcher);
217 bool readContent(std::shared_ptr<avsCommon::avs::attachment::AttachmentReader> reader,
ByteVector* content);
230 void closeStreamWriter();
235 const std::chrono::milliseconds m_desiredStreamPoint;
238 std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface> m_contentFetcherFactory;
241 std::shared_ptr<PlaylistParser> m_playlistParser;
244 std::shared_ptr<avsCommon::avs::attachment::InProcessAttachment> m_stream;
247 std::shared_ptr<avsCommon::avs::attachment::AttachmentWriter> m_streamWriter;
250 std::shared_ptr<ErrorObserverInterface> m_observer;
253 std::shared_ptr<WriteCompleteObserverInterface> m_writeCompleteObserver;
259 std::atomic<bool> m_shuttingDown;
262 std::shared_ptr<ContentDecrypter> m_contentDecrypter;
265 std::shared_ptr<Id3TagsRemover> m_id3TagsRemover;
274 std::promise<std::chrono::milliseconds> m_startStreamingPointPromise;
279 std::shared_future<std::chrono::milliseconds> m_startStreamingPointFuture;
282 std::chrono::milliseconds m_runningTotal;
285 bool m_startedStreaming;
294 bool m_streamWriterClosed;
311 #endif // ALEXA_CLIENT_SDK_PLAYLISTPARSER_INCLUDE_PLAYLISTPARSER_URLCONTENTTOATTACHMENTCONVERTER_H_ std::chrono::milliseconds getDesiredStreamingPoint()
static std::shared_ptr< UrlContentToAttachmentConverter > create(std::shared_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface > contentFetcherFactory, const std::string &url, std::shared_ptr< ErrorObserverInterface > observer, std::chrono::milliseconds startTime=std::chrono::milliseconds::zero(), std::shared_ptr< WriteCompleteObserverInterface > writeCompleteObserver=nullptr, size_t numOfReaders=1)
Definition: PlaylistEntry.h:111
virtual ~ErrorObserverInterface()=default
::std::string string
Definition: gtest-port.h:1097
Class that handles the streaming of urls containing media into Attachments.
Definition: UrlContentToAttachmentConverter.h:39
Single-thread executor implementation.
Definition: Executor.h:45
void doShutdown() override
Definition: RequiresShutdown.h:32
std::shared_ptr< avsCommon::avs::attachment::InProcessAttachment > getAttachment()
Definition: PlaylistEntry.h:59
Class to observe errors that arise from converting a URL to to an Attachment.
Definition: UrlContentToAttachmentConverter.h:44
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Class to allow notification when writing to the attachment is complete.
Definition: UrlContentToAttachmentConverter.h:58
Definition: PlaylistParserObserverInterface.h:34
std::vector< unsigned char > ByteVector
Alias for bytes.
Definition: ContentDecrypter.h:35
std::chrono::milliseconds getStartStreamingPoint()