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

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

Issue 2846693002: Add UMA metrics for VideoCodec.MP4 and VideoCodec.WebM (Closed)
Patch Set: Address comments Created 3 years, 7 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
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | media/filters/ffmpeg_glue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // FFmpegGlue is an interface between FFmpeg and Chrome used to proxy FFmpeg's 5 // FFmpegGlue is an interface between FFmpeg and Chrome used to proxy FFmpeg's
6 // read and seek requests to Chrome's internal data structures. The glue works 6 // read and seek requests to Chrome's internal data structures. The glue works
7 // through the AVIO interface provided by FFmpeg. 7 // through the AVIO interface provided by FFmpeg.
8 // 8 //
9 // AVIO works through a special AVIOContext created through avio_alloc_context() 9 // AVIO works through a special AVIOContext created through avio_alloc_context()
10 // which is attached to the AVFormatContext used for demuxing. The AVIO context 10 // which is attached to the AVFormatContext used for demuxing. The AVIO context
(...skipping 11 matching lines...) Expand all
22 // per process. Initialization includes: turning off log messages, registering 22 // per process. Initialization includes: turning off log messages, registering
23 // a lock manager, and finally registering all demuxers and codecs. 23 // a lock manager, and finally registering all demuxers and codecs.
24 24
25 #ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_ 25 #ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_
26 #define MEDIA_FILTERS_FFMPEG_GLUE_H_ 26 #define MEDIA_FILTERS_FFMPEG_GLUE_H_
27 27
28 #include <stdint.h> 28 #include <stdint.h>
29 29
30 #include <memory> 30 #include <memory>
31 31
32 #include "base/logging.h"
32 #include "base/macros.h" 33 #include "base/macros.h"
34 #include "media/base/container_names.h"
33 #include "media/base/media_export.h" 35 #include "media/base/media_export.h"
34 #include "media/ffmpeg/ffmpeg_deleters.h" 36 #include "media/ffmpeg/ffmpeg_deleters.h"
35 37
36 struct AVFormatContext; 38 struct AVFormatContext;
37 struct AVIOContext; 39 struct AVIOContext;
38 40
39 namespace media { 41 namespace media {
40 42
41 class MEDIA_EXPORT FFmpegURLProtocol { 43 class MEDIA_EXPORT FFmpegURLProtocol {
42 public: 44 public:
(...skipping 21 matching lines...) Expand all
64 static void InitializeFFmpeg(); 66 static void InitializeFFmpeg();
65 67
66 // See file documentation for usage. |protocol| must outlive FFmpegGlue. 68 // See file documentation for usage. |protocol| must outlive FFmpegGlue.
67 explicit FFmpegGlue(FFmpegURLProtocol* protocol); 69 explicit FFmpegGlue(FFmpegURLProtocol* protocol);
68 ~FFmpegGlue(); 70 ~FFmpegGlue();
69 71
70 // Opens an AVFormatContext specially prepared to process reads and seeks 72 // Opens an AVFormatContext specially prepared to process reads and seeks
71 // through the FFmpegURLProtocol provided during construction. 73 // through the FFmpegURLProtocol provided during construction.
72 bool OpenContext(); 74 bool OpenContext();
73 AVFormatContext* format_context() { return format_context_; } 75 AVFormatContext* format_context() { return format_context_; }
76 // Returns the container name.
77 // Note that it is only available after calling OpenContext.
78 container_names::MediaContainerName container() const {
79 DCHECK(open_called_);
80 return container_;
81 }
74 82
75 private: 83 private:
76 bool open_called_; 84 bool open_called_ = false;
77 AVFormatContext* format_context_; 85 AVFormatContext* format_context_ = nullptr;
78 std::unique_ptr<AVIOContext, ScopedPtrAVFree> avio_context_; 86 std::unique_ptr<AVIOContext, ScopedPtrAVFree> avio_context_;
87 container_names::MediaContainerName container_ =
88 container_names::CONTAINER_UNKNOWN;
79 89
80 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); 90 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue);
81 }; 91 };
82 92
83 } // namespace media 93 } // namespace media
84 94
85 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ 95 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | media/filters/ffmpeg_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698