修复编译警告

This commit is contained in:
xia-chu 2024-07-21 19:31:17 +08:00
parent 6583e2869a
commit 9463d1291d
9 changed files with 20 additions and 20 deletions

View File

@ -27,17 +27,17 @@ extern "C" {
#define MK_FRAME_FLAG_NOT_DECODE_ABLE (1 << 3) #define MK_FRAME_FLAG_NOT_DECODE_ABLE (1 << 3)
//codec id常量定义 //codec id常量定义
API_EXPORT extern const int MKCodecH264; extern const int MKCodecH264;
API_EXPORT extern const int MKCodecH265; extern const int MKCodecH265;
API_EXPORT extern const int MKCodecAAC; extern const int MKCodecAAC;
API_EXPORT extern const int MKCodecG711A; extern const int MKCodecG711A;
API_EXPORT extern const int MKCodecG711U; extern const int MKCodecG711U;
API_EXPORT extern const int MKCodecOpus; extern const int MKCodecOpus;
API_EXPORT extern const int MKCodecL16; extern const int MKCodecL16;
API_EXPORT extern const int MKCodecVP8; extern const int MKCodecVP8;
API_EXPORT extern const int MKCodecVP9; extern const int MKCodecVP9;
API_EXPORT extern const int MKCodecAV1; extern const int MKCodecAV1;
API_EXPORT extern const int MKCodecJPEG; extern const int MKCodecJPEG;
typedef struct mk_frame_t *mk_frame; typedef struct mk_frame_t *mk_frame;

View File

@ -15,7 +15,7 @@
using namespace mediakit; using namespace mediakit;
extern "C" { extern "C" {
#define XX(name, type, value, str, mpeg_id, mp4_id) API_EXPORT const int MK##name = value; #define XX(name, type, value, str, mpeg_id, mp4_id) const int MK##name = value;
CODEC_MAP(XX) CODEC_MAP(XX)
#undef XX #undef XX
} }

View File

@ -86,7 +86,7 @@ bool AACRtpDecoder::inputRtp(const RtpPacket::Ptr &rtp, bool key_pos) {
} }
// 每个audio unit时间戳增量 // 每个audio unit时间戳增量
auto dts_inc = (stamp - _last_dts) / au_header_count; auto dts_inc = static_cast<int64_t>(stamp - _last_dts) / au_header_count;
if (dts_inc < 0 || dts_inc > 100) { if (dts_inc < 0 || dts_inc > 100) {
// 时间戳增量异常,忽略 // 时间戳增量异常,忽略
dts_inc = 0; dts_inc = 0;

View File

@ -598,7 +598,7 @@ void JPEGRtpEncoder::rtpSendJpeg(const uint8_t *buf, int size, uint64_t pts, uin
{ {
const uint8_t *qtables[4] = { NULL }; const uint8_t *qtables[4] = { NULL };
int nb_qtables = 0; int nb_qtables = 0;
uint8_t w, h; uint8_t w { 0 }, h { 0 };
uint8_t *p; uint8_t *p;
int off = 0; /* fragment offset of the current JPEG frame */ int off = 0; /* fragment offset of the current JPEG frame */
int len; int len;

View File

@ -129,12 +129,12 @@ private:
void setTranslationInfo(); void setTranslationInfo();
private: private:
ProtocolOption _option;
int _retry_count; int _retry_count;
int _reconnect_delay_min; int _reconnect_delay_min;
int _reconnect_delay_max; int _reconnect_delay_max;
int _reconnect_delay_step; int _reconnect_delay_step;
MediaTuple _tuple; MediaTuple _tuple;
ProtocolOption _option;
std::string _pull_url; std::string _pull_url;
toolkit::Timer::Ptr _timer; toolkit::Timer::Ptr _timer;
std::function<void()> _on_disconnect; std::function<void()> _on_disconnect;

View File

@ -41,7 +41,7 @@ private:
class RtpCachePS : public RtpCache, public PSEncoderImp { class RtpCachePS : public RtpCache, public PSEncoderImp {
public: public:
RtpCachePS(onFlushed cb, uint32_t ssrc, uint8_t payload_type = 96, bool ps_or_ts = true) : RtpCachePS(onFlushed cb, uint32_t ssrc, uint8_t payload_type = 96, bool ps_or_ts = true) :
RtpCache(std::move(cb)), PSEncoderImp(ssrc, ps_or_ts ? payload_type : Rtsp::PT_MP2T, ps_or_ts) {}; RtpCache(std::move(cb)), PSEncoderImp(ssrc, ps_or_ts ? payload_type : static_cast<int>(Rtsp::PT_MP2T), ps_or_ts) {};
void flush() override; void flush() override;

View File

@ -223,8 +223,8 @@ int main(int argc, char *argv[]) {
option.enable_hls = false; option.enable_hls = false;
option.enable_mp4 = false; option.enable_mp4 = false;
option.modify_stamp = (int)ProtocolOption::kModifyStampRelative; option.modify_stamp = (int)ProtocolOption::kModifyStampRelative;
//添加拉流代理 //添加拉流代理
auto tuple = MediaTuple{DEFAULT_VHOST, "app", std::to_string(i)}; auto tuple = MediaTuple { DEFAULT_VHOST, "app", std::to_string(i), "" };
auto proxy = std::make_shared<PlayerProxy>(tuple, option, -1, nullptr, 1); auto proxy = std::make_shared<PlayerProxy>(tuple, option, -1, nullptr, 1);
//开始拉流代理 //开始拉流代理
proxy->play(input_urls[i]); proxy->play(input_urls[i]);

View File

@ -148,7 +148,7 @@ int main(int argc, char *argv[]) {
MediaSource::Ptr src = nullptr; MediaSource::Ptr src = nullptr;
PlayerProxy::Ptr proxy = nullptr;; PlayerProxy::Ptr proxy = nullptr;;
auto tuple = MediaTuple{DEFAULT_VHOST, app, stream}; auto tuple = MediaTuple { DEFAULT_VHOST, app, stream, "" };
if (end_with(in_url, ".mp4")) { if (end_with(in_url, ".mp4")) {
// create MediaSource from mp4file // create MediaSource from mp4file
auto reader = std::make_shared<MP4Reader>(tuple, in_url); auto reader = std::make_shared<MP4Reader>(tuple, in_url);

View File

@ -75,7 +75,7 @@ static bool loadFile(const char *path, const EventPoller::Ptr &poller) {
return 0; return 0;
} }
auto diff = stamp - stamp_last; auto diff = static_cast<int64_t>(stamp - stamp_last);
if (diff < 0 || diff > 500) { if (diff < 0 || diff > 500) {
diff = 1; diff = 1;
} }