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

Side by Side Diff: media/ffmpeg/ffmpeg_common.h

Issue 909002: Removed custom FFmpegLock. Removed ffmpeg headers from third_party/ffmpeg/include. (Closed)
Patch Set: Updated Created 10 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
« no previous file with comments | « media/base/mock_ffmpeg.cc ('k') | media/ffmpeg/ffmpeg_common.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_FFMPEG_FFMPEG_COMMON_H_ 5 #ifndef MEDIA_FFMPEG_FFMPEG_COMMON_H_
6 #define MEDIA_FFMPEG_FFMPEG_COMMON_H_ 6 #define MEDIA_FFMPEG_FFMPEG_COMMON_H_
7 7
8 // Used for FFmpeg error codes. 8 // Used for FFmpeg error codes.
9 #include <cerrno> 9 #include <cerrno>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/singleton.h" 12 #include "base/singleton.h"
13 13
14 // Used with URLProtocol. 14 // Used with URLProtocol.
15 typedef int64 offset_t; 15 typedef int64 offset_t;
16 16
17 // Include FFmpeg header files. 17 // Include FFmpeg header files.
18 extern "C" { 18 extern "C" {
19 // Temporarily disable possible loss of data warning. 19 // Temporarily disable possible loss of data warning.
20 // TODO(scherkus): fix and upstream the compiler warnings. 20 // TODO(scherkus): fix and upstream the compiler warnings.
21 MSVC_PUSH_DISABLE_WARNING(4244); 21 MSVC_PUSH_DISABLE_WARNING(4244);
22 #include "third_party/ffmpeg/include/libavcodec/avcodec.h" 22 #include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavcodec/avcodec.h"
23 #include "third_party/ffmpeg/include/libavformat/avformat.h" 23 #include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavformat/avformat.h"
24 #include "third_party/ffmpeg/include/libavutil/log.h" 24 #include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavutil/log.h"
25 MSVC_POP_WARNING(); 25 MSVC_POP_WARNING();
26 } // extern "C" 26 } // extern "C"
27 27
28 namespace media { 28 namespace media {
29 29
30 // FFmpegLock is used to serialize calls to avcodec_open(), avcodec_close(),
31 // and av_find_stream_info() for an entire process because for whatever reason
32 // it does Very Bad Things to other FFmpeg instances.
33 //
34 // TODO(scherkus): track down and upstream a fix to FFmpeg, if possible.
35 class FFmpegLock : public Singleton<FFmpegLock> {
36 public:
37 Lock& lock();
38
39 private:
40 // Only allow Singleton to create and delete FFmpegLock.
41 friend struct DefaultSingletonTraits<FFmpegLock>;
42 FFmpegLock();
43 virtual ~FFmpegLock();
44
45 Lock lock_;
46 DISALLOW_COPY_AND_ASSIGN(FFmpegLock);
47 };
48
49
50 // Wraps FFmpeg's av_free() in a class that can be passed as a template argument 30 // Wraps FFmpeg's av_free() in a class that can be passed as a template argument
51 // to scoped_ptr_malloc. 31 // to scoped_ptr_malloc.
52 class ScopedPtrAVFree { 32 class ScopedPtrAVFree {
53 public: 33 public:
54 inline void operator()(void* x) const { 34 inline void operator()(void* x) const {
55 av_free(x); 35 av_free(x);
56 } 36 }
57 }; 37 };
58 38
59 // This assumes that the AVPacket being captured was allocated outside of 39 // This assumes that the AVPacket being captured was allocated outside of
(...skipping 13 matching lines...) Expand all
73 namespace mime_type { 53 namespace mime_type {
74 54
75 extern const char kFFmpegAudio[]; 55 extern const char kFFmpegAudio[];
76 extern const char kFFmpegVideo[]; 56 extern const char kFFmpegVideo[];
77 57
78 } // namespace mime_type 58 } // namespace mime_type
79 59
80 } // namespace media 60 } // namespace media
81 61
82 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_ 62 #endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_
OLDNEW
« no previous file with comments | « media/base/mock_ffmpeg.cc ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698