OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "media/base/audio_video_metadata_extractor.h" | 5 #include "media/base/audio_video_metadata_extractor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 StreamInfo& info = stream_infos_.back(); | 106 StreamInfo& info = stream_infos_.back(); |
107 | 107 |
108 AVStream* stream = format_context->streams[i]; | 108 AVStream* stream = format_context->streams[i]; |
109 if (!stream) | 109 if (!stream) |
110 continue; | 110 continue; |
111 | 111 |
112 // Extract dictionary from streams also. Needed for containers that attach | 112 // Extract dictionary from streams also. Needed for containers that attach |
113 // metadata to contained streams instead the container itself, like OGG. | 113 // metadata to contained streams instead the container itself, like OGG. |
114 ExtractDictionary(stream->metadata, &info.tags); | 114 ExtractDictionary(stream->metadata, &info.tags); |
115 | 115 |
116 if (!stream->codec) | 116 if (!stream->codecpar) |
117 continue; | 117 continue; |
118 | 118 |
119 info.type = avcodec_get_name(stream->codec->codec_id); | 119 info.type = avcodec_get_name(stream->codecpar->codec_id); |
120 | 120 |
121 // Extract dimensions of largest stream that's not an attached image. | 121 // Extract dimensions of largest stream that's not an attached image. |
122 if (stream->codec->width > 0 && stream->codec->width > width_ && | 122 if (stream->codecpar->width > 0 && stream->codecpar->width > width_ && |
123 stream->codec->height > 0 && stream->codec->height > height_) { | 123 stream->codecpar->height > 0 && stream->codecpar->height > height_) { |
124 width_ = stream->codec->width; | 124 width_ = stream->codecpar->width; |
125 height_ = stream->codec->height; | 125 height_ = stream->codecpar->height; |
126 } | 126 } |
127 | 127 |
128 // Extract attached image if requested. | 128 // Extract attached image if requested. |
129 if (extract_attached_images && | 129 if (extract_attached_images && |
130 stream->disposition == AV_DISPOSITION_ATTACHED_PIC && | 130 stream->disposition == AV_DISPOSITION_ATTACHED_PIC && |
131 stream->attached_pic.size > 0 && | 131 stream->attached_pic.size > 0 && |
132 stream->attached_pic.size <= kAttachedImageSizeLimit && | 132 stream->attached_pic.size <= kAttachedImageSizeLimit && |
133 stream->attached_pic.data != NULL) { | 133 stream->attached_pic.data != NULL) { |
134 attached_images_bytes_.push_back(std::string()); | 134 attached_images_bytes_.push_back(std::string()); |
135 attached_images_bytes_.back().assign( | 135 attached_images_bytes_.back().assign( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 if (ExtractString(tag, "encoder", &encoder_)) continue; | 255 if (ExtractString(tag, "encoder", &encoder_)) continue; |
256 if (ExtractString(tag, "encoded_by", &encoded_by_)) continue; | 256 if (ExtractString(tag, "encoded_by", &encoded_by_)) continue; |
257 if (ExtractString(tag, "genre", &genre_)) continue; | 257 if (ExtractString(tag, "genre", &genre_)) continue; |
258 if (ExtractString(tag, "language", &language_)) continue; | 258 if (ExtractString(tag, "language", &language_)) continue; |
259 if (ExtractString(tag, "title", &title_)) continue; | 259 if (ExtractString(tag, "title", &title_)) continue; |
260 if (ExtractInt(tag, "track", &track_)) continue; | 260 if (ExtractInt(tag, "track", &track_)) continue; |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 } // namespace media | 264 } // namespace media |
OLD | NEW |