| 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.media; | 5 package org.chromium.media; |
| 6 | 6 |
| 7 import android.media.AudioFormat; | 7 import android.media.AudioFormat; |
| 8 import android.media.AudioManager; | 8 import android.media.AudioManager; |
| 9 import android.media.AudioTrack; | 9 import android.media.AudioTrack; |
| 10 import android.media.MediaCodec; | 10 import android.media.MediaCodec; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 private static class DequeueInputResult { | 75 private static class DequeueInputResult { |
| 76 private final int mStatus; | 76 private final int mStatus; |
| 77 private final int mIndex; | 77 private final int mIndex; |
| 78 | 78 |
| 79 private DequeueInputResult(int status, int index) { | 79 private DequeueInputResult(int status, int index) { |
| 80 mStatus = status; | 80 mStatus = status; |
| 81 mIndex = index; | 81 mIndex = index; |
| 82 } | 82 } |
| 83 | 83 |
| 84 @CalledByNative("DequeueInputResult") | 84 @CalledByNative("DequeueInputResult") |
| 85 private int status() { return mStatus; } | 85 private int status() { |
| 86 return mStatus; |
| 87 } |
| 86 | 88 |
| 87 @CalledByNative("DequeueInputResult") | 89 @CalledByNative("DequeueInputResult") |
| 88 private int index() { return mIndex; } | 90 private int index() { |
| 91 return mIndex; |
| 92 } |
| 89 } | 93 } |
| 90 | 94 |
| 91 /** | 95 /** |
| 92 * This class represents supported android codec information. | 96 * This class represents supported android codec information. |
| 93 */ | 97 */ |
| 94 private static class CodecInfo { | 98 private static class CodecInfo { |
| 95 private final String mCodecType; // e.g. "video/x-vnd.on2.vp8". | 99 private final String mCodecType; // e.g. "video/x-vnd.on2.vp8". |
| 96 private final String mCodecName; // e.g. "OMX.google.vp8.decoder". | 100 private final String mCodecName; // e.g. "OMX.google.vp8.decoder". |
| 97 private final int mDirection; | 101 private final int mDirection; |
| 98 | 102 |
| 99 private CodecInfo(String codecType, String codecName, | 103 private CodecInfo(String codecType, String codecName, |
| 100 int direction) { | 104 int direction) { |
| 101 mCodecType = codecType; | 105 mCodecType = codecType; |
| 102 mCodecName = codecName; | 106 mCodecName = codecName; |
| 103 mDirection = direction; | 107 mDirection = direction; |
| 104 } | 108 } |
| 105 | 109 |
| 106 @CalledByNative("CodecInfo") | 110 @CalledByNative("CodecInfo") |
| 107 private String codecType() { return mCodecType; } | 111 private String codecType() { |
| 112 return mCodecType; |
| 113 } |
| 108 | 114 |
| 109 @CalledByNative("CodecInfo") | 115 @CalledByNative("CodecInfo") |
| 110 private String codecName() { return mCodecName; } | 116 private String codecName() { |
| 117 return mCodecName; |
| 118 } |
| 111 | 119 |
| 112 @CalledByNative("CodecInfo") | 120 @CalledByNative("CodecInfo") |
| 113 private int direction() { return mDirection; } | 121 private int direction() { |
| 122 return mDirection; |
| 123 } |
| 114 } | 124 } |
| 115 | 125 |
| 116 private static class DequeueOutputResult { | 126 private static class DequeueOutputResult { |
| 117 private final int mStatus; | 127 private final int mStatus; |
| 118 private final int mIndex; | 128 private final int mIndex; |
| 119 private final int mFlags; | 129 private final int mFlags; |
| 120 private final int mOffset; | 130 private final int mOffset; |
| 121 private final long mPresentationTimeMicroseconds; | 131 private final long mPresentationTimeMicroseconds; |
| 122 private final int mNumBytes; | 132 private final int mNumBytes; |
| 123 | 133 |
| 124 private DequeueOutputResult(int status, int index, int flags, int offset
, | 134 private DequeueOutputResult(int status, int index, int flags, int offset
, |
| 125 long presentationTimeMicroseconds, int numBytes) { | 135 long presentationTimeMicroseconds, int numBytes) { |
| 126 mStatus = status; | 136 mStatus = status; |
| 127 mIndex = index; | 137 mIndex = index; |
| 128 mFlags = flags; | 138 mFlags = flags; |
| 129 mOffset = offset; | 139 mOffset = offset; |
| 130 mPresentationTimeMicroseconds = presentationTimeMicroseconds; | 140 mPresentationTimeMicroseconds = presentationTimeMicroseconds; |
| 131 mNumBytes = numBytes; | 141 mNumBytes = numBytes; |
| 132 } | 142 } |
| 133 | 143 |
| 134 @CalledByNative("DequeueOutputResult") | 144 @CalledByNative("DequeueOutputResult") |
| 135 private int status() { return mStatus; } | 145 private int status() { |
| 146 return mStatus; |
| 147 } |
| 136 | 148 |
| 137 @CalledByNative("DequeueOutputResult") | 149 @CalledByNative("DequeueOutputResult") |
| 138 private int index() { return mIndex; } | 150 private int index() { |
| 151 return mIndex; |
| 152 } |
| 139 | 153 |
| 140 @CalledByNative("DequeueOutputResult") | 154 @CalledByNative("DequeueOutputResult") |
| 141 private int flags() { return mFlags; } | 155 private int flags() { |
| 156 return mFlags; |
| 157 } |
| 142 | 158 |
| 143 @CalledByNative("DequeueOutputResult") | 159 @CalledByNative("DequeueOutputResult") |
| 144 private int offset() { return mOffset; } | 160 private int offset() { |
| 161 return mOffset; |
| 162 } |
| 145 | 163 |
| 146 @CalledByNative("DequeueOutputResult") | 164 @CalledByNative("DequeueOutputResult") |
| 147 private long presentationTimeMicroseconds() { return mPresentationTimeMi
croseconds; } | 165 private long presentationTimeMicroseconds() { |
| 166 return mPresentationTimeMicroseconds; |
| 167 } |
| 148 | 168 |
| 149 @CalledByNative("DequeueOutputResult") | 169 @CalledByNative("DequeueOutputResult") |
| 150 private int numBytes() { return mNumBytes; } | 170 private int numBytes() { |
| 171 return mNumBytes; |
| 172 } |
| 151 } | 173 } |
| 152 | 174 |
| 153 /** | 175 /** |
| 154 * Get a list of supported android codec mimes. | 176 * Get a list of supported android codec mimes. |
| 155 */ | 177 */ |
| 156 @SuppressWarnings("deprecation") | 178 @SuppressWarnings("deprecation") |
| 157 @CalledByNative | 179 @CalledByNative |
| 158 private static CodecInfo[] getCodecsInfo() { | 180 private static CodecInfo[] getCodecsInfo() { |
| 159 // Return the first (highest-priority) codec for each MIME type. | 181 // Return the first (highest-priority) codec for each MIME type. |
| 160 Map<String, CodecInfo> encoderInfoMap = new HashMap<String, CodecInfo>()
; | 182 Map<String, CodecInfo> encoderInfoMap = new HashMap<String, CodecInfo>()
; |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 return AudioFormat.CHANNEL_OUT_QUAD; | 688 return AudioFormat.CHANNEL_OUT_QUAD; |
| 667 case 6: | 689 case 6: |
| 668 return AudioFormat.CHANNEL_OUT_5POINT1; | 690 return AudioFormat.CHANNEL_OUT_5POINT1; |
| 669 case 8: | 691 case 8: |
| 670 return AudioFormat.CHANNEL_OUT_7POINT1; | 692 return AudioFormat.CHANNEL_OUT_7POINT1; |
| 671 default: | 693 default: |
| 672 return AudioFormat.CHANNEL_OUT_DEFAULT; | 694 return AudioFormat.CHANNEL_OUT_DEFAULT; |
| 673 } | 695 } |
| 674 } | 696 } |
| 675 } | 697 } |
| OLD | NEW |