Shaka Packager SDK
Loading...
Searching...
No Matches
origin_handler.h
1// Copyright 2017 Google LLC. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file or at
5// https://developers.google.com/open-source/licenses/bsd
6
7#ifndef PACKAGER_MEDIA_ORIGIN_ORIGIN_HANDLER_H_
8#define PACKAGER_MEDIA_ORIGIN_ORIGIN_HANDLER_H_
9
10#include <memory>
11
12#include <packager/media/base/media_handler.h>
13#include <packager/status.h>
14
15namespace shaka {
16namespace media {
17
18// Origin handlers are handlers that sit at the head of a pipeline (chain of
19// handlers). They are expect to take input from an alternative source (like
20// a file or network connection).
22 public:
23 OriginHandler() = default;
24
25 // Process all data and send messages down stream. This is the main
26 // method of the handler. Since origin handlers do not take input via
27 // |Process|, run will take input from an alternative source. This call
28 // is expect to be blocking. To exit a call to |Run|, |Cancel| should
29 // be used.
30 virtual Status Run() = 0;
31
32 // Non-blocking call to the handler, requesting that it exit the
33 // current call to |Run|. The handler should stop processing data
34 // as soon is convenient.
35 virtual void Cancel() = 0;
36
37 private:
38 OriginHandler(const OriginHandler&) = delete;
39 OriginHandler& operator=(const OriginHandler&) = delete;
40
41 Status Process(std::unique_ptr<StreamData> stream_data) override;
42};
43
44} // namespace media
45} // namespace shaka
46
47#endif // PACKAGER_MEDIA_ORIGIN_ORIGIN_HANDLER_H_
All the methods that are virtual are virtual for mocking.