OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Interface and some concrete classes for applying various transforms | 5 // Interface and some concrete classes for applying various transforms |
6 // to AVPackets. FFmpegBitstreamConverter, in particular, can be used | 6 // to AVPackets. FFmpegBitstreamConverter, in particular, can be used |
7 // to apply FFmpeg bitstream filters to the incoming AVPacket to transcode | 7 // to apply FFmpeg bitstream filters to the incoming AVPacket to transcode |
8 // the packet format. | 8 // the packet format. |
9 | 9 |
10 #ifndef MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ | 10 #ifndef MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ |
11 #define MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ | 11 #define MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "media/base/media_export.h" |
17 | 18 |
18 // FFmpeg types. | 19 // FFmpeg types. |
19 struct AVBitStreamFilterContext; | 20 struct AVBitStreamFilterContext; |
20 struct AVCodecContext; | 21 struct AVCodecContext; |
21 struct AVPacket; | 22 struct AVPacket; |
22 | 23 |
23 namespace media { | 24 namespace media { |
24 | 25 |
25 class BitstreamConverter { | 26 class MEDIA_EXPORT BitstreamConverter { |
26 public: | 27 public: |
27 BitstreamConverter() {} | 28 BitstreamConverter() {} |
28 virtual ~BitstreamConverter() {} | 29 virtual ~BitstreamConverter() {} |
29 | 30 |
30 // Initialize does any preparations needed before doing the actual | 31 // Initialize does any preparations needed before doing the actual |
31 // conversion. | 32 // conversion. |
32 virtual bool Initialize() = 0; | 33 virtual bool Initialize() = 0; |
33 | 34 |
34 // Attemps to convert the AVPacket from one format to another, based on the | 35 // Attemps to convert the AVPacket from one format to another, based on the |
35 // specific type of BitstreamConverter that was instantiated. Output will be | 36 // specific type of BitstreamConverter that was instantiated. Output will be |
(...skipping 10 matching lines...) Expand all Loading... |
46 IdentityBitstreamConverter() {} | 47 IdentityBitstreamConverter() {} |
47 virtual ~IdentityBitstreamConverter() {} | 48 virtual ~IdentityBitstreamConverter() {} |
48 | 49 |
49 virtual bool Initialize(); | 50 virtual bool Initialize(); |
50 virtual bool ConvertPacket(AVPacket* packet); | 51 virtual bool ConvertPacket(AVPacket* packet); |
51 | 52 |
52 private: | 53 private: |
53 DISALLOW_COPY_AND_ASSIGN(IdentityBitstreamConverter); | 54 DISALLOW_COPY_AND_ASSIGN(IdentityBitstreamConverter); |
54 }; | 55 }; |
55 | 56 |
56 class FFmpegBitstreamConverter : public BitstreamConverter { | 57 class MEDIA_EXPORT FFmpegBitstreamConverter : public BitstreamConverter { |
57 public: | 58 public: |
58 // Creates FFmpegBitstreamConverter based on the FFmpeg bistream filter | 59 // Creates FFmpegBitstreamConverter based on the FFmpeg bistream filter |
59 // corresponding to |filter_name|. | 60 // corresponding to |filter_name|. |
60 // | 61 // |
61 // The |stream_context| will be used during conversion and should be the | 62 // The |stream_context| will be used during conversion and should be the |
62 // AVCodecContext for the stream sourcing these packets. A reference to | 63 // AVCodecContext for the stream sourcing these packets. A reference to |
63 // |stream_context| is retained, so it must outlive this class. | 64 // |stream_context| is retained, so it must outlive this class. |
64 FFmpegBitstreamConverter(const std::string& filter_name, | 65 FFmpegBitstreamConverter(const std::string& filter_name, |
65 AVCodecContext* stream_context); | 66 AVCodecContext* stream_context); |
66 virtual ~FFmpegBitstreamConverter(); | 67 virtual ~FFmpegBitstreamConverter(); |
(...skipping 10 matching lines...) Expand all Loading... |
77 std::string filter_name_; | 78 std::string filter_name_; |
78 AVBitStreamFilterContext* stream_filter_; | 79 AVBitStreamFilterContext* stream_filter_; |
79 AVCodecContext* stream_context_; | 80 AVCodecContext* stream_context_; |
80 | 81 |
81 DISALLOW_COPY_AND_ASSIGN(FFmpegBitstreamConverter); | 82 DISALLOW_COPY_AND_ASSIGN(FFmpegBitstreamConverter); |
82 }; | 83 }; |
83 | 84 |
84 } // namespace media | 85 } // namespace media |
85 | 86 |
86 #endif // MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ | 87 #endif // MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ |
OLD | NEW |