1 // Copyright 2016 Samsung Electronics. 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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_MEDIA_PLAYER_TIZEN_PEPPER_VIDEO_ELEMENTARY_STREAM_PRIVATE_TIZEN_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_MEDIA_PLAYER_TIZEN_PEPPER_VIDEO_ELEMENTARY_STREAM_PRIVATE_TIZEN_H_
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "content/browser/renderer_host/pepper/media_player/pepper_video_elementary_stream_private.h"
13 #include "content/browser/renderer_host/pepper/media_player/tizen/pepper_elementary_stream_private_tizen.h"
14 #include "content/browser/renderer_host/pepper/media_player/tizen/pepper_player_adapter_base.h"
18 struct PepperTizenVideoStreamTraits {
19 typedef ppapi::VideoCodecConfig CodecConfig;
20 typedef PepperVideoStreamInfo StreamInfo;
21 static constexpr PP_ElementaryStream_Type_Samsung Type =
22 PP_ELEMENTARYSTREAM_TYPE_SAMSUNG_VIDEO;
23 static int32_t SetStreamInfo(PepperPlayerAdapterInterface* player,
24 const StreamInfo& player_stream_info) {
25 return player->SetVideoStreamInfo(player_stream_info);
29 class PepperVideoElementaryStreamPrivateTizen
30 : public PepperElementaryStreamPrivateTizen<
31 PepperVideoElementaryStreamPrivate,
32 PepperTizenVideoStreamTraits> {
34 static scoped_refptr<PepperVideoElementaryStreamPrivateTizen> Create(
35 PepperESDataSourcePrivate* es_data_source);
36 ~PepperVideoElementaryStreamPrivateTizen() override;
38 void InitializeDone(PP_StreamInitializationMode mode,
39 const ppapi::VideoCodecConfig& config,
40 const base::Callback<void(int32_t)>& callback) override;
42 void AppendPacket(std::unique_ptr<ppapi::ESPacket> packet,
43 const base::Callback<void(int32_t)>& callback) override;
45 void AppendEncryptedPacket(
46 std::unique_ptr<ppapi::EncryptedESPacket> packet,
47 const base::Callback<void(int32_t)>& callback) override;
51 PepperElementaryStreamPrivateTizen<PepperVideoElementaryStreamPrivate,
52 PepperTizenVideoStreamTraits>;
54 explicit PepperVideoElementaryStreamPrivateTizen(
55 PepperESDataSourcePrivate* es_data_source);
57 void ExtractCodecExtraData(const ppapi::VideoCodecConfig& config);
58 void ExtractH264ExtraData(const ppapi::VideoCodecConfig& config);
59 void ExtractH265ExtraData(const ppapi::VideoCodecConfig& config);
61 std::vector<uint8_t> video_extra_data_;
64 } // namespace content
66 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_MEDIA_PLAYER_TIZEN_PEPPER_VIDEO_ELEMENTARY_STREAM_PRIVATE_TIZEN_H_