decode

Use (Python) Gstreamer to decode audio (to PCM data)

旧街凉风 提交于 2019-11-27 18:27:59
问题 I'm writing an application that uses the Python Gstreamer bindings to play audio, but I'm now trying to also just decode audio -- that is, I'd like to read data using a decodebin and receive a raw PCM buffer. Specifically, I want to read chunks of the file incrementally rather than reading the whole file into memory. Some specific questions: How can I accomplish this with Gstreamer? With pygst specifically? Is there a particular "sink" element I need to use to read data from the stream? Is

Decoding Base64 Images

故事扮演 提交于 2019-11-27 17:46:04
问题 I have recently found a file on the web, and I really need the original url to it, but it's encoded into Base64. It's an image. The URL Starts with something like this: data:image/png;base64, and then there are loads of numbers and letters. My question is, how can I decode this to its original form? e.g. instead of mwo1fw# to http://etc 回答1: Use this web utility: http://www.motobit.com/util/base64-decoder-encoder.asp Set the output format to binary, then copy-paste the base64 data that

How to decode a QR-code image in (preferably pure) Python?

不羁岁月 提交于 2019-11-27 16:49:25
TL;DR : I need a way to decode a QR-code from an image file using (preferable pure) Python. I've got a jpg file with a QR-code which I want to decode using Python. I've found a couple libraries which claim to do this: PyQRCode ( website here ) which supposedly can decode qr codes from images by simply providing a path like this: import sys, qrcode d = qrcode.Decoder() if d.decode('out.png'): print 'result: ' + d.result else: print 'error: ' + d.error So I simply installed it using sudo pip install pyqrcode . The thing I find strange about the example code above however, is that it only imports

Decode base64_encode Image from JSON in Swift

妖精的绣舞 提交于 2019-11-27 15:52:48
I have a mysql database which contains some images. I receive the data from a php file: php: $result[$key]['image'] = based64_encode($resultArray[$key]['image']); Now with a Json file, I get something like this: Json: {"image":"\/9j\/4Q\/+RXhpZgAATU0AKgAAAAgACgEPAAIAAAAGAAAAhgEQAAIAAAAKAAAAjAESAAMAAAABAAYAAAEaAAUAAAABAAAAlgEbAAUAAAABAAAAngEoAAMAAAABAAIAAE... I have my swift project and want to decode the image into a UIImage, so far I have no idea how to decode the image. I have the following. Swift: Alamofire.request(.GET, url).responseJSON { (response) -> Void in if let JSON = response

How to decode numeric HTML entities in PHP

此生再无相见时 提交于 2019-11-27 13:40:58
I'm trying to decode encoded long dash from numeric entity to string, but it seems that I can't find a function which can do this properly. The best that I found is mb_decode_numericentity(), however, for some reason it fails to decode long dash and some other special characters. $str = '–'; $str = mb_decode_numericentity($str, array(0xFF, 0x2FFFF, 0, 0xFFFF), 'ISO-8859-1'); This will return "?". Anyone knows how to solve this problem? The following code snippet (mostly stolen from here and improved) will work for literal, numeric decimal, and numeric hexa-decimal entities: header("content

Extract part of data from JSON file with python [duplicate]

女生的网名这么多〃 提交于 2019-11-27 12:54:33
问题 This question already has answers here : Access a particular field in arbitrarily nested JSON data [duplicate] (3 answers) Closed last year . I have been trying to extract only certain data from a JSON file. I managed to decode the JSON and get the wanted data into a python dict. When I print out the dict it shows all the wanted data, but when I try to write the dict into a new file, only the last object gets written. One thing that I can't understand is also why when I print the dict I get

JSON stringify missing from jQuery 1.4.1?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 11:59:50
Apparently jQuery has the ability to decode a given object or string into a JSON object. However, I have a JS object that I need to POST back to the server and I find no utility in jQuery that wraps the JSON.stringify() function. That function is found in Chrome, Safari 4, FF3.6, and IE8 but is not found in earlier browsers. I can use it natively in the browsers that support it, but otherwise am forced to fall back to using Crockford's JSON scripts. Is there some built-in with jQuery that handles JSON encoding and decoding that takes the place of the Crockford scripts? You might want to check

Is there a faster way to decode html characters to a string than Html.fromHtml()?

♀尐吖头ヾ 提交于 2019-11-27 11:49:54
I am using Html.fromHtml(STRING).toString() to convert a string that may or may not have html and/or html entities in it, to a plain text string. This is pretty slow, I think my last calculation was that it took about 22ms on avg. With a large batch of these it can add over a minute. So I am looking for a faster, performance built option. Is there anyway to speed this up or are there other decoding options available? Edit: Since there doesn't appear to be a built in method that is faster or built for performance specifically, I will reward the bounty to anyone that can point me in the

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128) [duplicate]

血红的双手。 提交于 2019-11-27 09:05:36
This question already has an answer here: Unicode error Ordinal not in range 1 answer I'm simply trying to decode \uXXXX\uXXXX\uXXXX-like string. But I get an error: $ python Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> print u'\u041e\u043b\u044c\u0433\u0430'.decode('utf-8') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in

ORA-00904 invalid identifier on decode alias

孤街浪徒 提交于 2019-11-27 08:19:58
问题 I am running into the error stated in the Title when I attempt to use the alias of a decode in my select statement. Here is the code: SELECT DISTINCT rl.complaint_date, decode(rl.judgement_date,null,rl.complaint_amt,rl.judgement_amt) as account_amt, rl.date_served1, rl.date_served2, rl.judgement_date, rl.skip_locate, rl.case_no, lcc.bal_range_min, lcc.bal_range_max, lcc.cost_range_min, lcc.cost_range_max, lcc.court, lcc.county AS lcc_county, ah.ACCOUNT, ah.transaction_code, ah.transaction