-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
-#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/buffering_state.h"
#include "media/base/pipeline_metadata.h"
#include "media/base/pipeline_status.h"
#include "media/base/ranges.h"
-#include "media/base/text_track.h"
#include "media/base/video_decoder_config.h"
#include "media/base/video_transformation.h"
#include "media/base/waiting.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
+#if defined(TIZEN_VIDEO_HOLE)
+#include "ui/gfx/geometry/rect_f.h"
+#endif
+
namespace media {
class CdmContext;
class Demuxer;
+enum TRACKCMD { SETTEXT, SETAUDIO, SETVIDEO, SETINBAND, SETCUE };
+
+struct InbandTextInfo {
+ std::string info;
+ int band_type;
+ int action;
+};
+
+struct TrackInfo {
+ std::string id;
+ std::string kind;
+ std::string label;
+ std::string language;
+ bool enabled;
+};
+
+struct InbandCueInfo {
+ std::string info;
+ int id;
+ int band_type;
+ int stime;
+ int etime;
+};
+
+struct MediaTrackInfo {
+ TRACKCMD cmd;
+ void* info;
+};
+
class MEDIA_EXPORT Pipeline {
public:
class Client {
// NOTE: The client is responsible for calling Pipeline::Stop().
virtual void OnError(PipelineStatus status) = 0;
+ // Executed whenever some fallback-enabled portion of the pipeline (Just
+ // Decoders and Renderers for now) fails in such a way that a fallback
+ // is still possible without a fatal pipeline error.
+ virtual void OnFallback(PipelineStatus status) = 0;
+
// Executed whenever the media reaches the end.
virtual void OnEnded() = 0;
virtual void OnBufferingStateChange(BufferingState state,
BufferingStateChangeReason reason) = 0;
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual void NotifyTrackInfoToBrowser(int active_track_id) {}
+ virtual void AddTrackInfo(MediaTrackInfo trackinfo) {}
+#endif
+
// Executed whenever the presentation duration changes.
virtual void OnDurationChange() = 0;
- // Executed whenever a text track is added.
- // The client is expected to create a TextTrack and call |done_cb|.
- virtual void OnAddTextTrack(const TextTrackConfig& config,
- AddTextTrackDoneCB done_cb) = 0;
-
// Executed whenever the pipeline is waiting because of |reason|.
virtual void OnWaiting(WaitingReason reason) = 0;
// Executed whenever the underlying AudioDecoder or VideoDecoder changes
// during playback.
- virtual void OnAudioDecoderChange(const PipelineDecoderInfo& info) = 0;
- virtual void OnVideoDecoderChange(const PipelineDecoderInfo& info) = 0;
+ virtual void OnAudioPipelineInfoChange(const AudioPipelineInfo& info) = 0;
+ virtual void OnVideoPipelineInfoChange(const VideoPipelineInfo& info) = 0;
// Executed whenever the video frame rate changes. |fps| will be unset if
// the frame rate is unstable. The duration used for the frame rate is
// based on wall clock time, not media time.
- virtual void OnVideoFrameRateChange(base::Optional<int> fps) = 0;
+ virtual void OnVideoFrameRateChange(absl::optional<int> fps) = 0;
+
+#if defined(TIZEN_MULTIMEDIA)
+ virtual void OnRequestSuspend(bool resource_conflicted) = 0;
+ virtual void OnSeekableTimeChange(base::TimeDelta min_time,
+ base::TimeDelta max_time,
+ bool is_live) = 0;
+ virtual void OnLivePlaybackComplete() = 0;
+#endif
};
virtual ~Pipeline() {}
// |selected_track_id| is either empty, which means no video track is
// selected, or contains the selected video track id.
virtual void OnSelectedVideoTrackChanged(
- base::Optional<MediaTrack::Id> selected_track_id,
+ absl::optional<MediaTrack::Id> selected_track_id,
base::OnceClosure change_completed_cb) = 0;
+ // Signal to the pipeline that there has been a client request to access
+ // video frame data.
+ virtual void OnExternalVideoFrameRequest() = 0;
+
// Stops the pipeline. This is a blocking function.
// If the pipeline is started, it must be stopped before destroying it.
// It it permissible to call Stop() at any point during the lifetime of the
// post-decode buffering required to start playback or resume from
// seek/underflow. A null option indicates the hint is unset and the pipeline
// can choose its own default.
- virtual void SetLatencyHint(base::Optional<base::TimeDelta> latency_hint) = 0;
+ virtual void SetLatencyHint(absl::optional<base::TimeDelta> latency_hint) = 0;
// Sets whether pitch adjustment should be applied when the playback rate is
// different than 1.0.
virtual void SetPreservesPitch(bool preserves_pitch) = 0;
+ // Sets a flag indicating whether the audio stream was played with user
+ // activation.
+ virtual void SetWasPlayedWithUserActivation(
+ bool was_played_with_user_activation) = 0;
+
// Returns the current media playback time, which progresses from 0 until
// GetMediaDuration().
virtual base::TimeDelta GetMediaTime() const = 0;
using CdmAttachedCB = base::OnceCallback<void(bool)>;
virtual void SetCdm(CdmContext* cdm_context,
CdmAttachedCB cdm_attached_cb) = 0;
+
+#if defined(TIZEN_MULTIMEDIA)
+ using ToggledFullscreenCB = base::OnceCallback<void()>;
+ virtual void ToggleFullscreenMode(bool is_fullscreen,
+ ToggledFullscreenCB cb) = 0;
+#endif
+
+#if defined(TIZEN_VIDEO_HOLE)
+ virtual void SetMediaGeometry(const gfx::RectF rect_f) = 0;
+#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ virtual void SetContentMimeType(const std::string& mime_type) = 0;
+ virtual void AudioTracksCountChanged(unsigned count) = 0;
+ virtual void SetParentalRatingResult(bool is_pass) = 0;
+ virtual void SetActiveTextTrack(int id, bool is_in_band) = 0;
+ virtual void SetActiveAudioTrack(int index) = 0;
+ virtual void SetActiveVideoTrack(int index) = 0;
+ virtual void SetPreferTextLanguage(const std::string& lang) = 0;
+ virtual double GetStartDate() = 0;
+ virtual void DestroyPlayerSync(base::OnceClosure cb) = 0;
+#endif
};
} // namespace media