OLD | NEW |
---|---|
1 // Copyright (c) 2011 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_ |
(...skipping 25 matching lines...) Expand all Loading... | |
36 // Attemps to convert the AVPacket from one format to another, based on the | 36 // Attemps to convert the AVPacket from one format to another, based on the |
37 // specific type of BitstreamConverter that was instantiated. Output will be | 37 // specific type of BitstreamConverter that was instantiated. Output will be |
38 // stored into the |packet|, but user should be aware that conversion can free | 38 // stored into the |packet|, but user should be aware that conversion can free |
39 // and reallocate the input buffer, if it needs to do so to fit it in. | 39 // and reallocate the input buffer, if it needs to do so to fit it in. |
40 virtual bool ConvertPacket(AVPacket* packet) = 0; | 40 virtual bool ConvertPacket(AVPacket* packet) = 0; |
41 | 41 |
42 private: | 42 private: |
43 DISALLOW_COPY_AND_ASSIGN(BitstreamConverter); | 43 DISALLOW_COPY_AND_ASSIGN(BitstreamConverter); |
44 }; | 44 }; |
45 | 45 |
46 class IdentityBitstreamConverter : public BitstreamConverter { | |
47 public: | |
48 IdentityBitstreamConverter() {} | |
49 virtual ~IdentityBitstreamConverter() {} | |
50 | |
51 virtual bool Initialize() OVERRIDE; | |
52 virtual bool ConvertPacket(AVPacket* packet) OVERRIDE; | |
53 | |
54 private: | |
55 DISALLOW_COPY_AND_ASSIGN(IdentityBitstreamConverter); | |
56 }; | |
57 | |
58 class MEDIA_EXPORT FFmpegBitstreamConverter : public BitstreamConverter { | 46 class MEDIA_EXPORT FFmpegBitstreamConverter : public BitstreamConverter { |
Ami GONE FROM CHROMIUM
2012/07/11 17:25:47
Any reason not to collapse this into the base now
| |
59 public: | 47 public: |
60 // Creates FFmpegBitstreamConverter based on the FFmpeg bistream filter | 48 // Creates FFmpegBitstreamConverter based on the FFmpeg bistream filter |
61 // corresponding to |filter_name|. | 49 // corresponding to |filter_name|. |
62 // | 50 // |
63 // The |stream_context| will be used during conversion and should be the | 51 // The |stream_context| will be used during conversion and should be the |
64 // AVCodecContext for the stream sourcing these packets. A reference to | 52 // AVCodecContext for the stream sourcing these packets. A reference to |
65 // |stream_context| is retained, so it must outlive this class. | 53 // |stream_context| is retained, so it must outlive this class. |
66 FFmpegBitstreamConverter(const std::string& filter_name, | 54 FFmpegBitstreamConverter(const std::string& filter_name, |
67 AVCodecContext* stream_context); | 55 AVCodecContext* stream_context); |
68 virtual ~FFmpegBitstreamConverter(); | 56 virtual ~FFmpegBitstreamConverter(); |
69 | 57 |
70 virtual bool Initialize() OVERRIDE; | 58 virtual bool Initialize() OVERRIDE; |
71 virtual bool ConvertPacket(AVPacket* packet) OVERRIDE; | 59 virtual bool ConvertPacket(AVPacket* packet) OVERRIDE; |
72 | 60 |
73 private: | 61 private: |
74 std::string filter_name_; | 62 std::string filter_name_; |
75 AVBitStreamFilterContext* stream_filter_; | 63 AVBitStreamFilterContext* stream_filter_; |
76 AVCodecContext* stream_context_; | 64 AVCodecContext* stream_context_; |
77 | 65 |
78 DISALLOW_COPY_AND_ASSIGN(FFmpegBitstreamConverter); | 66 DISALLOW_COPY_AND_ASSIGN(FFmpegBitstreamConverter); |
79 }; | 67 }; |
80 | 68 |
81 } // namespace media | 69 } // namespace media |
82 | 70 |
83 #endif // MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ | 71 #endif // MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ |
OLD | NEW |