| 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_ |
| 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/compiler_specific.h" |
| 16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 17 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
| 18 | 19 |
| 19 // FFmpeg types. | 20 // FFmpeg types. |
| 20 struct AVBitStreamFilterContext; | 21 struct AVBitStreamFilterContext; |
| 21 struct AVCodecContext; | 22 struct AVCodecContext; |
| 22 struct AVPacket; | 23 struct AVPacket; |
| 23 | 24 |
| 24 namespace media { | 25 namespace media { |
| 25 | 26 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 DISALLOW_COPY_AND_ASSIGN(BitstreamConverter); | 43 DISALLOW_COPY_AND_ASSIGN(BitstreamConverter); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 class IdentityBitstreamConverter : public BitstreamConverter { | 46 class IdentityBitstreamConverter : public BitstreamConverter { |
| 46 public: | 47 public: |
| 47 IdentityBitstreamConverter() {} | 48 IdentityBitstreamConverter() {} |
| 48 virtual ~IdentityBitstreamConverter() {} | 49 virtual ~IdentityBitstreamConverter() {} |
| 49 | 50 |
| 50 virtual bool Initialize(); | 51 virtual bool Initialize() OVERRIDE; |
| 51 virtual bool ConvertPacket(AVPacket* packet); | 52 virtual bool ConvertPacket(AVPacket* packet) OVERRIDE; |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(IdentityBitstreamConverter); | 55 DISALLOW_COPY_AND_ASSIGN(IdentityBitstreamConverter); |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 class MEDIA_EXPORT FFmpegBitstreamConverter : public BitstreamConverter { | 58 class MEDIA_EXPORT FFmpegBitstreamConverter : public BitstreamConverter { |
| 58 public: | 59 public: |
| 59 // Creates FFmpegBitstreamConverter based on the FFmpeg bistream filter | 60 // Creates FFmpegBitstreamConverter based on the FFmpeg bistream filter |
| 60 // corresponding to |filter_name|. | 61 // corresponding to |filter_name|. |
| 61 // | 62 // |
| 62 // The |stream_context| will be used during conversion and should be the | 63 // The |stream_context| will be used during conversion and should be the |
| 63 // AVCodecContext for the stream sourcing these packets. A reference to | 64 // AVCodecContext for the stream sourcing these packets. A reference to |
| 64 // |stream_context| is retained, so it must outlive this class. | 65 // |stream_context| is retained, so it must outlive this class. |
| 65 FFmpegBitstreamConverter(const std::string& filter_name, | 66 FFmpegBitstreamConverter(const std::string& filter_name, |
| 66 AVCodecContext* stream_context); | 67 AVCodecContext* stream_context); |
| 67 virtual ~FFmpegBitstreamConverter(); | 68 virtual ~FFmpegBitstreamConverter(); |
| 68 | 69 |
| 69 virtual bool Initialize(); | 70 virtual bool Initialize() OVERRIDE; |
| 70 virtual bool ConvertPacket(AVPacket* packet); | 71 virtual bool ConvertPacket(AVPacket* packet) OVERRIDE; |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 std::string filter_name_; | 74 std::string filter_name_; |
| 74 AVBitStreamFilterContext* stream_filter_; | 75 AVBitStreamFilterContext* stream_filter_; |
| 75 AVCodecContext* stream_context_; | 76 AVCodecContext* stream_context_; |
| 76 | 77 |
| 77 DISALLOW_COPY_AND_ASSIGN(FFmpegBitstreamConverter); | 78 DISALLOW_COPY_AND_ASSIGN(FFmpegBitstreamConverter); |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace media | 81 } // namespace media |
| 81 | 82 |
| 82 #endif // MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ | 83 #endif // MEDIA_FILTERS_BITSTREAM_CONVERTER_H_ |
| OLD | NEW |