| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ | 5 #ifndef MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ |
| 6 #define MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ | 6 #define MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 12 #include "media/filters/ffmpeg_bitstream_converter.h" | 12 #include "media/filters/ffmpeg_bitstream_converter.h" |
| 13 #include "media/formats/mp4/hevc.h" | 13 #include "media/formats/mp4/hevc.h" |
| 14 | 14 |
| 15 // Forward declarations for FFmpeg datatypes used. | 15 // Forward declarations for FFmpeg datatypes used. |
| 16 struct AVCodecContext; | 16 struct AVCodecParameters; |
| 17 struct AVPacket; | 17 struct AVPacket; |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 | 20 |
| 21 // Bitstream converter that converts H.265 bitstream based FFmpeg packets into | 21 // Bitstream converter that converts H.265 bitstream based FFmpeg packets into |
| 22 // H.265 Annex B bytestream format. | 22 // H.265 Annex B bytestream format. |
| 23 class MEDIA_EXPORT FFmpegH265ToAnnexBBitstreamConverter | 23 class MEDIA_EXPORT FFmpegH265ToAnnexBBitstreamConverter |
| 24 : public FFmpegBitstreamConverter { | 24 : public FFmpegBitstreamConverter { |
| 25 public: | 25 public: |
| 26 // The |stream_codec_context| will be used during conversion and should be the | 26 // The |stream_codec_parameters| will be used during conversion and should be |
| 27 // AVCodecContext for the stream sourcing these packets. A reference to | 27 // the AVCodecParameters for the stream sourcing these packets. A reference to |
| 28 // |stream_codec_context| is retained, so it must outlive this class. | 28 // |stream_codec_parameters| is retained, so it must outlive this class. |
| 29 explicit FFmpegH265ToAnnexBBitstreamConverter( | 29 explicit FFmpegH265ToAnnexBBitstreamConverter( |
| 30 AVCodecContext* stream_codec_context); | 30 AVCodecParameters* stream_codec_parameters); |
| 31 | 31 |
| 32 ~FFmpegH265ToAnnexBBitstreamConverter() override; | 32 ~FFmpegH265ToAnnexBBitstreamConverter() override; |
| 33 | 33 |
| 34 // FFmpegBitstreamConverter implementation. | 34 // FFmpegBitstreamConverter implementation. |
| 35 bool ConvertPacket(AVPacket* packet) override; | 35 bool ConvertPacket(AVPacket* packet) override; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 std::unique_ptr<mp4::HEVCDecoderConfigurationRecord> hevc_config_; | 38 std::unique_ptr<mp4::HEVCDecoderConfigurationRecord> hevc_config_; |
| 39 | 39 |
| 40 // Variable to hold a pointer to memory where we can access the global | 40 // Variable to hold a pointer to memory where we can access the global |
| 41 // data from the FFmpeg file format's global headers. | 41 // data from the FFmpeg file format's global headers. |
| 42 AVCodecContext* stream_codec_context_; | 42 AVCodecParameters* stream_codec_parameters_; |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(FFmpegH265ToAnnexBBitstreamConverter); | 44 DISALLOW_COPY_AND_ASSIGN(FFmpegH265ToAnnexBBitstreamConverter); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace media | 47 } // namespace media |
| 48 | 48 |
| 49 #endif // MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ | 49 #endif // MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ |
| 50 | 50 |
| OLD | NEW |