Shaka Packager SDK
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 <packager/media/base/media_handler.h>
11 
12 namespace shaka {
13 namespace media {
14 
15 // Origin handlers are handlers that sit at the head of a pipeline (chain of
16 // handlers). They are expect to take input from an alternative source (like
17 // a file or network connection).
18 class OriginHandler : public MediaHandler {
19  public:
20  OriginHandler() = default;
21 
22  // Process all data and send messages down stream. This is the main
23  // method of the handler. Since origin handlers do not take input via
24  // |Process|, run will take input from an alternative source. This call
25  // is expect to be blocking. To exit a call to |Run|, |Cancel| should
26  // be used.
27  virtual Status Run() = 0;
28 
29  // Non-blocking call to the handler, requesting that it exit the
30  // current call to |Run|. The handler should stop processing data
31  // as soon is convenient.
32  virtual void Cancel() = 0;
33 
34  private:
35  OriginHandler(const OriginHandler&) = delete;
36  OriginHandler& operator=(const OriginHandler&) = delete;
37 
38  Status Process(std::unique_ptr<StreamData> stream_data) override;
39 };
40 
41 } // namespace media
42 } // namespace shaka
43 
44 #endif // PACKAGER_MEDIA_ORIGIN_ORIGIN_HANDLER_H_
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66