New upstream version 18.0.1+dfsg1

This commit is contained in:
Sebastian Ramacher 2017-04-19 21:54:15 +02:00
parent 6efda2859e
commit f2cf6cce50
1337 changed files with 41178 additions and 84670 deletions

View file

@ -23,6 +23,7 @@
#include <obs-avc.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
#include <libavformat/avformat.h>
#include "obs-ffmpeg-formats.h"
@ -223,11 +224,13 @@ static bool nvenc_update(void *data, obs_data_t *settings)
"\twidth: %d\n"
"\theight: %d\n"
"\t2-pass: %s\n"
"\tb-frames: %d\n"
"\tGPU: %d\n",
rc, bitrate, cqp, enc->context->gop_size,
preset, profile, level,
enc->context->width, enc->context->height,
twopass ? "true" : "false",
enc->context->max_b_frames,
gpu);
return nvenc_init_codec(enc);
@ -269,7 +272,9 @@ static void *nvenc_create(obs_data_t *settings, obs_encoder_t *encoder)
enc = bzalloc(sizeof(*enc));
enc->encoder = encoder;
enc->nvenc = avcodec_find_encoder_by_name("nvenc_h264");
enc->nvenc = avcodec_find_encoder_by_name("h264_nvenc");
if (!enc->nvenc)
enc->nvenc = avcodec_find_encoder_by_name("nvenc_h264");
enc->first_packet = true;
blog(LOG_INFO, "---------------------------------");
@ -296,8 +301,10 @@ fail:
}
static inline void copy_data(AVPicture *pic, const struct encoder_frame *frame,
int height)
int height, enum AVPixelFormat format)
{
int h_chroma_shift, v_chroma_shift;
av_pix_fmt_get_chroma_sub_sample(format, &h_chroma_shift, &v_chroma_shift);
for (int plane = 0; plane < MAX_AV_PLANES; plane++) {
if (!frame->data[plane])
continue;
@ -306,7 +313,7 @@ static inline void copy_data(AVPicture *pic, const struct encoder_frame *frame,
int pic_rowsize = pic->linesize[plane];
int bytes = frame_rowsize < pic_rowsize ?
frame_rowsize : pic_rowsize;
int plane_height = plane == 0 ? height : height/2;
int plane_height = height >> (plane ? v_chroma_shift : 0);
for (int y = 0; y < plane_height; y++) {
int pos_frame = y * frame_rowsize;
@ -329,7 +336,7 @@ static bool nvenc_encode(void *data, struct encoder_frame *frame,
av_init_packet(&av_pkt);
copy_data(&enc->dst_picture, frame, enc->height);
copy_data(&enc->dst_picture, frame, enc->height, enc->context->pix_fmt);
enc->vframe->pts = frame->pts;
ret = avcodec_encode_video2(enc->context, &av_pkt, enc->vframe,