New upstream version 21.0.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2018-02-19 20:54:37 +01:00
parent 1f1bbb3518
commit baafb6325b
706 changed files with 49633 additions and 5044 deletions

View file

@ -26,9 +26,13 @@ extern "C" {
#endif
#define MAX_AUDIO_MIXES 6
#define MAX_AUDIO_CHANNELS 2
#define MAX_AUDIO_CHANNELS 8
#define AUDIO_OUTPUT_FRAMES 1024
#define TOTAL_AUDIO_SIZE \
(MAX_AUDIO_MIXES * MAX_AUDIO_CHANNELS * \
AUDIO_OUTPUT_FRAMES * sizeof(float))
/*
* Base audio output component. Use this to create an audio output track
* for the media.
@ -51,18 +55,24 @@ enum audio_format {
AUDIO_FORMAT_FLOAT_PLANAR,
};
/**
* The speaker layout describes where the speakers are located in the room.
* For OBS it dictates:
* * how many channels are available and
* * which channels are used for which speakers.
*
* Standard channel layouts where retrieved from ffmpeg documentation at:
* https://trac.ffmpeg.org/wiki/AudioChannelManipulation
*/
enum speaker_layout {
SPEAKERS_UNKNOWN,
SPEAKERS_MONO,
SPEAKERS_STEREO,
SPEAKERS_2POINT1,
SPEAKERS_QUAD,
SPEAKERS_4POINT1,
SPEAKERS_5POINT1,
SPEAKERS_5POINT1_SURROUND,
SPEAKERS_7POINT1,
SPEAKERS_7POINT1_SURROUND,
SPEAKERS_SURROUND,
SPEAKERS_UNKNOWN, /**< Unknown setting, fallback is stereo. */
SPEAKERS_MONO, /**< Channels: MONO */
SPEAKERS_STEREO, /**< Channels: FL, FR */
SPEAKERS_2POINT1, /**< Channels: FL, FR, LFE */
SPEAKERS_4POINT0, /**< Channels: FL, FR, FC, RC */
SPEAKERS_4POINT1, /**< Channels: FL, FR, FC, LFE, RC */
SPEAKERS_5POINT1, /**< Channels: FL, FR, FC, LFE, RL, RR */
SPEAKERS_7POINT1=8, /**< Channels: FL, FR, FC, LFE, RL, RR, SL, SR */
};
struct audio_data {
@ -102,13 +112,10 @@ static inline uint32_t get_audio_channels(enum speaker_layout speakers)
case SPEAKERS_MONO: return 1;
case SPEAKERS_STEREO: return 2;
case SPEAKERS_2POINT1: return 3;
case SPEAKERS_SURROUND:
case SPEAKERS_QUAD: return 4;
case SPEAKERS_4POINT0: return 4;
case SPEAKERS_4POINT1: return 5;
case SPEAKERS_5POINT1:
case SPEAKERS_5POINT1_SURROUND: return 6;
case SPEAKERS_5POINT1: return 6;
case SPEAKERS_7POINT1: return 8;
case SPEAKERS_7POINT1_SURROUND: return 8;
case SPEAKERS_UNKNOWN: return 0;
}

View file

@ -63,14 +63,11 @@ static inline uint64_t convert_speaker_layout(enum speaker_layout layout)
case SPEAKERS_UNKNOWN: return 0;
case SPEAKERS_MONO: return AV_CH_LAYOUT_MONO;
case SPEAKERS_STEREO: return AV_CH_LAYOUT_STEREO;
case SPEAKERS_2POINT1: return AV_CH_LAYOUT_2_1;
case SPEAKERS_QUAD: return AV_CH_LAYOUT_QUAD;
case SPEAKERS_2POINT1: return AV_CH_LAYOUT_SURROUND;
case SPEAKERS_4POINT0: return AV_CH_LAYOUT_4POINT0;
case SPEAKERS_4POINT1: return AV_CH_LAYOUT_4POINT1;
case SPEAKERS_5POINT1: return AV_CH_LAYOUT_5POINT1;
case SPEAKERS_5POINT1_SURROUND: return AV_CH_LAYOUT_5POINT1_BACK;
case SPEAKERS_5POINT1: return AV_CH_LAYOUT_5POINT1_BACK;
case SPEAKERS_7POINT1: return AV_CH_LAYOUT_7POINT1;
case SPEAKERS_7POINT1_SURROUND: return AV_CH_LAYOUT_7POINT1_WIDE_BACK;
case SPEAKERS_SURROUND: return AV_CH_LAYOUT_SURROUND;
}
/* shouldn't get here */

View file

@ -208,7 +208,7 @@ void decompress_420(
uint8_t *output, uint32_t out_linesize)
{
uint32_t start_y_d2 = start_y/2;
uint32_t width_d2 = min_uint32(in_linesize[0], out_linesize)/2;
uint32_t width_d2 = in_linesize[0]/2;
uint32_t height_d2 = end_y/2;
uint32_t y;
@ -221,18 +221,18 @@ void decompress_420(
lum0 = input[0] + y * 2 * in_linesize[0];
lum1 = lum0 + in_linesize[0];
output0 = (uint32_t*)(output + y * 2 * in_linesize[0]);
output1 = (uint32_t*)((uint8_t*)output0 + in_linesize[0]);
output0 = (uint32_t*)(output + y * 2 * out_linesize);
output1 = (uint32_t*)((uint8_t*)output0 + out_linesize);
for (x = 0; x < width_d2; x++) {
uint32_t out;
out = (*(chroma0++) << 8) | (*(chroma1++) << 16);
out = (*(chroma0++) << 8) | *(chroma1++);
*(output0++) = *(lum0++) | out;
*(output0++) = *(lum0++) | out;
*(output0++) = (*(lum0++) << 16) | out;
*(output0++) = (*(lum0++) << 16) | out;
*(output1++) = *(lum1++) | out;
*(output1++) = *(lum1++) | out;
*(output1++) = (*(lum1++) << 16) | out;
*(output1++) = (*(lum1++) << 16) | out;
}
}
}

View file

@ -18,7 +18,3 @@
#pragma once
#define MAX_AV_PLANES 8
/* time threshold in nanoseconds to ensure audio timing is as seamless as
* possible */
#define TS_SMOOTHING_THRESHOLD 70000000ULL

View file

@ -26,6 +26,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#if LIBAVCODEC_VERSION_MAJOR >= 58
#define CODEC_FLAG_GLOBAL_H AV_CODEC_FLAG_GLOBAL_HEADER
#else
#define CODEC_FLAG_GLOBAL_H CODEC_FLAG_GLOBAL_HEADER
#endif
struct media_remux_job {
int64_t in_size;
AVFormatContext *ifmt_ctx, *ofmt_ctx;
@ -86,7 +92,17 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
return false;
}
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
AVCodecParameters *par = avcodec_parameters_alloc();
ret = avcodec_parameters_from_context(par, in_stream->codec);
if (ret == 0)
ret = avcodec_parameters_to_context(out_stream->codec,
par);
avcodec_parameters_free(&par);
#else
ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
#endif
if (ret < 0) {
blog(LOG_ERROR, "media_remux: Failed to copy context");
return false;
@ -95,7 +111,7 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
out_stream->codec->codec_tag = 0;
if (job->ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
out_stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
out_stream->codec->flags |= CODEC_FLAG_GLOBAL_H;
}
#ifndef _NDEBUG
@ -188,7 +204,7 @@ static inline int process_packets(media_remux_job_t job,
job->ofmt_ctx->streams[pkt.stream_index]);
ret = av_interleaved_write_frame(job->ofmt_ctx, &pkt);
av_free_packet(&pkt);
av_packet_unref(&pkt);
if (ret < 0) {
blog(LOG_ERROR, "media_remux: Error muxing packet: %s",

View file

@ -302,6 +302,8 @@ static inline bool video_input_init(struct video_input *input,
.format = video->info.format,
.width = video->info.width,
.height = video->info.height,
.range = video->info.range,
.colorspace = video->info.colorspace
};
int ret = video_scaler_create(&input->scaler,