xref: /aosp_15_r20/external/openscreen/cast/standalone_receiver/dummy_player.h (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CAST_STANDALONE_RECEIVER_DUMMY_PLAYER_H_
6 #define CAST_STANDALONE_RECEIVER_DUMMY_PLAYER_H_
7 
8 #include <stdint.h>
9 
10 #include <vector>
11 
12 #include "cast/streaming/receiver.h"
13 #include "platform/api/task_runner.h"
14 #include "platform/api/time.h"
15 
16 namespace openscreen {
17 namespace cast {
18 
19 // Consumes frames from a Receiver, but does nothing other than OSP_LOG_INFO
20 // each one's FrameId, timestamp and size. This is only useful for confirming a
21 // Receiver is successfully receiving a stream, for platforms where
22 // SDLVideoPlayer cannot be built.
23 class DummyPlayer final : public Receiver::Consumer {
24  public:
25   explicit DummyPlayer(Receiver* receiver);
26 
27   ~DummyPlayer() final;
28 
29  private:
30   // Receiver::Consumer implementation.
31   void OnFramesReady(int next_frame_buffer_size) final;
32 
33   Receiver* const receiver_;
34   std::vector<uint8_t> buffer_;
35 };
36 
37 }  // namespace cast
38 }  // namespace openscreen
39 
40 #endif  // CAST_STANDALONE_RECEIVER_DUMMY_PLAYER_H_
41