Merge commit '3cc3463f306f425f76bd962755df1132eeac6dfa'

* commit '3cc3463f306f425f76bd962755df1132eeac6dfa':
  avisynth: Support pix_fmts added to AviSynth+

This commit is mostly a noop, see
92916e8542.

Cosmetics and a small fix are merged.

Merged-by: Clément Bœsch <u@pkh.me>
This commit is contained in:
Clément Bœsch 2017-04-01 12:12:42 +02:00
commit f047da4ebe

View File

@ -3,6 +3,7 @@
* Copyright (c) 2012 AvxSynth Team
*
* This file is part of FFmpeg
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -18,8 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "libavcodec/internal.h"
#include "avformat.h"
#include "internal.h"
#include "config.h"
@ -245,7 +249,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
switch (avs->vi->pixel_type) {
#ifdef USING_AVISYNTH
/* 10~16-bit YUV pix_fmts (AviSynth+) */
/* 10~16-bit YUV pix_fmts (AviSynth+) */
case AVS_CS_YUV444P10:
st->codecpar->format = AV_PIX_FMT_YUV444P10;
planar = 1;
@ -294,7 +298,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_YUV420P16;
planar = 1;
break;
/* 8~16-bit YUV pix_fmts with Alpha (AviSynth+) */
/* 8~16-bit YUV pix_fmts with Alpha (AviSynth+) */
case AVS_CS_YUVA444:
st->codecpar->format = AV_PIX_FMT_YUVA444P;
planar = 4;
@ -331,7 +335,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_YUVA420P16;
planar = 4;
break;
/* Planar RGB pix_fmts (AviSynth+) */
/* Planar RGB pix_fmts (AviSynth+) */
case AVS_CS_RGBP:
st->codecpar->format = AV_PIX_FMT_GBRP;
planar = 3;
@ -352,7 +356,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_GBRP16;
planar = 3;
break;
/* Planar RGB pix_fmts with Alpha (AviSynth+) */
/* Planar RGB pix_fmts with Alpha (AviSynth+) */
case AVS_CS_RGBAP:
st->codecpar->format = AV_PIX_FMT_GBRAP;
planar = 5;
@ -369,12 +373,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_GBRAP16;
planar = 5;
break;
/* GRAY16 (AviSynth+) */
/* GRAY16 (AviSynth+) */
case AVS_CS_Y16:
st->codecpar->format = AV_PIX_FMT_GRAY16;
planar = 2;
break;
/* pix_fmts added in AviSynth 2.6 */
/* pix_fmts added in AviSynth 2.6 */
case AVS_CS_YV24:
st->codecpar->format = AV_PIX_FMT_YUV444P;
planar = 1;
@ -391,7 +395,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_GRAY8;
planar = 2;
break;
/* 16-bit packed RGB pix_fmts (AviSynth+) */
/* 16-bit packed RGB pix_fmts (AviSynth+) */
case AVS_CS_BGR48:
st->codecpar->format = AV_PIX_FMT_BGR48;
break;
@ -399,7 +403,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
st->codecpar->format = AV_PIX_FMT_BGRA64;
break;
#endif
/* AviSynth 2.5 and AvxSynth pix_fmts */
/* AviSynth 2.5 and AvxSynth pix_fmts */
case AVS_CS_BGR24:
st->codecpar->format = AV_PIX_FMT_BGR24;
break;
@ -606,6 +610,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
const unsigned char *src_p;
int n, i, plane, rowsize, planeheight, pitch, bits;
const char *error;
int avsplus av_unused;
if (avs->curr_frame >= avs->vi->num_frames)
return AVERROR_EOF;
@ -618,9 +623,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
#ifdef USING_AVISYNTH
/* Detect whether we're using AviSynth 2.6 or AviSynth+ by
* looking for whether avs_is_planar_rgb exists. */
int avsplus;
if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL)
avsplus = 0;
else
@ -683,7 +685,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
}
#ifdef USING_AVISYNTH
/* Flip Planar RGB video. */
/* Flip Planar RGB video */
if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) ||
avs_library.avs_is_planar_rgba(avs->vi))) {
src_p = src_p + (planeheight - 1) * pitch;