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

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

Issue 9632024: Create video and audio decoder threads on demand. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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_FFMPEG_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "media/base/filters.h" 11 #include "media/base/filters.h"
12 #include "media/crypto/aes_decryptor.h" 12 #include "media/crypto/aes_decryptor.h"
13 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
14 14
15 class MessageLoop; 15 class MessageLoop;
16 16
17 struct AVCodecContext; 17 struct AVCodecContext;
18 struct AVFrame; 18 struct AVFrame;
19 19
20 namespace media { 20 namespace media {
21 21
22 class MessageLoopFactory;
23
22 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { 24 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
23 public: 25 public:
24 explicit FFmpegVideoDecoder(MessageLoop* message_loop); 26 FFmpegVideoDecoder(MessageLoopFactory* loop_factory,
27 const std::string& loop_name);
25 virtual ~FFmpegVideoDecoder(); 28 virtual ~FFmpegVideoDecoder();
26 29
27 // Filter implementation. 30 // Filter implementation.
28 virtual void Stop(const base::Closure& callback) OVERRIDE; 31 virtual void Stop(const base::Closure& callback) OVERRIDE;
29 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; 32 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE;
30 virtual void Pause(const base::Closure& callback) OVERRIDE; 33 virtual void Pause(const base::Closure& callback) OVERRIDE;
31 virtual void Flush(const base::Closure& callback) OVERRIDE; 34 virtual void Flush(const base::Closure& callback) OVERRIDE;
32 35
33 // VideoDecoder implementation. 36 // VideoDecoder implementation.
34 virtual void Initialize(DemuxerStream* demuxer_stream, 37 virtual void Initialize(DemuxerStream* demuxer_stream,
(...skipping 26 matching lines...) Expand all
61 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); 64 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame);
62 65
63 // Releases resources associated with |codec_context_| and |av_frame_| 66 // Releases resources associated with |codec_context_| and |av_frame_|
64 // and resets them to NULL. 67 // and resets them to NULL.
65 void ReleaseFFmpegResources(); 68 void ReleaseFFmpegResources();
66 69
67 // Allocates a video frame based on the current format and dimensions based on 70 // Allocates a video frame based on the current format and dimensions based on
68 // the current state of |codec_context_|. 71 // the current state of |codec_context_|.
69 scoped_refptr<VideoFrame> AllocateVideoFrame(); 72 scoped_refptr<VideoFrame> AllocateVideoFrame();
70 73
74 MessageLoop* EnsureMessageLoop();
75
76 MessageLoopFactory* message_loop_factory_;
77 const std::string loop_name_;
78
71 MessageLoop* message_loop_; 79 MessageLoop* message_loop_;
72 80
73 DecoderState state_; 81 DecoderState state_;
74 82
75 StatisticsCallback statistics_callback_; 83 StatisticsCallback statistics_callback_;
76 84
77 ReadCB read_cb_; 85 ReadCB read_cb_;
78 86
79 // FFmpeg structures owned by this object. 87 // FFmpeg structures owned by this object.
80 AVCodecContext* codec_context_; 88 AVCodecContext* codec_context_;
(...skipping 11 matching lines...) Expand all
92 scoped_refptr<DemuxerStream> demuxer_stream_; 100 scoped_refptr<DemuxerStream> demuxer_stream_;
93 101
94 AesDecryptor decryptor_; 102 AesDecryptor decryptor_;
95 103
96 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); 104 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
97 }; 105 };
98 106
99 } // namespace media 107 } // namespace media
100 108
101 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 109 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698