OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
10 import android.media.MediaMetadataRetriever; | 10 import android.media.MediaMetadataRetriever; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 int result = 1; | 91 int result = 1; |
92 result = prime * result + mDurationInMilliseconds; | 92 result = prime * result + mDurationInMilliseconds; |
93 result = prime * result + mHeight; | 93 result = prime * result + mHeight; |
94 result = prime * result + (mSuccess ? 1231 : 1237); | 94 result = prime * result + (mSuccess ? 1231 : 1237); |
95 result = prime * result + mWidth; | 95 result = prime * result + mWidth; |
96 return result; | 96 return result; |
97 } | 97 } |
98 | 98 |
99 @Override | 99 @Override |
100 public boolean equals(Object obj) { | 100 public boolean equals(Object obj) { |
101 if (this == obj) | 101 if (this == obj) return true; |
102 return true; | 102 if (obj == null) return false; |
103 if (obj == null) | 103 if (getClass() != obj.getClass()) return false; |
104 return false; | |
105 if (getClass() != obj.getClass()) | |
106 return false; | |
107 MediaMetadata other = (MediaMetadata) obj; | 104 MediaMetadata other = (MediaMetadata) obj; |
108 if (mDurationInMilliseconds != other.mDurationInMilliseconds) | 105 if (mDurationInMilliseconds != other.mDurationInMilliseconds) return
false; |
109 return false; | 106 if (mHeight != other.mHeight) return false; |
110 if (mHeight != other.mHeight) | 107 if (mSuccess != other.mSuccess) return false; |
111 return false; | 108 if (mWidth != other.mWidth) return false; |
112 if (mSuccess != other.mSuccess) | |
113 return false; | |
114 if (mWidth != other.mWidth) | |
115 return false; | |
116 return true; | 109 return true; |
117 } | 110 } |
118 } | 111 } |
119 | 112 |
120 @CalledByNative | 113 @CalledByNative |
121 private static MediaMetadata extractMediaMetadata(final Context context, | 114 private static MediaMetadata extractMediaMetadata(final Context context, |
122 final String url, | 115 final String url, |
123 final String cookies, | 116 final String cookies, |
124 final String userAgent) { | 117 final String userAgent) { |
125 return new MediaResourceGetter().extract( | 118 return new MediaResourceGetter().extract( |
126 context, url, cookies, userAgent); | 119 context, url, cookies, userAgent); |
127 } | 120 } |
128 | 121 |
129 @CalledByNative | 122 @CalledByNative |
130 private static MediaMetadata extractMediaMetadataFromFd(int fd, | 123 private static MediaMetadata extractMediaMetadataFromFd(int fd, |
131 long offset, | 124 long offset, |
132 long length) { | 125 long length) { |
133 return new MediaResourceGetter().extract(fd, offset, length); | 126 return new MediaResourceGetter().extract(fd, offset, length); |
134 } | 127 } |
135 | 128 |
136 @VisibleForTesting | 129 @VisibleForTesting |
137 MediaMetadata extract(int fd, long offset, long length) { | 130 MediaMetadata extract(int fd, long offset, long length) { |
138 if (!androidDeviceOk(android.os.Build.MODEL, android.os.Build.VERSION.SD
K_INT)) { | 131 if (!androidDeviceOk(android.os.Build.MODEL, android.os.Build.VERSION.SD
K_INT)) { |
139 return EMPTY_METADATA; | 132 return EMPTY_METADATA; |
140 } | 133 } |
141 | 134 |
142 configure(fd, offset, length); | 135 configure(fd, offset, length); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 @VisibleForTesting | 415 @VisibleForTesting |
423 void configure(String path) { | 416 void configure(String path) { |
424 mRetriever.setDataSource(path); | 417 mRetriever.setDataSource(path); |
425 } | 418 } |
426 | 419 |
427 @VisibleForTesting | 420 @VisibleForTesting |
428 String extractMetadata(int key) { | 421 String extractMetadata(int key) { |
429 return mRetriever.extractMetadata(key); | 422 return mRetriever.extractMetadata(key); |
430 } | 423 } |
431 } | 424 } |
OLD | NEW |