|
@@ -31,8 +31,8 @@
|
|
|
#include <libavutil/mastering_display_metadata.h>
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
-#define do_log(level, format, ...) \
|
|
|
- blog(level, "[obs-ffmpeg mpegts muxer: '%s'] " format, \
|
|
|
+#define do_log(level, format, ...) \
|
|
|
+ blog(level, "[obs-ffmpeg mpegts muxer: '%s']: " format, \
|
|
|
obs_output_get_name(stream->output), ##__VA_ARGS__)
|
|
|
|
|
|
#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__)
|
|
@@ -151,7 +151,7 @@ static bool create_video_stream(struct ffmpeg_output *stream,
|
|
|
const char *name = data->config.video_encoder;
|
|
|
const AVCodecDescriptor *codec = avcodec_descriptor_get_by_name(name);
|
|
|
if (!codec) {
|
|
|
- error("Couldn't find codec '%s'\n", name);
|
|
|
+ error("Couldn't find codec '%s'", name);
|
|
|
return false;
|
|
|
}
|
|
|
if (!new_stream(data, &data->video, name))
|
|
@@ -239,7 +239,7 @@ static bool create_audio_stream(struct ffmpeg_output *stream,
|
|
|
|
|
|
const AVCodecDescriptor *codec = avcodec_descriptor_get_by_name(name);
|
|
|
if (!codec) {
|
|
|
- warn("Couldn't find codec '%s'\n", name);
|
|
|
+ warn("Couldn't find codec '%s'", name);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -327,14 +327,14 @@ static inline int connect_mpegts_url(struct ffmpeg_output *stream, bool is_rist)
|
|
|
const char *url = stream->ff_data.config.url;
|
|
|
if (!ff_network_init()) {
|
|
|
ffmpeg_mpegts_log_error(LOG_ERROR, &stream->ff_data,
|
|
|
- "Can not initialize network.");
|
|
|
+ "Couldn't initialize network");
|
|
|
return AVERROR(EIO);
|
|
|
}
|
|
|
|
|
|
URLContext *uc = av_mallocz(sizeof(URLContext) + strlen(url) + 1);
|
|
|
if (!uc) {
|
|
|
ffmpeg_mpegts_log_error(LOG_ERROR, &stream->ff_data,
|
|
|
- "Can not allocate memory.");
|
|
|
+ "Couldn't allocate memory");
|
|
|
goto fail;
|
|
|
}
|
|
|
uc->url = (char *)url;
|
|
@@ -344,7 +344,7 @@ static inline int connect_mpegts_url(struct ffmpeg_output *stream, bool is_rist)
|
|
|
: av_mallocz(sizeof(SRTContext));
|
|
|
if (!uc->priv_data) {
|
|
|
ffmpeg_mpegts_log_error(LOG_ERROR, &stream->ff_data,
|
|
|
- "Can not allocate memory.");
|
|
|
+ "Couldn't allocate memory");
|
|
|
goto fail;
|
|
|
}
|
|
|
/* For SRT, pass streamid & passphrase; for RIST, pass passphrase, username
|
|
@@ -458,9 +458,9 @@ static inline int open_output_file(struct ffmpeg_output *stream,
|
|
|
"=", " ", 0))) {
|
|
|
ffmpeg_mpegts_log_error(
|
|
|
LOG_WARNING, data,
|
|
|
- "Failed to parse protocol settings: %s\n%s",
|
|
|
- av_err2str(ret),
|
|
|
- data->config.protocol_settings);
|
|
|
+ "Failed to parse protocol settings: %s, %s",
|
|
|
+ data->config.protocol_settings,
|
|
|
+ av_err2str(ret));
|
|
|
|
|
|
av_dict_free(&dict);
|
|
|
return OBS_OUTPUT_INVALID_STREAM;
|
|
@@ -494,7 +494,7 @@ static inline int open_output_file(struct ffmpeg_output *stream,
|
|
|
ret = avio_open2(&data->output->pb, data->config.url,
|
|
|
AVIO_FLAG_WRITE, NULL, &dict);
|
|
|
} else {
|
|
|
- info("[ffmpeg mpegts muxer:] Invalid protocol: %s",
|
|
|
+ info("[ffmpeg mpegts muxer]: Invalid protocol: %s",
|
|
|
data->config.url);
|
|
|
return OBS_OUTPUT_BAD_PATH;
|
|
|
}
|
|
@@ -502,7 +502,7 @@ static inline int open_output_file(struct ffmpeg_output *stream,
|
|
|
if (ret < 0) {
|
|
|
if ((rist || srt) && (ret == OBS_OUTPUT_CONNECT_FAILED ||
|
|
|
ret == OBS_OUTPUT_INVALID_STREAM)) {
|
|
|
- error("failed to open the url or invalid stream");
|
|
|
+ error("Failed to open the url or invalid stream");
|
|
|
} else {
|
|
|
ffmpeg_mpegts_log_error(LOG_WARNING, data,
|
|
|
"Couldn't open '%s', %s",
|
|
@@ -527,7 +527,7 @@ static inline int open_output_file(struct ffmpeg_output *stream,
|
|
|
dstr_catf(&str, "\n\t%s=%s", entry->key,
|
|
|
entry->value);
|
|
|
|
|
|
- info("[ffmpeg mpegts muxer:]Invalid protocol settings: %s",
|
|
|
+ info("[ffmpeg mpegts muxer]: Invalid protocol settings: %s",
|
|
|
str.array);
|
|
|
dstr_free(&str);
|
|
|
}
|
|
@@ -535,7 +535,7 @@ static inline int open_output_file(struct ffmpeg_output *stream,
|
|
|
} else {
|
|
|
ret = allocate_custom_aviocontext(stream, rist);
|
|
|
if (ret < 0) {
|
|
|
- info("Couldn't allocate custom avio_context for rist or srt'%s', %s\n",
|
|
|
+ info("Couldn't allocate custom avio_context for url: '%s', %s",
|
|
|
data->config.url, av_err2str(ret));
|
|
|
return OBS_OUTPUT_INVALID_STREAM;
|
|
|
}
|
|
@@ -591,7 +591,7 @@ static void close_mpegts_url(struct ffmpeg_output *stream, bool is_rist)
|
|
|
avio_context_free(&stream->s);
|
|
|
|
|
|
if (err)
|
|
|
- info("[ffmpeg mpegts muxer:] Error closing URL %s",
|
|
|
+ info("[ffmpeg mpegts muxer]: Error closing URL %s",
|
|
|
stream->ff_data.config.url);
|
|
|
}
|
|
|
|
|
@@ -665,7 +665,7 @@ bool ffmpeg_mpegts_data_init(struct ffmpeg_output *stream,
|
|
|
"Couldn't set output format to mpegts");
|
|
|
goto fail;
|
|
|
} else {
|
|
|
- info("info: Output format name and long_name: %s, %s\n",
|
|
|
+ info("Output format name and long_name: %s, %s",
|
|
|
output_format->name ? output_format->name : "unknown",
|
|
|
output_format->long_name ? output_format->long_name
|
|
|
: "unknown");
|
|
@@ -897,7 +897,8 @@ static bool set_config(struct ffmpeg_output *stream)
|
|
|
obs_to_ffmpeg_video_format(video_output_get_format(video));
|
|
|
|
|
|
if (config.format == AV_PIX_FMT_NONE) {
|
|
|
- blog(LOG_DEBUG, "invalid pixel format used for mpegts output");
|
|
|
+ blog(LOG_WARNING,
|
|
|
+ "Invalid pixel format used for mpegts output");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -1012,7 +1013,7 @@ static bool set_config(struct ffmpeg_output *stream)
|
|
|
}
|
|
|
code = open_output_file(stream, ff_data);
|
|
|
if (code != 0) {
|
|
|
- error("failed to open the url");
|
|
|
+ error("Failed to open the url");
|
|
|
goto fail;
|
|
|
}
|
|
|
av_dump_format(ff_data->output, 0, NULL, 1);
|
|
@@ -1026,7 +1027,7 @@ static bool set_config(struct ffmpeg_output *stream)
|
|
|
if (ret != 0) {
|
|
|
ffmpeg_mpegts_log_error(
|
|
|
LOG_WARNING, &stream->ff_data,
|
|
|
- "ffmpeg_output_start: failed to create write "
|
|
|
+ "ffmpeg_output_start: Failed to create write "
|
|
|
"thread.");
|
|
|
code = OBS_OUTPUT_ERROR;
|
|
|
goto fail;
|
|
@@ -1156,7 +1157,7 @@ void mpegts_write_packet(struct ffmpeg_output *stream,
|
|
|
|
|
|
packet->data = av_memdup(encpacket->data, (int)encpacket->size);
|
|
|
if (packet->data == NULL) {
|
|
|
- error("couldn't allocate packet data");
|
|
|
+ error("Couldn't allocate packet data");
|
|
|
goto fail;
|
|
|
}
|
|
|
packet->size = (int)encpacket->size;
|
|
@@ -1184,8 +1185,8 @@ static bool write_header(struct ffmpeg_output *stream, struct ffmpeg_data *data)
|
|
|
" ", 0))) {
|
|
|
ffmpeg_mpegts_log_error(
|
|
|
LOG_WARNING, data,
|
|
|
- "Failed to parse muxer settings: %s\n%s",
|
|
|
- av_err2str(ret), data->config.muxer_settings);
|
|
|
+ "Failed to parse muxer settings: %s, %s",
|
|
|
+ data->config.muxer_settings, av_err2str(ret));
|
|
|
|
|
|
av_dict_free(&dict);
|
|
|
return false;
|
|
@@ -1222,7 +1223,7 @@ static bool write_header(struct ffmpeg_output *stream, struct ffmpeg_data *data)
|
|
|
AV_DICT_IGNORE_SUFFIX)))
|
|
|
dstr_catf(&str, "\n\t%s=%s", entry->key, entry->value);
|
|
|
|
|
|
- info("[ffmpeg mpegts muxer:] Invalid mpegts muxer settings: %s",
|
|
|
+ info("[ffmpeg mpegts muxer]: Invalid mpegts muxer settings: %s",
|
|
|
str.array);
|
|
|
dstr_free(&str);
|
|
|
}
|
|
@@ -1240,12 +1241,12 @@ static void ffmpeg_mpegts_data(void *data, struct encoder_packet *packet)
|
|
|
if (get_extradata(stream)) {
|
|
|
stream->got_headers = true;
|
|
|
} else {
|
|
|
- warn("failed to retrieve headers");
|
|
|
+ warn("Failed to retrieve headers");
|
|
|
code = OBS_OUTPUT_INVALID_STREAM;
|
|
|
goto fail;
|
|
|
}
|
|
|
if (!write_header(stream, ff_data)) {
|
|
|
- error("failed to write headers");
|
|
|
+ error("Failed to write headers");
|
|
|
code = OBS_OUTPUT_INVALID_STREAM;
|
|
|
goto fail;
|
|
|
}
|