OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ | 5 #ifndef MEDIA_FILTERS_FFMPEG_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ |
6 #define MEDIA_FILTERS_FFMPEG_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ | 6 #define MEDIA_FILTERS_FFMPEG_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
10 #include "media/filters/ffmpeg_bitstream_converter.h" | 10 #include "media/filters/ffmpeg_bitstream_converter.h" |
11 #include "media/filters/h264_to_annex_b_bitstream_converter.h" | 11 #include "media/filters/h264_to_annex_b_bitstream_converter.h" |
12 | 12 |
13 // Forward declarations for FFmpeg datatypes used. | 13 // Forward declarations for FFmpeg datatypes used. |
14 struct AVCodecContext; | 14 struct AVCodecParameters; |
15 struct AVPacket; | 15 struct AVPacket; |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 // Bitstream converter that converts H.264 bitstream based FFmpeg packets into | 19 // Bitstream converter that converts H.264 bitstream based FFmpeg packets into |
20 // H.264 Annex B bytestream format. | 20 // H.264 Annex B bytestream format. |
21 class MEDIA_EXPORT FFmpegH264ToAnnexBBitstreamConverter | 21 class MEDIA_EXPORT FFmpegH264ToAnnexBBitstreamConverter |
22 : public FFmpegBitstreamConverter { | 22 : public FFmpegBitstreamConverter { |
23 public: | 23 public: |
24 // The |stream_codec_context| will be used during conversion and should be the | 24 // The |stream_codec_parameters| will be used during conversion and should be |
25 // AVCodecContext for the stream sourcing these packets. A reference to | 25 // the AVCodecParameters for the stream sourcing these packets. A reference to |
26 // |stream_codec_context| is retained, so it must outlive this class. | 26 // |stream_codec_parameters| is retained, so it must outlive this class. |
27 explicit FFmpegH264ToAnnexBBitstreamConverter( | 27 explicit FFmpegH264ToAnnexBBitstreamConverter( |
28 AVCodecContext* stream_codec_context); | 28 AVCodecParameters* stream_codec_parameters); |
29 | 29 |
30 ~FFmpegH264ToAnnexBBitstreamConverter() override; | 30 ~FFmpegH264ToAnnexBBitstreamConverter() override; |
31 | 31 |
32 // FFmpegBitstreamConverter implementation. | 32 // FFmpegBitstreamConverter implementation. |
33 // Converts |packet| to H.264 Annex B bytestream format. This conversion is | 33 // Converts |packet| to H.264 Annex B bytestream format. This conversion is |
34 // on single NAL unit basis which is contained within the |packet| with the | 34 // on single NAL unit basis which is contained within the |packet| with the |
35 // exception of the first packet which is prepended with the AVC decoder | 35 // exception of the first packet which is prepended with the AVC decoder |
36 // configuration record information. For example: | 36 // configuration record information. For example: |
37 // | 37 // |
38 // NAL unit #1 ==> bytestream buffer #1 (AVC configuraion + NAL unit #1) | 38 // NAL unit #1 ==> bytestream buffer #1 (AVC configuraion + NAL unit #1) |
(...skipping 13 matching lines...) Expand all Loading... |
52 | 52 |
53 private: | 53 private: |
54 // Actual converter class. | 54 // Actual converter class. |
55 H264ToAnnexBBitstreamConverter converter_; | 55 H264ToAnnexBBitstreamConverter converter_; |
56 | 56 |
57 // Flag for indicating whether global parameter sets have been processed. | 57 // Flag for indicating whether global parameter sets have been processed. |
58 bool configuration_processed_; | 58 bool configuration_processed_; |
59 | 59 |
60 // Variable to hold a pointer to memory where we can access the global | 60 // Variable to hold a pointer to memory where we can access the global |
61 // data from the FFmpeg file format's global headers. | 61 // data from the FFmpeg file format's global headers. |
62 AVCodecContext* stream_codec_context_; | 62 AVCodecParameters* stream_codec_parameters_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(FFmpegH264ToAnnexBBitstreamConverter); | 64 DISALLOW_COPY_AND_ASSIGN(FFmpegH264ToAnnexBBitstreamConverter); |
65 }; | 65 }; |
66 | 66 |
67 } // namespace media | 67 } // namespace media |
68 | 68 |
69 #endif // MEDIA_FILTERS_FFMPEG_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ | 69 #endif // MEDIA_FILTERS_FFMPEG_H264_TO_ANNEX_B_BITSTREAM_CONVERTER_H_ |
OLD | NEW |