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