yolobs-studio/plugins/obs-outputs/rtmp-helpers.h

56 lines
1.7 KiB
C
Raw Permalink Normal View History

2016-02-23 23:16:51 +00:00
/******************************************************************************
Copyright (C) 2014 by Hugh Bailey <obs.jim@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#pragma once
#include "librtmp/rtmp.h"
static inline AVal *flv_str(AVal *out, const char *str)
{
2019-09-22 21:19:10 +00:00
out->av_val = (char *)str;
2016-02-23 23:16:51 +00:00
out->av_len = (int)strlen(str);
return out;
}
static inline void enc_num_val(char **enc, char *end, const char *name,
2019-09-22 21:19:10 +00:00
double val)
2016-02-23 23:16:51 +00:00
{
AVal s;
*enc = AMF_EncodeNamedNumber(*enc, end, flv_str(&s, name), val);
}
static inline void enc_bool_val(char **enc, char *end, const char *name,
2019-09-22 21:19:10 +00:00
bool val)
2016-02-23 23:16:51 +00:00
{
AVal s;
*enc = AMF_EncodeNamedBoolean(*enc, end, flv_str(&s, name), val);
}
static inline void enc_str_val(char **enc, char *end, const char *name,
2019-09-22 21:19:10 +00:00
const char *val)
2016-02-23 23:16:51 +00:00
{
AVal s1, s2;
2019-09-22 21:19:10 +00:00
*enc = AMF_EncodeNamedString(*enc, end, flv_str(&s1, name),
flv_str(&s2, val));
2016-02-23 23:16:51 +00:00
}
static inline void enc_str(char **enc, char *end, const char *str)
{
AVal s;
*enc = AMF_EncodeString(*enc, end, flv_str(&s, str));
}