no message

master
a7458969 2020-05-14 01:06:27 +08:00
parent 5a40ac88a4
commit 19f08e982e
7 changed files with 194 additions and 12 deletions

View File

@ -1,5 +1,5 @@
const BYTE Base64IdxTab[128] =
const unsigned char Base64IdxTab[128] =
{
255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255,
255,255,255,255, 255,255,255,255, 255,255,255,255, 255,255,255,255,
@ -15,11 +15,11 @@ const BYTE Base64IdxTab[128] =
int DecodeBase64(char * pInput, char * pOutput);
const BYTE Base64ValTab[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const char Base64ValTab[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
#define AVal(x) Base64ValTab[x]
int EncodeBase64(BYTE * pInput, int iInputLen, BYTE * pOutput);
int EncodeBase64(unsigned char * pInput, int iInputLen, unsigned char * pOutput);
#define DCD_ONCE_LEN 400*1024
#define CDC_ONCE_LEN 300*1024
#define CDC_ONCE_LEN 300*1024

View File

@ -3,9 +3,3 @@
#include <memory>
using namespace std;
string GetGUID();
std::wstring s2ws(const std::string& s);
string WideCharToMultiChar(wstring str);
string Utf8ToAnsi(const char *UTF8);
wstring char2wchar(const char* cchar);

View File

@ -64,7 +64,7 @@ vector<AudioPlayer::SpeakerInfo> AudioPlayer::EnumSpeakers()
const PaDeviceInfo *deviceInfo = Pa_GetDeviceInfo(i);
if(nullptr != deviceInfo)
if (deviceInfo->maxOutputChannels > 0) {
ins.name = char2wchar(deviceInfo->name);
//ins.name = char2wchar(deviceInfo->name);
ret.push_back(ins);
}
}

View File

@ -0,0 +1,121 @@
#include "Base64.h"
#include "stdio.h"
#include "string.h"
int DecodeBase64(char * pInput, char * pOutput)
{
int i = 0;
int iCnt = 0;
int iSrcLen = (int)strlen(pInput);
char * p = pOutput;
for (i=0; i<iSrcLen; i++)
{
if (pInput[i] > 127) continue;
if (pInput[i] == '=') return p-pOutput+1;
char a = BVal(pInput[i]);
if (a == 255) continue;
switch (iCnt)
{
case 0:
{
*p = a << 2;
iCnt++;
}
break;
case 1:
{
*p++ |= a >> 4;
*p = a << 4;
iCnt++;
}
break;
case 2:
{
*p++ |= a >> 2;
*p = a << 6;
iCnt++;
}
break;
case 3:
{
*p++ |= a;
iCnt = 0;
}
break;
}
}
*p = 0x00;
return p-pOutput;
}
int EncodeBase64(char * pInput,int iInputLen,char * pOutput)
{
int i = 0;
int loop = 0;
int remain = 0;
int iDstLen = 0;
int iSrcLen = iInputLen;
loop = iSrcLen/3;
remain = iSrcLen%3;
// also can encode native char one by one as decode method
// but because all of char in native string is to be encoded so encode 3-chars one time is easier.
for (i=0; i<loop; i++)
{
char a1 = (pInput[i*3] >> 2);
char a2 = ( ((pInput[i*3] & 0x03) << 4) | (pInput[i*3+1] >> 4) );
char a3 = ( ((pInput[i*3+1] & 0x0F) << 2) | ((pInput[i*3+2] & 0xC0) >> 6) );
char a4 = (pInput[i*3+2] & 0x3F);
pOutput[i*4] = AVal(a1);
pOutput[i*4+1] = AVal(a2);
pOutput[i*4+2] = AVal(a3);
pOutput[i*4+3] = AVal(a4);
}
iDstLen = i*4;
if (remain == 1)
{
// should pad two equal sign
i = iSrcLen-1;
char a1 = (pInput[i] >> 2);
char a2 = ((pInput[i] & 0x03) << 4);
pOutput[iDstLen++] = AVal(a1);
pOutput[iDstLen++] = AVal(a2);
pOutput[iDstLen++] = '=';
pOutput[iDstLen++] = '=';
pOutput[iDstLen] = 0x00;
}
else if (remain == 2)
{
// should pad one equal sign
i = iSrcLen-2;
char a1 = (pInput[i] >> 2);
char a2 = ( ((pInput[i] & 0x03) << 4) | (pInput[i+1] >> 4));
char a3 = ( (pInput[i+1] & 0x0F) << 2);
pOutput[iDstLen++] = AVal(a1);
pOutput[iDstLen++] = AVal(a2);
pOutput[iDstLen++] = AVal(a3);
pOutput[iDstLen++] = '=';
pOutput[iDstLen] = 0x00;
}
else
{
// just division by 3
pOutput[iDstLen] = 0x00;
}
return iDstLen;
}

View File

@ -0,0 +1,25 @@
#include "Debuger.h"
Debuger::Debuger()
{
}
Debuger::~Debuger()
{
}
int Debuger::Debug(wstring log)
{
return 0;
}
int Debuger::Debug(string log)
{
return 0;
}
int Debuger::Debug(const wchar_t *format, ...) {
return 0;
}

View File

@ -0,0 +1,17 @@
#include "utils.h"
wstring char2wchar(const char* cchar)
{
/*
wchar_t m_wchar[2000];
int len = MultiByteToWideChar(CP_ACP, 0, cchar, strlen(cchar), NULL, 0);
if (len > 0)
{
MultiByteToWideChar(CP_ACP, 0, cchar, strlen(cchar), m_wchar, len);
m_wchar[len] = L'\0';
return std::wstring(m_wchar);
}*/
return wstring(L"");
}

View File

@ -37,7 +37,12 @@ SOURCES += \
media/ImageUtil.cpp \
media/SdlPlayer.cpp \
media/VideoCoder.cpp \
media/sps_decode.cpp
media/sps_decode.cpp \
utils/Base64.cpp \
utils/Debuger.cpp \
utils/utils.cpp
CXXFLAGS += -std=c++0x
HEADERS += \
mainwindow.h \
@ -47,6 +52,26 @@ HEADERS += \
FORMS += \
mainwindow.ui
INCLUDEPATH += media/ third/ffmpeg/include/ inc/ third/
message($$PWD/third/libs/)
LIBS += -L$$PWD/third/libs/
LIBS += -lm
win32: LIBS += -llibavcodec
win32: LIBS += -llibrtmp
win32: LIBS += -llibswscale
win32: LIBS += -llibavresample
win32: LIBS += -llibavformat
win32: LIBS += -llibavdevice
win32: LIBS += -llibavfilter
win32: LIBS += -lSecur32
win32: LIBS += -llibavutil
win32: LIBS += -lSDL2
win32: LIBS += -lSDL2main
win32: LIBS += -lportaudio_x86
win32: LIBS += -llibx264
win32: LIBS += -lOle32
win32: LIBS += -lOleAut32
win32: LIBS += $$PWD/third/libs/chkstk.obj
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin