From 9d88c10ca434dacdee0e98a2d33e7898be2dd223 Mon Sep 17 00:00:00 2001 From: BtbN Date: Fri, 9 May 2014 17:05:19 +0200 Subject: [PATCH 1/4] Fix multi-char constant warnings --- libobs/media-io/video-fourcc.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/libobs/media-io/video-fourcc.c b/libobs/media-io/video-fourcc.c index 30460df41..a1c0e42f3 100644 --- a/libobs/media-io/video-fourcc.c +++ b/libobs/media-io/video-fourcc.c @@ -18,28 +18,31 @@ #include "../util/c99defs.h" #include "video-io.h" +#define MAKE_FOURCC(a, b, c, d) \ + ((uint32_t)(((d) << 24) | ((c) << 16) | ((b) << 8) | (a))) + enum video_format video_format_from_fourcc(uint32_t fourcc) { switch (fourcc) { - case 'UYVY': - case 'HDYC': - case 'UYNV': - case 'UYNY': - case 'uyv1': - case '2vuy': - case '2Vuy': + case MAKE_FOURCC('U','Y','V','Y'): + case MAKE_FOURCC('H','D','Y','C'): + case MAKE_FOURCC('U','Y','N','V'): + case MAKE_FOURCC('U','Y','N','Y'): + case MAKE_FOURCC('u','y','v','1'): + case MAKE_FOURCC('2','v','u','y'): + case MAKE_FOURCC('2','V','u','y'): return VIDEO_FORMAT_UYVY; - case 'YUY2': - case 'Y422': - case 'V422': - case 'VYUY': - case 'YUNV': - case 'yuv2': - case 'yuvs': + case MAKE_FOURCC('Y','U','Y','2'): + case MAKE_FOURCC('Y','4','2','2'): + case MAKE_FOURCC('V','4','2','2'): + case MAKE_FOURCC('V','Y','U','Y'): + case MAKE_FOURCC('Y','U','N','V'): + case MAKE_FOURCC('y','u','v','2'): + case MAKE_FOURCC('y','u','v','s'): return VIDEO_FORMAT_YUY2; - case 'YVYU': + case MAKE_FOURCC('Y','V','Y','U'): return VIDEO_FORMAT_YVYU; } From 0236d4fb09f8332153224663596cbc37f56108d1 Mon Sep 17 00:00:00 2001 From: BtbN Date: Fri, 9 May 2014 17:10:28 +0200 Subject: [PATCH 2/4] Fix obs_data_item_set for number types --- libobs/obs-data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libobs/obs-data.c b/libobs/obs-data.c index b00ad885f..eec14d8eb 100644 --- a/libobs/obs-data.c +++ b/libobs/obs-data.c @@ -865,7 +865,7 @@ void obs_data_item_setint(obs_data_item_t *item, long long val) struct obs_data_number num; num.type = OBS_DATA_NUM_INT; num.int_val = val; - obs_data_item_setdata(item, &val, sizeof(struct obs_data_number), + obs_data_item_setdata(item, &num, sizeof(struct obs_data_number), OBS_DATA_NUMBER); } @@ -874,7 +874,7 @@ void obs_data_item_setdouble(obs_data_item_t *item, double val) struct obs_data_number num; num.type = OBS_DATA_NUM_DOUBLE; num.double_val = val; - obs_data_item_setdata(item, &val, sizeof(struct obs_data_number), + obs_data_item_setdata(item, &num, sizeof(struct obs_data_number), OBS_DATA_NUMBER); } From e958bc16e4390f0d9b2b8fcbcd6d012ce763d545 Mon Sep 17 00:00:00 2001 From: BtbN Date: Sat, 10 May 2014 03:40:05 +0200 Subject: [PATCH 3/4] Move static to front of declaration, as required by c99 --- libobs/media-io/video-matrices.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libobs/media-io/video-matrices.c b/libobs/media-io/video-matrices.c index 648be243e..5bef1aecf 100644 --- a/libobs/media-io/video-matrices.c +++ b/libobs/media-io/video-matrices.c @@ -24,7 +24,7 @@ #include "../graphics/matrix3.h" #endif -struct { +static struct { enum video_colorspace const color_space; float const Kb, Kr; int const range_min[3]; @@ -35,7 +35,7 @@ struct { float float_range_max[3]; float matrix[2][16]; -} static format_info[] = { +} format_info[] = { {VIDEO_CS_601, 0.114f, 0.299f, {16, 16, 16}, {235, 240, 240}, {{16, 128, 128}, {0, 128, 128}}, From b3adef6c8d5587c55ee430f6327c9c3bbdd98cbe Mon Sep 17 00:00:00 2001 From: BtbN Date: Fri, 9 May 2014 17:19:05 +0200 Subject: [PATCH 4/4] Fix all warnings in rtmp output --- plugins/obs-outputs/librtmp/parseurl.c | 4 ++-- plugins/obs-outputs/librtmp/rtmp.c | 8 ++++---- plugins/obs-outputs/rtmp-stream.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/obs-outputs/librtmp/parseurl.c b/plugins/obs-outputs/librtmp/parseurl.c index 2088ee063..477fd77fa 100644 --- a/plugins/obs-outputs/librtmp/parseurl.c +++ b/plugins/obs-outputs/librtmp/parseurl.c @@ -198,7 +198,7 @@ parsehost: int RTMP_ParseURL2(const char *url, int *protocol, AVal *host, unsigned int *port, AVal *app) { - char *p, *end, *col, *ques, *slash; + char *p, *end, *col, /* *ques, */ *slash; RTMP_Log(RTMP_LOGDEBUG, "Parsing..."); @@ -255,7 +255,7 @@ parsehost: end = p + strlen(p); col = strchr(p, ':'); - ques = strchr(p, '?'); + // ques = strchr(p, '?'); slash = strchr(p, '/'); { diff --git a/plugins/obs-outputs/librtmp/rtmp.c b/plugins/obs-outputs/librtmp/rtmp.c index c153c6e64..7fc6d50f2 100644 --- a/plugins/obs-outputs/librtmp/rtmp.c +++ b/plugins/obs-outputs/librtmp/rtmp.c @@ -3923,7 +3923,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet) uint8_t hbuf[RTMP_MAX_HEADER_SIZE] = { 0 }; char *header = (char *)hbuf; int nSize, hSize, nToRead, nChunk; - int didAlloc = FALSE; + // int didAlloc = FALSE; RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket); @@ -4050,7 +4050,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet) RTMP_Log(RTMP_LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__); return FALSE; } - didAlloc = TRUE; + // didAlloc = TRUE; packet->m_headerType = (hbuf[0] & 0xc0) >> 6; } @@ -5339,8 +5339,8 @@ stopKeyframeSearch: if (recopy) { - len = (unsigned int)(ret) > buflen ? buflen : ret; - memcpy(buf, r->m_read.buf, len); + len = (unsigned int)(ret) > buflen ? buflen : (unsigned int)ret; + memcpy(buf, r->m_read.buf, len); r->m_read.bufpos = r->m_read.buf + len; r->m_read.buflen = ret - len; } diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index 735533ff6..b57261909 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "librtmp/rtmp.h" #include "librtmp/log.h" #include "flv-mux.h" @@ -505,7 +506,7 @@ static void check_to_drop_frames(struct rtmp_stream *stream) buffer_duration_usec = stream->last_dts_usec - first.dts_usec; if (buffer_duration_usec > stream->drop_threshold_usec) { drop_frames(stream); - blog(LOG_INFO, "dropping %lld worth of frames", + blog(LOG_INFO, "dropping %" PRId64 " worth of frames", buffer_duration_usec); } }