load 数据走的httpurlfetcher 的loaddata 从MultiLoader 调用而来
load到inputstream流后的处理 核心
图片是glide 首先创建解释器的时候 加了videodecoder 然后这里会从流中加载对应帧的图片保存在手机cache目录中 将这个file 作为bitmap传递 然后加载
private static final class ByteBufferFetcher implements DataFetcher<ByteBuffer> {private final File file;@Synthetic@SuppressWarnings("WeakerAccess")ByteBufferFetcher(File file) {this.file = file;}
几个核心的类 VideoDecoder
public interface VideoDecoder {/** Settings passed to the decoder by WebRTC. */public class Settings {public final int numberOfCores;public final int width;public final int height;@CalledByNative("Settings")public Settings(int numberOfCores, int width, int height) {this.numberOfCores = numberOfCores;this.width = width;this.height = height;}}/** Additional info for decoding. */public class DecodeInfo {public final boolean isMissingFrames;public final long renderTimeMs;public DecodeInfo(boolean isMissingFrames, long renderTimeMs) {this.isMissingFrames = isMissingFrames;this.renderTimeMs = renderTimeMs;}}public interface Callback {/*** Call to return a decoded frame. Can be called on any thread.** @param frame Decoded frame* @param decodeTimeMs Time it took to decode the frame in milliseconds or null if not available* @param qp QP value of the decoded frame or null if not available*/void onDecodedFrame(VideoFrame frame, Integer decodeTimeMs, Integer qp);}
以及VideoBitmapDecoder
@Deprecated
public class VideoBitmapDecoder extends VideoDecoder<ParcelFileDescriptor> {@SuppressWarnings("unused")public VideoBitmapDecoder(Context context) {this(Glide.get(context).getBitmapPool());}// Public API@SuppressWarnings("WeakerAccess")public VideoBitmapDecoder(BitmapPool bitmapPool) {super(bitmapPool, new ParcelFileDescriptorInitializer());}
}
以上就是 video加载核心部分的分析 在VideoDecoder::decode() 以及 加上断点就可以很清楚的分析出load到图片以后的transform过程
第二部分 网络请求部分 以及自定义headers token等 modelfactory
在 加断点
他是从这里调用过来的MultiModelLoader