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

Side by Side Diff: media/filters/blocking_url_protocol.h

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_ 5 #ifndef MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_
6 #define MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_ 6 #define MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_
7 7
8 #include "base/basictypes.h"
9 #include "base/callback.h" 8 #include "base/callback.h"
10 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
11 #include "media/filters/ffmpeg_glue.h" 10 #include "media/filters/ffmpeg_glue.h"
12 11
13 namespace media { 12 namespace media {
14 13
15 class DataSource; 14 class DataSource;
16 15
17 // An implementation of FFmpegURLProtocol that blocks until the underlying 16 // An implementation of FFmpegURLProtocol that blocks until the underlying
18 // asynchronous DataSource::Read() operation completes. 17 // asynchronous DataSource::Read() operation completes.
19 class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol { 18 class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol {
20 public: 19 public:
21 // Implements FFmpegURLProtocol using the given |data_source|. |error_cb| is 20 // Implements FFmpegURLProtocol using the given |data_source|. |error_cb| is
22 // fired any time DataSource::Read() returns an error. 21 // fired any time DataSource::Read() returns an error.
23 // 22 //
24 // TODO(scherkus): After all blocking operations are isolated on a separate 23 // TODO(scherkus): After all blocking operations are isolated on a separate
25 // thread we should be able to eliminate |error_cb|. 24 // thread we should be able to eliminate |error_cb|.
26 BlockingUrlProtocol(DataSource* data_source, const base::Closure& error_cb); 25 BlockingUrlProtocol(DataSource* data_source, const base::Closure& error_cb);
27 virtual ~BlockingUrlProtocol(); 26 virtual ~BlockingUrlProtocol();
28 27
29 // Aborts any pending reads by returning a read error. After this method 28 // Aborts any pending reads by returning a read error. After this method
30 // returns all subsequent calls to Read() will immediately fail. 29 // returns all subsequent calls to Read() will immediately fail.
31 void Abort(); 30 void Abort();
32 31
33 // FFmpegURLProtocol implementation. 32 // FFmpegURLProtocol implementation.
34 int Read(int size, uint8* data) override; 33 int Read(int size, uint8_t* data) override;
35 bool GetPosition(int64* position_out) override; 34 bool GetPosition(int64_t* position_out) override;
36 bool SetPosition(int64 position) override; 35 bool SetPosition(int64_t position) override;
37 bool GetSize(int64* size_out) override; 36 bool GetSize(int64_t* size_out) override;
38 bool IsStreaming() override; 37 bool IsStreaming() override;
39 38
40 private: 39 private:
41 // Sets |last_read_bytes_| and signals the blocked thread that the read 40 // Sets |last_read_bytes_| and signals the blocked thread that the read
42 // has completed. 41 // has completed.
43 void SignalReadCompleted(int size); 42 void SignalReadCompleted(int size);
44 43
45 DataSource* data_source_; 44 DataSource* data_source_;
46 base::Closure error_cb_; 45 base::Closure error_cb_;
47 46
48 // Used to unblock the thread during shutdown and when reads complete. 47 // Used to unblock the thread during shutdown and when reads complete.
49 base::WaitableEvent aborted_; 48 base::WaitableEvent aborted_;
50 base::WaitableEvent read_complete_; 49 base::WaitableEvent read_complete_;
51 50
52 // Cached number of bytes last read from the data source. 51 // Cached number of bytes last read from the data source.
53 int last_read_bytes_; 52 int last_read_bytes_;
54 53
55 // Cached position within the data source. 54 // Cached position within the data source.
56 int64 read_position_; 55 int64_t read_position_;
57 56
58 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockingUrlProtocol); 57 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockingUrlProtocol);
59 }; 58 };
60 59
61 } // namespace media 60 } // namespace media
62 61
63 #endif // MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_ 62 #endif // MEDIA_FILTERS_BLOCKING_URL_PROTOCOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698