decoder

How to save SurfaceTexture as bitmap

本小妞迷上赌 提交于 2019-11-28 00:09:38
When I decode a video to a surface I want to save the frames i want as bitmap/jpeg files. I don't want to draw on the screen and just want to save the content of the SurfaceTexture as an image file. You have to render the texture. If it were a normal texture, and you were using GLES 2 or later, you could attach it to an FBO and read directly from that. A SurfaceTexture is backed by an " external texture ", and might be in a format that the GL driver doesn't support a full set of operations on, so you can't do that. You need to render it, and read the result. FWIW, the way you go about saving

How do I decode a DER encoded string in Java?

若如初见. 提交于 2019-11-27 21:21:12
I'm trying to read a custom extension from a digital certificate. I know the value is a GeneralString encoded in DER. Is there an easy way to correctly decode it and get a Java String? I tried the following, but 's' includes some of the encoding metadata as junk characters at the start of the string. byte[] ext = cert.getExtensionValue("1.2.3.4"); String s= new String(ext); System.out.println(s); Is there a quick and easy way to do this? Or do I really need to use some full fledged ASN.1 library? Thanks! BouncyCastle is (among everything else): A library for reading and writing encoded ASN.1

H264 with multiple PPS and SPS

巧了我就是萌 提交于 2019-11-27 18:52:25
I have a card that produces a H264 stream with a SPS (Sequence Parameter Set) and a PPS (Picture Parameter Set), in that order, directly before each I-Frame. I see that most H264 streams contain a PPS and SPS at the first I-Frame. Is this recommended? Do decoders/muxers typically support multiple PPS and SRS? H.264 comes in a variety of stream formats. One variation is called "Annex B". (AUD)(SPS)(PPS)(I-Slice)(PPS)(P-Slice)(PPS)(P-Slice) ... (AUD)(SPS)(PPS)(I-Slice). Typically you see SPS/PPS before each I frame and PPS before other slices. Most decoders/muxers are happy with "Annex B" and

How to save SurfaceTexture as bitmap

断了今生、忘了曾经 提交于 2019-11-26 23:22:46
问题 When I decode a video to a surface I want to save the frames i want as bitmap/jpeg files. I don't want to draw on the screen and just want to save the content of the SurfaceTexture as an image file. 回答1: You have to render the texture. If it were a normal texture, and you were using GLES 2 or later, you could attach it to an FBO and read directly from that. A SurfaceTexture is backed by an "external texture", and might be in a format that the GL driver doesn't support a full set of operations

Base64 encoder and decoder

拟墨画扇 提交于 2019-11-26 18:48:15
Is there a base-64 decoder and encoder for a String in Android? Dan D. See android.util.Base64 It seems that this was added in API version 8 or android 2.2 so it will not be available on the older platforms. But the source of it is at android/util/Base64.java so if needed one could just copy it unchanged for older versions. This is an example of how to use the Base64 class to encode and decode a simple String value. // String to be encoded with Base64 String text = "Test"; // Sending side byte[] data = null; try { data = text.getBytes("UTF-8"); } catch (UnsupportedEncodingException e1) { e1

Base64 encoder and decoder

╄→尐↘猪︶ㄣ 提交于 2019-11-26 06:36:26
问题 Is there a base-64 decoder and encoder for a String in Android? 回答1: See android.util.Base64 It seems that this was added in API version 8 or android 2.2 so it will not be available on the older platforms. But the source of it is at android/util/Base64.java so if needed one could just copy it unchanged for older versions. 回答2: This is an example of how to use the Base64 class to encode and decode a simple String value. // String to be encoded with Base64 String text = "Test"; // Sending side