111 lines
2.7 KiB
C++
111 lines
2.7 KiB
C++
/***************************************************************************************
|
|
*
|
|
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
*
|
|
* By downloading, copying, installing or using the software you agree to this license.
|
|
* If you do not agree to this license, do not download, install,
|
|
* copy or use the software.
|
|
*
|
|
* Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved.
|
|
*
|
|
* Redistribution and use in binary forms, with or without modification, are permitted.
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software distributed
|
|
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
|
* language governing permissions and limitations under the License.
|
|
*
|
|
****************************************************************************************/
|
|
|
|
#include "sys_inc.h"
|
|
#include "MediaClient.h"
|
|
#include "rtsp_cln.h"
|
|
#include "http.h"
|
|
#include "http_parse.h"
|
|
#include "utils.h"
|
|
#include "VideoWidget.h"
|
|
#include <QLocale>
|
|
#include <QApplication>
|
|
#include <QFontDatabase>
|
|
#include <QTranslator>
|
|
#if defined(ANDROID)
|
|
#include <QJniEnvironment>
|
|
extern "C" {
|
|
#include <libavcodec/jni.h>
|
|
}
|
|
#endif
|
|
|
|
/**************************************************************************************/
|
|
|
|
static void av_log_callback(void* ptr, int level, const char* fmt, va_list vl)
|
|
{
|
|
int htlv = HT_LOG_INFO;
|
|
char buff[4096];
|
|
|
|
if (av_log_get_level() < level)
|
|
{
|
|
return;
|
|
}
|
|
|
|
vsnprintf(buff, sizeof(buff), fmt, vl);
|
|
|
|
if (AV_LOG_TRACE == level || AV_LOG_VERBOSE == level)
|
|
{
|
|
htlv = HT_LOG_TRC;
|
|
}
|
|
else if (AV_LOG_DEBUG == level)
|
|
{
|
|
htlv = HT_LOG_DBG;
|
|
}
|
|
else if (AV_LOG_INFO == level)
|
|
{
|
|
htlv = HT_LOG_INFO;
|
|
}
|
|
else if (AV_LOG_WARNING == level)
|
|
{
|
|
htlv = HT_LOG_WARN;
|
|
}
|
|
else if (AV_LOG_ERROR == level)
|
|
{
|
|
htlv = HT_LOG_ERR;
|
|
}
|
|
else if (AV_LOG_FATAL == level || AV_LOG_PANIC == level)
|
|
{
|
|
htlv = HT_LOG_FATAL;
|
|
}
|
|
|
|
log_print(htlv, "%s", buff);
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
QCoreApplication::setApplicationName("MediaClient");
|
|
QCoreApplication::setOrganizationName("happytimesoft");
|
|
|
|
signal(SIGPIPE, SIG_IGN);
|
|
|
|
av_log_set_callback(av_log_callback);
|
|
av_log_set_level(AV_LOG_QUIET);
|
|
|
|
#if defined(ANDROID)
|
|
av_jni_set_java_vm(QJniEnvironment::javaVM(), NULL);
|
|
#endif
|
|
|
|
sys_buf_init(100);
|
|
rtsp_parse_buf_init(100);
|
|
http_msg_buf_init(16);
|
|
|
|
MediaClient w;
|
|
|
|
w.showMaximized();
|
|
|
|
return a.exec();
|
|
}
|
|
|
|
|
|
|