Commit 5d1cbbb1 authored by gunsch's avatar gunsch Committed by Commit bot

Chromecast: media interfaces for hardware-backed video plane.

R=lcwu@chromium.org,damienv@chromium.org
BUG=408189

Review URL: https://codereview.chromium.org/802833002

Cr-Commit-Position: refs/heads/master@{#308456}
parent f2c5add4
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/media/cma/backend/video_plane.h"
namespace chromecast {
namespace media {
VideoPlane::VideoPlane() {
}
VideoPlane::~VideoPlane() {
}
} // namespace media
} // namespace chromecast
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PLANE_H_
#define CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PLANE_H_
#include "base/macros.h"
namespace gfx {
class QuadF;
class Size;
}
namespace chromecast {
namespace media {
class VideoPlane {
public:
enum CoordinateType {
// Graphics plane as coordinate type.
COORDINATE_TYPE_GRAPHICS_PLANE = 0,
// Output video plane as coordinate type.
COORDINATE_TYPE_VIDEO_PLANE_RESOLUTION = 1,
};
VideoPlane();
virtual ~VideoPlane();
// Gets video plane resolution.
virtual gfx::Size GetVideoPlaneResolution() = 0;
// Updates the video plane geometry.
// |quad.p1()| corresponds to the top left of the original video,
// |quad.p2()| to the top right of the original video,
// and so on.
// Depending on the underlying hardware, the exact geometry
// might not be honored.
// |coordinate_type| indicates what coordinate type |quad| refers to.
virtual void SetGeometry(const gfx::QuadF& quad,
CoordinateType coordinate_type) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(VideoPlane);
};
// Global accessor to the video plane.
VideoPlane* GetVideoPlane();
} // namespace media
} // namespace chromecast
#endif // CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PLANE_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/media/cma/backend/video_plane_fake.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "ui/gfx/geometry/quad_f.h"
#include "ui/gfx/geometry/size.h"
namespace chromecast {
namespace media {
// static
VideoPlaneFake* VideoPlaneFake::GetInstance() {
return Singleton<VideoPlaneFake>::get();
}
VideoPlaneFake::VideoPlaneFake() {
}
VideoPlaneFake::~VideoPlaneFake() {
}
gfx::Size VideoPlaneFake::GetVideoPlaneResolution() {
return gfx::Size(1920, 1080);
}
void VideoPlaneFake::SetGeometry(const gfx::QuadF& quad,
CoordinateType coordinate_type) {
// Nothing to be done.
}
} // namespace media
} // namespace chromecast
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PLANE_FAKE_H_
#define CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PLANE_FAKE_H_
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "chromecast/media/cma/backend/video_plane.h"
namespace chromecast {
namespace media {
class VideoPlaneFake : public VideoPlane {
public:
static VideoPlaneFake* GetInstance();
// VideoPlane implementation.
gfx::Size GetVideoPlaneResolution() override;
void SetGeometry(const gfx::QuadF& quad,
CoordinateType coordinate_type) override;
private:
friend struct DefaultSingletonTraits<VideoPlaneFake>;
friend class Singleton<VideoPlaneFake>;
VideoPlaneFake();
virtual ~VideoPlaneFake();
DISALLOW_COPY_AND_ASSIGN(VideoPlaneFake);
};
} // namespace media
} // namespace chromecast
#endif // CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PLANE_FAKE_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/media/cma/backend/video_plane_fake.h"
namespace chromecast {
namespace media {
// Global accessor to the video plane.
VideoPlane* GetVideoPlane() {
return VideoPlaneFake::GetInstance();
}
} // namespace media
} // namespace chromecast
......@@ -108,6 +108,10 @@
'cma/backend/media_pipeline_device_params.h',
'cma/backend/video_pipeline_device.cc',
'cma/backend/video_pipeline_device.h',
'cma/backend/video_plane.cc',
'cma/backend/video_plane.h',
'cma/backend/video_plane_fake.cc',
'cma/backend/video_plane_fake.h',
],
'conditions': [
['chromecast_branding=="Chrome"', {
......@@ -117,6 +121,7 @@
}, {
'sources': [
'cma/backend/media_pipeline_device_fake_factory.cc',
'cma/backend/video_plane_fake_factory.cc',
],
}],
],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment