Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: services/media/framework_ffmpeg/av_io_context.h

Issue 1814583002: Motown: New wrapper classes for ffmpeg format context and io context (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Tweaks based on feedback. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_IO_CONTEXT_H_
6 #define SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_IO_CONTEXT_H_
7
8 #include "services/media/framework/parts/reader.h"
9 extern "C" {
10 #include "third_party/ffmpeg/libavformat/avio.h"
11 }
12
13 namespace mojo {
14 namespace media {
15
16 struct AVIOContextDeleter {
17 void operator()(AVIOContext* context) const;
18 };
19
20 using AvIoContextPtr = std::unique_ptr<AVIOContext, AVIOContextDeleter>;
21
22 struct AvIoContext {
23 // Creates an ffmpeg avio_context for a given reader.
24 static AvIoContextPtr Create(std::shared_ptr<Reader> reader);
25
26 // Performs a read operation using the signature required for avio.
27 static int Read(void* opaque, uint8_t* buf, int buf_size);
28
29 // Performs a seek operation using the signature required for avio.
30 static int64_t Seek(void* opaque, int64_t offset, int whence);
31
32 ~AvIoContext();
33
34 private:
35 AvIoContext(std::shared_ptr<Reader> reader);
36
37 int Read(uint8_t* buffer, size_t bytes_to_read);
38
39 int64_t Seek(int64_t offset, int whence);
40
41 std::shared_ptr<Reader> reader_;
42 bool can_seek_;
43 int64_t size_;
44 int64_t position_ = 0;
45 };
46
47 } // namespace media
48 } // namespace mojo
49
50 #endif // SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_IO_CONTEXT_H_
OLDNEW
« no previous file with comments | « services/media/framework_ffmpeg/av_format_context.h ('k') | services/media/framework_ffmpeg/av_io_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698