obs-ffmpeg: Enable mpegts network URL for ffmpeg-mux

This commit is contained in:
pkv 2020-03-25 03:26:28 +01:00 committed by jp9000
parent efa9ee0f3d
commit c8ff234255

View file

@ -516,12 +516,27 @@ static inline int open_output_file(struct ffmpeg_mux *ffm)
return FFM_SUCCESS;
}
#define SRT_PROTO "srt"
#define UDP_PROTO "udp"
#define TCP_PROTO "tcp"
static int ffmpeg_mux_init_context(struct ffmpeg_mux *ffm)
{
AVOutputFormat *output_format;
int ret;
bool isNetwork = false;
if (strncmp(ffm->params.file, SRT_PROTO, sizeof(SRT_PROTO) - 1) == 0 ||
strncmp(ffm->params.file, UDP_PROTO, sizeof(UDP_PROTO) - 1) == 0 ||
strncmp(ffm->params.file, TCP_PROTO, sizeof(TCP_PROTO) - 1) == 0)
isNetwork = true;
if (isNetwork) {
avformat_network_init();
output_format = av_guess_format("mpegts", NULL, "video/M2PT");
} else {
output_format = av_guess_format(NULL, ffm->params.file, NULL);
}
output_format = av_guess_format(NULL, ffm->params.file, NULL);
if (output_format == NULL) {
fprintf(stderr, "Couldn't find an appropriate muxer for '%s'\n",
ffm->params.file);