Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h

Issue 816353010: Implemented HEVC video demuxing and parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjusted inclusion of hevc source files in gyp/gn Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 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_AAC_BITSTREAM_CONVERTER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
6 #define MEDIA_FILTERS_FFMPEG_AAC_BITSTREAM_CONVERTER_H_ 6 #define MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
10 #include "media/filters/ffmpeg_bitstream_converter.h" 11 #include "media/filters/ffmpeg_bitstream_converter.h"
12 #include "media/formats/mp4/box_definitions.h"
11 13
12 // Forward declarations for FFmpeg datatypes used. 14 // Forward declarations for FFmpeg datatypes used.
13 struct AVCodecContext; 15 struct AVCodecContext;
14 struct AVPacket; 16 struct AVPacket;
15 17
16 namespace media { 18 namespace media {
17 19
18 // Bitstream converter that adds ADTS headers to AAC frames. 20 // Bitstream converter that converts H.265 bitstream based FFmpeg packets into
19 class MEDIA_EXPORT FFmpegAACBitstreamConverter 21 // H.265 Annex B bytestream format.
22 class MEDIA_EXPORT FFmpegH265ToAnnexBBitstreamConverter
20 : public FFmpegBitstreamConverter { 23 : public FFmpegBitstreamConverter {
21 public: 24 public:
22 enum { kAdtsHeaderSize = 7 };
23
24 // The |stream_codec_context| will be used during conversion and should be the 25 // The |stream_codec_context| will be used during conversion and should be the
25 // AVCodecContext for the stream sourcing these packets. A reference to 26 // AVCodecContext for the stream sourcing these packets. A reference to
26 // |stream_codec_context| is retained, so it must outlive this class. 27 // |stream_codec_context| is retained, so it must outlive this class.
27 explicit FFmpegAACBitstreamConverter(AVCodecContext* stream_codec_context); 28 explicit FFmpegH265ToAnnexBBitstreamConverter(
28 ~FFmpegAACBitstreamConverter() override; 29 AVCodecContext* stream_codec_context);
30
31 ~FFmpegH265ToAnnexBBitstreamConverter() override;
29 32
30 // FFmpegBitstreamConverter implementation. 33 // FFmpegBitstreamConverter implementation.
31 // Uses FFmpeg allocation methods for buffer allocation to ensure
32 // compatibility with FFmpeg's memory management.
33 bool ConvertPacket(AVPacket* packet) override; 34 bool ConvertPacket(AVPacket* packet) override;
34 35
35 private: 36 private:
37 scoped_ptr<mp4::HEVCDecoderConfigurationRecord> hevc_config_;
38
36 // Variable to hold a pointer to memory where we can access the global 39 // Variable to hold a pointer to memory where we can access the global
37 // data from the FFmpeg file format's global headers. 40 // data from the FFmpeg file format's global headers.
38 AVCodecContext* stream_codec_context_; 41 AVCodecContext* stream_codec_context_;
39 42
40 bool header_generated_; 43 DISALLOW_COPY_AND_ASSIGN(FFmpegH265ToAnnexBBitstreamConverter);
41 uint8_t hdr_[kAdtsHeaderSize];
42
43 DISALLOW_COPY_AND_ASSIGN(FFmpegAACBitstreamConverter);
44 }; 44 };
45 45
46 } // namespace media 46 } // namespace media
47 47
48 #endif // MEDIA_FILTERS_FFMPEG_AAC_BITSTREAM_CONVERTER_H_ 48 #endif // MEDIA_FILTERS_FFMPEG_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
49
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698