private void _ups_Unpacked(object arg1, Nalu arg2) { if (_decoder == null) { _decoder = new VideoDecoder(); var codicId = Constants.AVCodecID.AV_CODEC_ID_H264; _decoder.Create(codicId); } if (arg2.Header.Type == 7 || arg2.Header.Type == 8) { _decoder.Decode(arg2.BytesWithStartCode(), out _curWidth, out _curHeight); } else { byte[] frameData = _decoder.Decode(arg2.BytesWithStartCode(), out _curWidth, out _curHeight); if (frameData != null) { if (_curWidth != _width || _curHeight != _height) { _width = _curWidth; _height = _curHeight; _renderSource.SetupSurface(_curWidth, _curHeight); } renderFrame(frameData); } } }
public void Init(Constants.AVCodecID codecID, int width, int height) { if (_decoder == null || _codecId != codecID || _width != width || _Height != height) { Release(); _decoder = new VideoDecoder(); _decoder.Create(codecID); _codecId = codecID; _width = width; _Height = height; } }
private void onHeader(IHeaderPacket packet) { lock (_objLock) { checkStyleChanged(packet); if (_isTransform) { _decoder = new VideoDecoder(); _decoder.Create(Constants.AVCodecID.AV_CODEC_ID_H264); } else { initHikDecoder((packet as HikHeaderPacket).Buffer); } } }
private void onHeader(IHeaderPacket packet) { var header = packet as StandardHeaderPacket; Console.Write("header {0}:", header.Buffer.Length); for (int i = 0; i < header.Buffer.Length; i++) { Console.Write("{0:X2}, ", header.Buffer[i]); } Console.WriteLine(); _decoder = new VideoDecoder(); _decoder.Create((Constants.AVCodecID)header.CodecID); int width = 0; int height = 0; _decoder.Decode(header.Buffer, out width, out height); }
private void onHeader(IHeaderPacket packet) { var header = packet as StandardHeaderPacket; _rtspServer.UpdateHeader(header.Buffer); Console.WriteLine(); string rtspstr = $"rtsp header {header.Buffer.Length}:"; for (int i = 0; i < header.Buffer.Length; i++) { rtspstr += string.Format("{0:X2}, ", header.Buffer[i]); } Console.WriteLine(rtspstr); _decoder = new VideoDecoder(); _decoder.Create((Constants.AVCodecID)header.CodecID); int width = 0; int height = 0; byte[] frame = _decoder.Decode(header.Buffer, out width, out height); }