TTKMusicPlayer
4.1.3.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
|
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "qrencode.h"
#include "qrspec.h"
#include "mqrspec.h"
#include "bitstream.h"
#include "qrinput.h"
#include "rsecc.h"
#include "split.h"
#include "mask.h"
#include "mmask.h"
Go to the source code of this file.
Classes | |
struct | RSblock |
qrencode - QR Code encoder More... | |
struct | QRRawCode |
struct | MQRRawCode |
struct | FrameFiller |
Functions | |
static void | RSblock_initBlock (RSblock *block, int dl, unsigned char *data, int el, unsigned char *ecc) |
static int | RSblock_init (RSblock *blocks, int spec[5], unsigned char *data, unsigned char *ecc) |
STATIC_IN_RELEASE void | QRraw_free (QRRawCode *raw) |
STATIC_IN_RELEASE QRRawCode * | QRraw_new (QRinput *input) |
STATIC_IN_RELEASE unsigned char | QRraw_getCode (QRRawCode *raw) |
Return a code (byte). More... | |
STATIC_IN_RELEASE void | MQRraw_free (MQRRawCode *raw) |
STATIC_IN_RELEASE MQRRawCode * | MQRraw_new (QRinput *input) |
STATIC_IN_RELEASE unsigned char | MQRraw_getCode (MQRRawCode *raw) |
Return a code (byte). More... | |
static void | FrameFiller_set (FrameFiller *filler, int width, unsigned char *frame, int mqr) |
static unsigned char * | FrameFiller_next (FrameFiller *filler) |
STATIC_IN_RELEASE QRcode * | QRcode_new (int version, int width, unsigned char *data) |
void | QRcode_free (QRcode *qrcode) |
Free the instance of QRcode class. More... | |
STATIC_IN_RELEASE QRcode * | QRcode_encodeMask (QRinput *input, int mask) |
STATIC_IN_RELEASE QRcode * | QRcode_encodeMaskMQR (QRinput *input, int mask) |
QRcode * | QRcode_encodeInput (QRinput *input) |
Create a symbol from the input data. More... | |
static QRcode * | QRcode_encodeStringReal (const char *string, int version, QRecLevel level, int mqr, QRencodeMode hint, int casesensitive) |
QRcode * | QRcode_encodeString (const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) |
Create a symbol from the string. More... | |
QRcode * | QRcode_encodeStringMQR (const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) |
Micro QR Code version of QRcode_encodeString(). More... | |
static QRcode * | QRcode_encodeDataReal (const unsigned char *data, int length, int version, QRecLevel level, int mqr) |
QRcode * | QRcode_encodeData (int size, const unsigned char *data, int version, QRecLevel level) |
Encode byte stream (may include '\0') in 8-bit mode. More... | |
QRcode * | QRcode_encodeString8bit (const char *string, int version, QRecLevel level) |
Same to QRcode_encodeString(), but encode whole data in 8-bit mode. More... | |
QRcode * | QRcode_encodeDataMQR (int size, const unsigned char *data, int version, QRecLevel level) |
Micro QR Code version of QRcode_encodeData(). More... | |
QRcode * | QRcode_encodeString8bitMQR (const char *string, int version, QRecLevel level) |
Micro QR Code version of QRcode_encodeString8bit(). More... | |
static QRcode_List * | QRcode_List_newEntry (void) |
static void | QRcode_List_freeEntry (QRcode_List *entry) |
void | QRcode_List_free (QRcode_List *qrlist) |
Free the QRcode_List. More... | |
int | QRcode_List_size (QRcode_List *qrlist) |
Return the number of symbols included in a QRcode_List. More... | |
QRcode_List * | QRcode_encodeInputStructured (QRinput_Struct *s) |
Create structured symbols from the input data. More... | |
static QRcode_List * | QRcode_encodeInputToStructured (QRinput *input) |
static QRcode_List * | QRcode_encodeDataStructuredReal (int size, const unsigned char *data, int version, QRecLevel level, int eightbit, QRencodeMode hint, int casesensitive) |
QRcode_List * | QRcode_encodeDataStructured (int size, const unsigned char *data, int version, QRecLevel level) |
Create structured symbols from byte stream (may include '\0'). More... | |
QRcode_List * | QRcode_encodeString8bitStructured (const char *string, int version, QRecLevel level) |
Same to QRcode_encodeStringStructured(), but encode whole data in 8-bit mode. More... | |
QRcode_List * | QRcode_encodeStringStructured (const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) |
Create structured symbols from the string. More... | |
void | QRcode_APIVersion (int *major_version, int *minor_version, int *micro_version) |
Return a string that identifies the library version. More... | |
char * | QRcode_APIVersionString (void) |
Return a string that identifies the library version. More... | |
void | QRcode_clearCache (void) |
|
static |
Definition at line 296 of file qrencode.c.
References FrameFiller::bit, FrameFiller::dir, FrameFiller::frame, FrameFiller::mqr, FrameFiller::width, FrameFiller::x, and FrameFiller::y.
Referenced by QRcode_encodeMask(), and QRcode_encodeMaskMQR().
|
static |
Definition at line 285 of file qrencode.c.
References FrameFiller::bit, FrameFiller::dir, FrameFiller::frame, FrameFiller::mqr, FrameFiller::width, FrameFiller::x, and FrameFiller::y.
Referenced by QRcode_encodeMask(), and QRcode_encodeMaskMQR().
STATIC_IN_RELEASE void MQRraw_free | ( | MQRRawCode * | raw | ) |
Definition at line 261 of file qrencode.c.
References MQRRawCode::datacode, MQRRawCode::ecccode, free(), and MQRRawCode::rsblock.
Referenced by MQRraw_new(), and QRcode_encodeMaskMQR().
STATIC_IN_RELEASE unsigned char MQRraw_getCode | ( | MQRRawCode * | raw | ) |
Return a code (byte).
This function can be called iteratively.
raw | raw code. |
Definition at line 246 of file qrencode.c.
References MQRRawCode::count, MQRRawCode::datacode, MQRRawCode::dataLength, MQRRawCode::ecccode, and MQRRawCode::eccLength.
Referenced by QRcode_encodeMaskMQR().
STATIC_IN_RELEASE MQRRawCode* MQRraw_new | ( | QRinput * | input | ) |
Definition at line 204 of file qrencode.c.
References calloc(), MQRRawCode::count, MQRRawCode::datacode, MQRRawCode::dataLength, MQRRawCode::ecccode, MQRRawCode::eccLength, free(), _QRinput::level, malloc(), MQRraw_free(), MQRspec_getDataLength(), MQRspec_getDataLengthBit(), MQRspec_getECCLength(), MQRRawCode::oddbits, QRinput_getByteStream(), MQRRawCode::rsblock, RSblock_initBlock(), _QRinput::version, and MQRRawCode::version.
Referenced by QRcode_encodeMaskMQR().
Return a string that identifies the library version.
major_version | major version number |
minor_version | minor version number |
micro_version | micro version number |
Definition at line 915 of file qrencode.c.
References MAJOR_VERSION, MICRO_VERSION, and MINOR_VERSION.
char* QRcode_APIVersionString | ( | void | ) |
Return a string that identifies the library version.
Definition at line 928 of file qrencode.c.
References VERSION.
void QRcode_clearCache | ( | void | ) |
Definition at line 933 of file qrencode.c.
Encode byte stream (may include '\0') in 8-bit mode.
size | size of the input data. |
data | input data. |
version | version of the symbol. If 0, the library chooses the minimum version for the given input data. |
level | error correction level. |
EINVAL | invalid input object. |
ENOMEM | unable to allocate memory for input objects. |
ERANGE | input data is too large. |
Definition at line 696 of file qrencode.c.
References QRcode_encodeDataReal().
Micro QR Code version of QRcode_encodeData().
Definition at line 710 of file qrencode.c.
References MQRSPEC_VERSION_MAX, and QRcode_encodeDataReal().
|
static |
Definition at line 667 of file qrencode.c.
References QR_MODE_8, QRcode_encodeInput(), QRinput_append(), QRinput_free(), QRinput_new2(), and QRinput_newMQR().
Referenced by QRcode_encodeData(), QRcode_encodeDataMQR(), QRcode_encodeString8bit(), and QRcode_encodeString8bitMQR().
QRcode_List* QRcode_encodeDataStructured | ( | int | size, |
const unsigned char * | data, | ||
int | version, | ||
QRecLevel | level | ||
) |
Create structured symbols from byte stream (may include '\0').
Wholde data are encoded in 8-bit mode.
size | size of the input data. |
data | input dat. |
version | version of the symbol. |
level | error correction level. |
EINVAL | invalid input object. |
ENOMEM | unable to allocate memory for input objects. |
Definition at line 890 of file qrencode.c.
References QR_MODE_NUL, and QRcode_encodeDataStructuredReal().
Referenced by QRcode_encodeString8bitStructured().
|
static |
Definition at line 854 of file qrencode.c.
References QR_MODE_8, QR_MODE_KANJI, QRcode_encodeInputToStructured(), QRinput_append(), QRinput_free(), QRinput_new2(), and Split_splitStringToQRinput().
Referenced by QRcode_encodeDataStructured(), and QRcode_encodeStringStructured().
Create a symbol from the input data.
input | input data. |
EINVAL | invalid input object. |
ENOMEM | unable to allocate memory for input objects. |
Definition at line 605 of file qrencode.c.
References _QRinput::mqr, QRcode_encodeMask(), and QRcode_encodeMaskMQR().
Referenced by QRcode_encodeDataReal(), QRcode_encodeInputStructured(), and QRcode_encodeStringReal().
QRcode_List* QRcode_encodeInputStructured | ( | QRinput_Struct * | s | ) |
Create structured symbols from the input data.
s | input data, structured. |
Definition at line 808 of file qrencode.c.
References _QRcode_List::code, _QRinput_Struct::head, _QRinput_InputList::input, _QRinput_InputList::next, _QRcode_List::next, QRcode_encodeInput(), QRcode_List_free(), and QRcode_List_newEntry().
Referenced by QRcode_encodeInputToStructured().
|
static |
Definition at line 840 of file qrencode.c.
References QRcode_encodeInputStructured(), QRinput_splitQRinputToStruct(), and QRinput_Struct_free().
Referenced by QRcode_encodeDataStructuredReal().
STATIC_IN_RELEASE QRcode* QRcode_encodeMask | ( | QRinput * | input, |
int | mask | ||
) |
Definition at line 429 of file qrencode.c.
References QRRawCode::dataLength, QRRawCode::eccLength, FrameFiller_next(), FrameFiller_set(), free(), _QRinput::level, malloc(), Mask_makeMask(), Mask_mask(), _QRinput::mqr, QR_ECLEVEL_H, QR_ECLEVEL_L, QRcode_new(), QRraw_free(), QRraw_getCode(), QRraw_new(), QRspec_getRemainder(), QRspec_getWidth(), QRspec_newFrame(), QRSPEC_VERSION_MAX, _QRinput::version, and QRRawCode::version.
Referenced by QRcode_encodeInput().
STATIC_IN_RELEASE QRcode* QRcode_encodeMaskMQR | ( | QRinput * | input, |
int | mask | ||
) |
Definition at line 517 of file qrencode.c.
References MQRRawCode::dataLength, MQRRawCode::eccLength, FrameFiller_next(), FrameFiller_set(), free(), _QRinput::level, malloc(), MMask_makeMask(), MMask_mask(), _QRinput::mqr, MQRraw_free(), MQRraw_getCode(), MQRraw_new(), MQRspec_getWidth(), MQRspec_newFrame(), MQRSPEC_VERSION_MAX, MQRRawCode::oddbits, QR_ECLEVEL_L, QR_ECLEVEL_Q, QRcode_new(), _QRinput::version, and MQRRawCode::version.
Referenced by QRcode_encodeInput().
QRcode* QRcode_encodeString | ( | const char * | string, |
int | version, | ||
QRecLevel | level, | ||
QRencodeMode | hint, | ||
int | casesensitive | ||
) |
Create a symbol from the string.
The library automatically parses the input string and encodes in a QR Code symbol.
string | input string. It must be NUL terminated. |
version | version of the symbol. If 0, the library chooses the minimum version for the given input data. |
level | error correction level. |
hint | tell the library how Japanese Kanji characters should be encoded. If QR_MODE_KANJI is given, the library assumes that the given string contains Shift-JIS characters and encodes them in Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical characters will be encoded as is. If you want to embed UTF-8 string, choose this. Other mode will cause EINVAL error. |
casesensitive | case-sensitive(1) or not(0). |
EINVAL | invalid input object. |
ENOMEM | unable to allocate memory for input objects. |
ERANGE | input data is too large. |
Definition at line 647 of file qrencode.c.
References QRcode_encodeStringReal().
Referenced by QRCodeQWidget::paintEvent().
Same to QRcode_encodeString(), but encode whole data in 8-bit mode.
Definition at line 701 of file qrencode.c.
References QRcode_encodeDataReal().
Micro QR Code version of QRcode_encodeString8bit().
Definition at line 725 of file qrencode.c.
References MQRSPEC_VERSION_MAX, and QRcode_encodeDataReal().
QRcode_List* QRcode_encodeString8bitStructured | ( | const char * | string, |
int | version, | ||
QRecLevel | level | ||
) |
Same to QRcode_encodeStringStructured(), but encode whole data in 8-bit mode.
Definition at line 894 of file qrencode.c.
References QRcode_encodeDataStructured().
QRcode* QRcode_encodeStringMQR | ( | const char * | string, |
int | version, | ||
QRecLevel | level, | ||
QRencodeMode | hint, | ||
int | casesensitive | ||
) |
Micro QR Code version of QRcode_encodeString().
Definition at line 652 of file qrencode.c.
References MQRSPEC_VERSION_MAX, and QRcode_encodeStringReal().
|
static |
Definition at line 614 of file qrencode.c.
References QR_MODE_8, QR_MODE_KANJI, QRcode_encodeInput(), QRinput_free(), QRinput_new2(), QRinput_newMQR(), and Split_splitStringToQRinput().
Referenced by QRcode_encodeString(), and QRcode_encodeStringMQR().
QRcode_List* QRcode_encodeStringStructured | ( | const char * | string, |
int | version, | ||
QRecLevel | level, | ||
QRencodeMode | hint, | ||
int | casesensitive | ||
) |
Create structured symbols from the string.
The library automatically parses the input string and encodes in a QR Code symbol.
string | input string. It must be NUL terminated. |
version | version of the symbol. |
level | error correction level. |
hint | tell the library how Japanese Kanji characters should be encoded. If QR_MODE_KANJI is given, the library assumes that the given string contains Shift-JIS characters and encodes them in Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical characters will be encoded as is. If you want to embed UTF-8 string, choose this. Other mode will cause EINVAL error. |
casesensitive | case-sensitive(1) or not(0). |
EINVAL | invalid input object. |
ENOMEM | unable to allocate memory for input objects. |
Definition at line 902 of file qrencode.c.
References QRcode_encodeDataStructuredReal().
void QRcode_free | ( | QRcode * | qrcode | ) |
Free the instance of QRcode class.
qrcode | an instance of QRcode class. |
Definition at line 421 of file qrencode.c.
References QRcode::data, and free().
Referenced by QRCodeQWidget::paintEvent(), and QRcode_List_freeEntry().
void QRcode_List_free | ( | QRcode_List * | qrlist | ) |
Free the QRcode_List.
qrlist | a head entry of a QRcode_List. |
Definition at line 770 of file qrencode.c.
References _QRcode_List::next, and QRcode_List_freeEntry().
Referenced by QRcode_encodeInputStructured().
|
static |
Definition at line 762 of file qrencode.c.
References _QRcode_List::code, free(), and QRcode_free().
Referenced by QRcode_List_free().
|
static |
Definition at line 749 of file qrencode.c.
References _QRcode_List::code, malloc(), and _QRcode_List::next.
Referenced by QRcode_encodeInputStructured().
int QRcode_List_size | ( | QRcode_List * | qrlist | ) |
Return the number of symbols included in a QRcode_List.
qrlist | a head entry of a QRcode_List. |
Definition at line 781 of file qrencode.c.
References _QRcode_List::next.
STATIC_IN_RELEASE QRcode* QRcode_new | ( | int | version, |
int | width, | ||
unsigned char * | data | ||
) |
Definition at line 407 of file qrencode.c.
References QRcode::data, malloc(), QRcode::version, and QRcode::width.
Referenced by QRcode_encodeMask(), and QRcode_encodeMaskMQR().
STATIC_IN_RELEASE void QRraw_free | ( | QRRawCode * | raw | ) |
Definition at line 178 of file qrencode.c.
References QRRawCode::datacode, QRRawCode::ecccode, free(), and QRRawCode::rsblock.
Referenced by QRcode_encodeMask(), and QRraw_new().
STATIC_IN_RELEASE unsigned char QRraw_getCode | ( | QRRawCode * | raw | ) |
Return a code (byte).
This function can be called iteratively.
raw | raw code. |
Definition at line 155 of file qrencode.c.
References QRRawCode::b1, QRRawCode::blocks, QRRawCode::count, RSblock::data, RSblock::dataLength, QRRawCode::dataLength, RSblock::ecc, QRRawCode::eccLength, and QRRawCode::rsblock.
Referenced by QRcode_encodeMask().
STATIC_IN_RELEASE QRRawCode* QRraw_new | ( | QRinput * | input | ) |
Definition at line 105 of file qrencode.c.
References QRRawCode::b1, QRRawCode::blocks, calloc(), QRRawCode::count, QRRawCode::datacode, QRRawCode::dataLength, QRRawCode::ecccode, QRRawCode::eccLength, free(), _QRinput::level, malloc(), QRinput_getByteStream(), QRraw_free(), QRspec_getEccSpec(), QRspec_rsBlockNum, QRspec_rsBlockNum1, QRspec_rsDataLength, QRspec_rsEccLength, QRRawCode::rsblock, RSblock_init(), _QRinput::version, and QRRawCode::version.
Referenced by QRcode_encodeMask().
|
static |
Definition at line 70 of file qrencode.c.
References QRspec_rsBlockNum1, QRspec_rsBlockNum2, QRspec_rsDataCodes1, QRspec_rsDataCodes2, QRspec_rsEccCodes1, QRspec_rsEccCodes2, and RSblock_initBlock().
Referenced by QRraw_new().
|
static |
Definition at line 60 of file qrencode.c.
References RSblock::data, RSblock::dataLength, RSblock::ecc, RSblock::eccLength, and RSECC_encode().
Referenced by MQRraw_new(), and RSblock_init().