mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
multimedia/mplayer2: Fix build with ffmpeg 3.x
screenshot.c:60:5: error: implicit declaration of function 'avcodec_free_frame' is invalid in C99 [-Werror,-Wimplicit-function-declaration] avcodec_free_frame(&ctx->pic); ^ screenshot.c:72:20: error: implicit declaration of function 'avcodec_alloc_frame' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ctx->pic = avcodec_alloc_frame(); ^ screenshot.c:97:22: error: use of undeclared identifier 'PIX_FMT_RGB24'; did you mean 'AV_PIX_FMT_RGB24'? avctx->pix_fmt = PIX_FMT_RGB24; ^~~~~~~~~~~~~ AV_PIX_FMT_RGB24 /usr/local/include/libavutil/pixfmt.h:64:5: note: 'AV_PIX_FMT_RGB24' declared here AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... ^ screenshot.c:113:5: error: implicit declaration of function 'avcodec_get_frame_defaults' is invalid in C99 [-Werror,-Wimplicit-function-declaration] avcodec_get_frame_defaults(pic); ^ screenshot.c:118:16: error: implicit declaration of function 'avcodec_encode_video' is invalid in C99 [-Werror,-Wimplicit-function-declaration] int size = avcodec_encode_video(avctx, outbuffer, outbuffer_size, pic); ^ PR: 214896 Reported by: jbeich Reviewed by: jbeich, junovitch (mentor) Approved by: jbeich, junovitch (mentor)
This commit is contained in:
parent
36062bcbe6
commit
b45df0e7db
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=428215
19 changed files with 1188 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
PORTNAME= mplayer2
|
PORTNAME= mplayer2
|
||||||
PORTVERSION= ${MPLAYER2_PORT_VERSION}
|
PORTVERSION= ${MPLAYER2_PORT_VERSION}
|
||||||
PORTREVISION= 23
|
PORTREVISION= 24
|
||||||
CATEGORIES= multimedia audio
|
CATEGORIES= multimedia audio
|
||||||
MASTER_SITES= LOCAL/gblach/
|
MASTER_SITES= LOCAL/gblach/
|
||||||
|
|
||||||
|
|
204
multimedia/mplayer2/files/patch-fmt-conversion.c
Normal file
204
multimedia/mplayer2/files/patch-fmt-conversion.c
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
--- fmt-conversion.c.orig 2013-07-09 16:33:12 UTC
|
||||||
|
+++ fmt-conversion.c
|
||||||
|
@@ -24,117 +24,117 @@
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
int fmt;
|
||||||
|
- enum PixelFormat pix_fmt;
|
||||||
|
+ enum AVPixelFormat pix_fmt;
|
||||||
|
} conversion_map[] = {
|
||||||
|
- {IMGFMT_ARGB, PIX_FMT_ARGB},
|
||||||
|
- {IMGFMT_BGRA, PIX_FMT_BGRA},
|
||||||
|
- {IMGFMT_BGR24, PIX_FMT_BGR24},
|
||||||
|
- {IMGFMT_BGR16BE, PIX_FMT_RGB565BE},
|
||||||
|
- {IMGFMT_BGR16LE, PIX_FMT_RGB565LE},
|
||||||
|
- {IMGFMT_BGR15BE, PIX_FMT_RGB555BE},
|
||||||
|
- {IMGFMT_BGR15LE, PIX_FMT_RGB555LE},
|
||||||
|
- {IMGFMT_BGR12BE, PIX_FMT_RGB444BE},
|
||||||
|
- {IMGFMT_BGR12LE, PIX_FMT_RGB444LE},
|
||||||
|
- {IMGFMT_BGR8, PIX_FMT_RGB8},
|
||||||
|
- {IMGFMT_BGR4, PIX_FMT_RGB4},
|
||||||
|
- {IMGFMT_BGR1, PIX_FMT_MONOBLACK},
|
||||||
|
- {IMGFMT_RGB1, PIX_FMT_MONOBLACK},
|
||||||
|
- {IMGFMT_RG4B, PIX_FMT_BGR4_BYTE},
|
||||||
|
- {IMGFMT_BG4B, PIX_FMT_RGB4_BYTE},
|
||||||
|
- {IMGFMT_RGB48LE, PIX_FMT_RGB48LE},
|
||||||
|
- {IMGFMT_RGB48BE, PIX_FMT_RGB48BE},
|
||||||
|
- {IMGFMT_ABGR, PIX_FMT_ABGR},
|
||||||
|
- {IMGFMT_RGBA, PIX_FMT_RGBA},
|
||||||
|
- {IMGFMT_RGB24, PIX_FMT_RGB24},
|
||||||
|
- {IMGFMT_RGB16BE, PIX_FMT_BGR565BE},
|
||||||
|
- {IMGFMT_RGB16LE, PIX_FMT_BGR565LE},
|
||||||
|
- {IMGFMT_RGB15BE, PIX_FMT_BGR555BE},
|
||||||
|
- {IMGFMT_RGB15LE, PIX_FMT_BGR555LE},
|
||||||
|
- {IMGFMT_RGB12BE, PIX_FMT_BGR444BE},
|
||||||
|
- {IMGFMT_RGB12LE, PIX_FMT_BGR444LE},
|
||||||
|
- {IMGFMT_RGB8, PIX_FMT_BGR8},
|
||||||
|
- {IMGFMT_RGB4, PIX_FMT_BGR4},
|
||||||
|
- {IMGFMT_BGR8, PIX_FMT_PAL8},
|
||||||
|
- {IMGFMT_GBRP, PIX_FMT_GBRP},
|
||||||
|
- {IMGFMT_GBRP9, PIX_FMT_GBRP9},
|
||||||
|
- {IMGFMT_GBRP10, PIX_FMT_GBRP10},
|
||||||
|
- {IMGFMT_YUY2, PIX_FMT_YUYV422},
|
||||||
|
- {IMGFMT_UYVY, PIX_FMT_UYVY422},
|
||||||
|
- {IMGFMT_NV12, PIX_FMT_NV12},
|
||||||
|
- {IMGFMT_NV21, PIX_FMT_NV21},
|
||||||
|
- {IMGFMT_Y800, PIX_FMT_GRAY8},
|
||||||
|
- {IMGFMT_Y8, PIX_FMT_GRAY8},
|
||||||
|
- {IMGFMT_YVU9, PIX_FMT_YUV410P},
|
||||||
|
- {IMGFMT_IF09, PIX_FMT_YUV410P},
|
||||||
|
- {IMGFMT_YV12, PIX_FMT_YUV420P},
|
||||||
|
- {IMGFMT_I420, PIX_FMT_YUV420P},
|
||||||
|
- {IMGFMT_IYUV, PIX_FMT_YUV420P},
|
||||||
|
- {IMGFMT_411P, PIX_FMT_YUV411P},
|
||||||
|
- {IMGFMT_422P, PIX_FMT_YUV422P},
|
||||||
|
- {IMGFMT_444P, PIX_FMT_YUV444P},
|
||||||
|
- {IMGFMT_440P, PIX_FMT_YUV440P},
|
||||||
|
+ {IMGFMT_ARGB, AV_PIX_FMT_ARGB},
|
||||||
|
+ {IMGFMT_BGRA, AV_PIX_FMT_BGRA},
|
||||||
|
+ {IMGFMT_BGR24, AV_PIX_FMT_BGR24},
|
||||||
|
+ {IMGFMT_BGR16BE, AV_PIX_FMT_RGB565BE},
|
||||||
|
+ {IMGFMT_BGR16LE, AV_PIX_FMT_RGB565LE},
|
||||||
|
+ {IMGFMT_BGR15BE, AV_PIX_FMT_RGB555BE},
|
||||||
|
+ {IMGFMT_BGR15LE, AV_PIX_FMT_RGB555LE},
|
||||||
|
+ {IMGFMT_BGR12BE, AV_PIX_FMT_RGB444BE},
|
||||||
|
+ {IMGFMT_BGR12LE, AV_PIX_FMT_RGB444LE},
|
||||||
|
+ {IMGFMT_BGR8, AV_PIX_FMT_RGB8},
|
||||||
|
+ {IMGFMT_BGR4, AV_PIX_FMT_RGB4},
|
||||||
|
+ {IMGFMT_BGR1, AV_PIX_FMT_MONOBLACK},
|
||||||
|
+ {IMGFMT_RGB1, AV_PIX_FMT_MONOBLACK},
|
||||||
|
+ {IMGFMT_RG4B, AV_PIX_FMT_BGR4_BYTE},
|
||||||
|
+ {IMGFMT_BG4B, AV_PIX_FMT_RGB4_BYTE},
|
||||||
|
+ {IMGFMT_RGB48LE, AV_PIX_FMT_RGB48LE},
|
||||||
|
+ {IMGFMT_RGB48BE, AV_PIX_FMT_RGB48BE},
|
||||||
|
+ {IMGFMT_ABGR, AV_PIX_FMT_ABGR},
|
||||||
|
+ {IMGFMT_RGBA, AV_PIX_FMT_RGBA},
|
||||||
|
+ {IMGFMT_RGB24, AV_PIX_FMT_RGB24},
|
||||||
|
+ {IMGFMT_RGB16BE, AV_PIX_FMT_BGR565BE},
|
||||||
|
+ {IMGFMT_RGB16LE, AV_PIX_FMT_BGR565LE},
|
||||||
|
+ {IMGFMT_RGB15BE, AV_PIX_FMT_BGR555BE},
|
||||||
|
+ {IMGFMT_RGB15LE, AV_PIX_FMT_BGR555LE},
|
||||||
|
+ {IMGFMT_RGB12BE, AV_PIX_FMT_BGR444BE},
|
||||||
|
+ {IMGFMT_RGB12LE, AV_PIX_FMT_BGR444LE},
|
||||||
|
+ {IMGFMT_RGB8, AV_PIX_FMT_BGR8},
|
||||||
|
+ {IMGFMT_RGB4, AV_PIX_FMT_BGR4},
|
||||||
|
+ {IMGFMT_BGR8, AV_PIX_FMT_PAL8},
|
||||||
|
+ {IMGFMT_GBRP, AV_PIX_FMT_GBRP},
|
||||||
|
+ {IMGFMT_GBRP9, AV_PIX_FMT_GBRP9},
|
||||||
|
+ {IMGFMT_GBRP10, AV_PIX_FMT_GBRP10},
|
||||||
|
+ {IMGFMT_YUY2, AV_PIX_FMT_YUYV422},
|
||||||
|
+ {IMGFMT_UYVY, AV_PIX_FMT_UYVY422},
|
||||||
|
+ {IMGFMT_NV12, AV_PIX_FMT_NV12},
|
||||||
|
+ {IMGFMT_NV21, AV_PIX_FMT_NV21},
|
||||||
|
+ {IMGFMT_Y800, AV_PIX_FMT_GRAY8},
|
||||||
|
+ {IMGFMT_Y8, AV_PIX_FMT_GRAY8},
|
||||||
|
+ {IMGFMT_YVU9, AV_PIX_FMT_YUV410P},
|
||||||
|
+ {IMGFMT_IF09, AV_PIX_FMT_YUV410P},
|
||||||
|
+ {IMGFMT_YV12, AV_PIX_FMT_YUV420P},
|
||||||
|
+ {IMGFMT_I420, AV_PIX_FMT_YUV420P},
|
||||||
|
+ {IMGFMT_IYUV, AV_PIX_FMT_YUV420P},
|
||||||
|
+ {IMGFMT_411P, AV_PIX_FMT_YUV411P},
|
||||||
|
+ {IMGFMT_422P, AV_PIX_FMT_YUV422P},
|
||||||
|
+ {IMGFMT_444P, AV_PIX_FMT_YUV444P},
|
||||||
|
+ {IMGFMT_440P, AV_PIX_FMT_YUV440P},
|
||||||
|
|
||||||
|
- {IMGFMT_420A, PIX_FMT_YUVA420P},
|
||||||
|
+ {IMGFMT_420A, AV_PIX_FMT_YUVA420P},
|
||||||
|
|
||||||
|
- {IMGFMT_420P16_LE, PIX_FMT_YUV420P16LE},
|
||||||
|
- {IMGFMT_420P16_BE, PIX_FMT_YUV420P16BE},
|
||||||
|
- {IMGFMT_420P9_LE, PIX_FMT_YUV420P9LE},
|
||||||
|
- {IMGFMT_420P9_BE, PIX_FMT_YUV420P9BE},
|
||||||
|
- {IMGFMT_420P10_LE, PIX_FMT_YUV420P10LE},
|
||||||
|
- {IMGFMT_420P10_BE, PIX_FMT_YUV420P10BE},
|
||||||
|
- {IMGFMT_422P10_LE, PIX_FMT_YUV422P10LE},
|
||||||
|
- {IMGFMT_422P10_BE, PIX_FMT_YUV422P10BE},
|
||||||
|
- {IMGFMT_444P9_BE , PIX_FMT_YUV444P9BE},
|
||||||
|
- {IMGFMT_444P9_LE , PIX_FMT_YUV444P9LE},
|
||||||
|
- {IMGFMT_444P10_BE, PIX_FMT_YUV444P10BE},
|
||||||
|
- {IMGFMT_444P10_LE, PIX_FMT_YUV444P10LE},
|
||||||
|
- {IMGFMT_422P16_LE, PIX_FMT_YUV422P16LE},
|
||||||
|
- {IMGFMT_422P16_BE, PIX_FMT_YUV422P16BE},
|
||||||
|
- {IMGFMT_422P9_LE, PIX_FMT_YUV422P9LE},
|
||||||
|
- {IMGFMT_422P9_BE, PIX_FMT_YUV422P9BE},
|
||||||
|
- {IMGFMT_444P16_LE, PIX_FMT_YUV444P16LE},
|
||||||
|
- {IMGFMT_444P16_BE, PIX_FMT_YUV444P16BE},
|
||||||
|
+ {IMGFMT_420P16_LE, AV_PIX_FMT_YUV420P16LE},
|
||||||
|
+ {IMGFMT_420P16_BE, AV_PIX_FMT_YUV420P16BE},
|
||||||
|
+ {IMGFMT_420P9_LE, AV_PIX_FMT_YUV420P9LE},
|
||||||
|
+ {IMGFMT_420P9_BE, AV_PIX_FMT_YUV420P9BE},
|
||||||
|
+ {IMGFMT_420P10_LE, AV_PIX_FMT_YUV420P10LE},
|
||||||
|
+ {IMGFMT_420P10_BE, AV_PIX_FMT_YUV420P10BE},
|
||||||
|
+ {IMGFMT_422P10_LE, AV_PIX_FMT_YUV422P10LE},
|
||||||
|
+ {IMGFMT_422P10_BE, AV_PIX_FMT_YUV422P10BE},
|
||||||
|
+ {IMGFMT_444P9_BE , AV_PIX_FMT_YUV444P9BE},
|
||||||
|
+ {IMGFMT_444P9_LE , AV_PIX_FMT_YUV444P9LE},
|
||||||
|
+ {IMGFMT_444P10_BE, AV_PIX_FMT_YUV444P10BE},
|
||||||
|
+ {IMGFMT_444P10_LE, AV_PIX_FMT_YUV444P10LE},
|
||||||
|
+ {IMGFMT_422P16_LE, AV_PIX_FMT_YUV422P16LE},
|
||||||
|
+ {IMGFMT_422P16_BE, AV_PIX_FMT_YUV422P16BE},
|
||||||
|
+ {IMGFMT_422P9_LE, AV_PIX_FMT_YUV422P9LE},
|
||||||
|
+ {IMGFMT_422P9_BE, AV_PIX_FMT_YUV422P9BE},
|
||||||
|
+ {IMGFMT_444P16_LE, AV_PIX_FMT_YUV444P16LE},
|
||||||
|
+ {IMGFMT_444P16_BE, AV_PIX_FMT_YUV444P16BE},
|
||||||
|
|
||||||
|
// YUVJ are YUV formats that use the full Y range and not just
|
||||||
|
// 16 - 235 (see colorspaces.txt).
|
||||||
|
// Currently they are all treated the same way.
|
||||||
|
- {IMGFMT_YV12, PIX_FMT_YUVJ420P},
|
||||||
|
- {IMGFMT_422P, PIX_FMT_YUVJ422P},
|
||||||
|
- {IMGFMT_444P, PIX_FMT_YUVJ444P},
|
||||||
|
- {IMGFMT_440P, PIX_FMT_YUVJ440P},
|
||||||
|
+ {IMGFMT_YV12, AV_PIX_FMT_YUVJ420P},
|
||||||
|
+ {IMGFMT_422P, AV_PIX_FMT_YUVJ422P},
|
||||||
|
+ {IMGFMT_444P, AV_PIX_FMT_YUVJ444P},
|
||||||
|
+ {IMGFMT_440P, AV_PIX_FMT_YUVJ440P},
|
||||||
|
|
||||||
|
- {IMGFMT_VDPAU_MPEG1, PIX_FMT_VDPAU_MPEG1},
|
||||||
|
- {IMGFMT_VDPAU_MPEG2, PIX_FMT_VDPAU_MPEG2},
|
||||||
|
- {IMGFMT_VDPAU_H264, PIX_FMT_VDPAU_H264},
|
||||||
|
- {IMGFMT_VDPAU_WMV3, PIX_FMT_VDPAU_WMV3},
|
||||||
|
- {IMGFMT_VDPAU_VC1, PIX_FMT_VDPAU_VC1},
|
||||||
|
- {IMGFMT_VDPAU_MPEG4, PIX_FMT_VDPAU_MPEG4},
|
||||||
|
- {0, PIX_FMT_NONE}
|
||||||
|
+ {IMGFMT_VDPAU_MPEG1, AV_PIX_FMT_VDPAU_MPEG1},
|
||||||
|
+ {IMGFMT_VDPAU_MPEG2, AV_PIX_FMT_VDPAU_MPEG2},
|
||||||
|
+ {IMGFMT_VDPAU_H264, AV_PIX_FMT_VDPAU_H264},
|
||||||
|
+ {IMGFMT_VDPAU_WMV3, AV_PIX_FMT_VDPAU_WMV3},
|
||||||
|
+ {IMGFMT_VDPAU_VC1, AV_PIX_FMT_VDPAU_VC1},
|
||||||
|
+ {IMGFMT_VDPAU_MPEG4, AV_PIX_FMT_VDPAU_MPEG4},
|
||||||
|
+ {0, AV_PIX_FMT_NONE}
|
||||||
|
};
|
||||||
|
|
||||||
|
-enum PixelFormat imgfmt2pixfmt(int fmt)
|
||||||
|
+enum AVPixelFormat imgfmt2pixfmt(int fmt)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
- enum PixelFormat pix_fmt;
|
||||||
|
+ enum AVPixelFormat pix_fmt;
|
||||||
|
for (i = 0; conversion_map[i].fmt; i++)
|
||||||
|
if (conversion_map[i].fmt == fmt)
|
||||||
|
break;
|
||||||
|
pix_fmt = conversion_map[i].pix_fmt;
|
||||||
|
- if (pix_fmt == PIX_FMT_NONE)
|
||||||
|
+ if (pix_fmt == AV_PIX_FMT_NONE)
|
||||||
|
mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported format %s\n", vo_format_name(fmt));
|
||||||
|
return pix_fmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int pixfmt2imgfmt(enum PixelFormat pix_fmt)
|
||||||
|
+int pixfmt2imgfmt(enum AVPixelFormat pix_fmt)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
- for (i = 0; conversion_map[i].pix_fmt != PIX_FMT_NONE; i++)
|
||||||
|
+ for (i = 0; conversion_map[i].pix_fmt != AV_PIX_FMT_NONE; i++)
|
||||||
|
if (conversion_map[i].pix_fmt == pix_fmt)
|
||||||
|
break;
|
||||||
|
int fmt = conversion_map[i].fmt;
|
||||||
|
if (!fmt) {
|
||||||
|
const char *fmtname = av_get_pix_fmt_name(pix_fmt);
|
||||||
|
- mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported PixelFormat %s (%d)\n",
|
||||||
|
+ mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported AVPixelFormat %s (%d)\n",
|
||||||
|
fmtname ? fmtname : "INVALID", pix_fmt);
|
||||||
|
}
|
||||||
|
return fmt;
|
12
multimedia/mplayer2/files/patch-fmt-conversion.h
Normal file
12
multimedia/mplayer2/files/patch-fmt-conversion.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
--- fmt-conversion.h.orig 2016-11-29 15:06:09 UTC
|
||||||
|
+++ fmt-conversion.h
|
||||||
|
@@ -22,7 +22,7 @@
|
||||||
|
#include "libavutil/avutil.h"
|
||||||
|
#include <libavutil/pixfmt.h>
|
||||||
|
|
||||||
|
-enum PixelFormat imgfmt2pixfmt(int fmt);
|
||||||
|
-int pixfmt2imgfmt(enum PixelFormat pix_fmt);
|
||||||
|
+enum AVPixelFormat imgfmt2pixfmt(int fmt);
|
||||||
|
+int pixfmt2imgfmt(enum AVPixelFormat pix_fmt);
|
||||||
|
|
||||||
|
#endif /* MPLAYER_FMT_CONVERSION_H */
|
28
multimedia/mplayer2/files/patch-libaf_af__lavcac3enc.c
Normal file
28
multimedia/mplayer2/files/patch-libaf_af__lavcac3enc.c
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
--- libaf/af_lavcac3enc.c.orig 2013-07-09 16:33:12 UTC
|
||||||
|
+++ libaf/af_lavcac3enc.c
|
||||||
|
@@ -27,7 +27,6 @@
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
-#include <libavutil/audioconvert.h>
|
||||||
|
#include <libavutil/error.h>
|
||||||
|
#include <libavutil/intreadwrite.h>
|
||||||
|
#include <libavutil/mem.h>
|
||||||
|
@@ -219,7 +218,7 @@ static void uninit(struct af_instance_s*
|
||||||
|
av_free(s->lavc_actx);
|
||||||
|
}
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
|
||||||
|
- avcodec_free_frame(&s->frame);
|
||||||
|
+ av_frame_free(&s->frame);
|
||||||
|
#else
|
||||||
|
av_freep(&s->frame);
|
||||||
|
#endif
|
||||||
|
@@ -398,7 +397,7 @@ static int af_open(af_instance_t* af){
|
||||||
|
mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't allocate context!\n");
|
||||||
|
return AF_ERROR;
|
||||||
|
}
|
||||||
|
- s->frame = avcodec_alloc_frame();
|
||||||
|
+ s->frame = av_frame_alloc();
|
||||||
|
if (!s->frame)
|
||||||
|
return AF_ERROR;
|
||||||
|
const enum AVSampleFormat *fmts = s->lavc_acodec->sample_fmts;
|
40
multimedia/mplayer2/files/patch-libmpcodecs_ad__ffmpeg.c
Normal file
40
multimedia/mplayer2/files/patch-libmpcodecs_ad__ffmpeg.c
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
--- libmpcodecs/ad_ffmpeg.c.orig 2013-07-09 16:33:13 UTC
|
||||||
|
+++ libmpcodecs/ad_ffmpeg.c
|
||||||
|
@@ -23,9 +23,9 @@
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
-#include <libavutil/audioconvert.h>
|
||||||
|
#include <libavutil/opt.h>
|
||||||
|
#include <libavutil/samplefmt.h>
|
||||||
|
+#include <libavutil/channel_layout.h>
|
||||||
|
|
||||||
|
#include "talloc.h"
|
||||||
|
|
||||||
|
@@ -236,7 +236,7 @@ static int init(sh_audio_t *sh_audio)
|
||||||
|
sh_audio->context = ctx;
|
||||||
|
lavc_context = avcodec_alloc_context3(lavc_codec);
|
||||||
|
ctx->avctx = lavc_context;
|
||||||
|
- ctx->avframe = avcodec_alloc_frame();
|
||||||
|
+ ctx->avframe = av_frame_alloc();
|
||||||
|
|
||||||
|
// Always try to set - option only exists for AC3 at the moment
|
||||||
|
av_opt_set_double(lavc_context, "drc_scale", opts->drc_level,
|
||||||
|
@@ -250,7 +250,7 @@ static int init(sh_audio_t *sh_audio)
|
||||||
|
lavc_context->block_align = sh_audio->wf->nBlockAlign;
|
||||||
|
lavc_context->bits_per_coded_sample = sh_audio->wf->wBitsPerSample;
|
||||||
|
}
|
||||||
|
- lavc_context->request_channels = opts->audio_output_channels;
|
||||||
|
+ lavc_context->request_channel_layout = av_get_default_channel_layout(opts->audio_output_channels);
|
||||||
|
lavc_context->codec_tag = sh_audio->format; //FOURCC
|
||||||
|
lavc_context->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
|
lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi
|
||||||
|
@@ -333,7 +333,7 @@ static void uninit(sh_audio_t *sh)
|
||||||
|
avresample_free(&ctx->avr);
|
||||||
|
#endif
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= (54 << 16 | 28 << 8)
|
||||||
|
- avcodec_free_frame(&ctx->avframe);
|
||||||
|
+ av_frame_free(&ctx->avframe);
|
||||||
|
#else
|
||||||
|
av_free(ctx->avframe);
|
||||||
|
#endif
|
37
multimedia/mplayer2/files/patch-libmpcodecs_dec__teletext.c
Normal file
37
multimedia/mplayer2/files/patch-libmpcodecs_dec__teletext.c
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
--- libmpcodecs/dec_teletext.c.orig 2013-07-09 16:33:13 UTC
|
||||||
|
+++ libmpcodecs/dec_teletext.c
|
||||||
|
@@ -402,6 +402,25 @@ struct {
|
||||||
|
{ 0x00, LATIN, "English"},
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const uint8_t reverse[256] = {
|
||||||
|
+0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
|
||||||
|
+0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
|
||||||
|
+0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4,
|
||||||
|
+0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC,
|
||||||
|
+0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2,
|
||||||
|
+0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA,
|
||||||
|
+0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6,
|
||||||
|
+0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE,
|
||||||
|
+0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1,
|
||||||
|
+0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9,
|
||||||
|
+0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5,
|
||||||
|
+0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD,
|
||||||
|
+0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3,
|
||||||
|
+0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB,
|
||||||
|
+0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
|
||||||
|
+0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* \brief 24/18 Hamming code decoding
|
||||||
|
* \param data bytes with hamming code (array must be at least 3 bytes long)
|
||||||
|
@@ -1549,7 +1568,7 @@ static void vbi_decode_dvb(priv_vbi_t *p
|
||||||
|
/* Reverse bit order, skipping the first two bytes (field parity, line
|
||||||
|
offset and framing code). */
|
||||||
|
for (i = 0; i < sizeof(data); i++)
|
||||||
|
- data[i] = av_reverse[buf[2 + i]];
|
||||||
|
+ data[i] = reverse[buf[2 + i]];
|
||||||
|
|
||||||
|
vbi_decode_line(priv, data);
|
||||||
|
if (priv->cache_reset)
|
356
multimedia/mplayer2/files/patch-libmpcodecs_vd__ffmpeg.c
Normal file
356
multimedia/mplayer2/files/patch-libmpcodecs_vd__ffmpeg.c
Normal file
|
@ -0,0 +1,356 @@
|
||||||
|
--- libmpcodecs/vd_ffmpeg.c.orig 2013-07-09 16:33:13 UTC
|
||||||
|
+++ libmpcodecs/vd_ffmpeg.c
|
||||||
|
@@ -25,6 +25,7 @@
|
||||||
|
#include <libavutil/common.h>
|
||||||
|
#include <libavutil/opt.h>
|
||||||
|
#include <libavutil/intreadwrite.h>
|
||||||
|
+#include <libavutil/pixdesc.h>
|
||||||
|
|
||||||
|
#include "talloc.h"
|
||||||
|
#include "config.h"
|
||||||
|
@@ -61,7 +62,7 @@ static const vd_info_t info = {
|
||||||
|
typedef struct {
|
||||||
|
AVCodecContext *avctx;
|
||||||
|
AVFrame *pic;
|
||||||
|
- enum PixelFormat pix_fmt;
|
||||||
|
+ enum AVPixelFormat pix_fmt;
|
||||||
|
int do_slices;
|
||||||
|
int do_dr1;
|
||||||
|
int vo_initialized;
|
||||||
|
@@ -77,13 +78,16 @@ typedef struct {
|
||||||
|
|
||||||
|
#include "m_option.h"
|
||||||
|
|
||||||
|
-static int get_buffer(AVCodecContext *avctx, AVFrame *pic);
|
||||||
|
+static int get_buffer(AVCodecContext *avctx, AVFrame *pic, int isreference);
|
||||||
|
+static int mpcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame);
|
||||||
|
+static int get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags);
|
||||||
|
static void release_buffer(AVCodecContext *avctx, AVFrame *pic);
|
||||||
|
+static void mpcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
|
||||||
|
static void draw_slice(struct AVCodecContext *s, const AVFrame *src,
|
||||||
|
int offset[4], int y, int type, int height);
|
||||||
|
|
||||||
|
-static enum PixelFormat get_format(struct AVCodecContext *avctx,
|
||||||
|
- const enum PixelFormat *pix_fmt);
|
||||||
|
+static enum AVPixelFormat get_format(struct AVCodecContext *avctx,
|
||||||
|
+ const enum AVPixelFormat *pix_fmt);
|
||||||
|
static void uninit(struct sh_video *sh);
|
||||||
|
|
||||||
|
const m_option_t lavc_decode_opts_conf[] = {
|
||||||
|
@@ -169,7 +173,7 @@ static int init(sh_video_t *sh)
|
||||||
|
ctx->do_dr1 = 1;
|
||||||
|
ctx->ip_count = ctx->b_count = 0;
|
||||||
|
|
||||||
|
- ctx->pic = avcodec_alloc_frame();
|
||||||
|
+ ctx->pic = av_frame_alloc();
|
||||||
|
ctx->avctx = avcodec_alloc_context3(lavc_codec);
|
||||||
|
avctx = ctx->avctx;
|
||||||
|
avctx->opaque = sh;
|
||||||
|
@@ -182,9 +186,7 @@ static int init(sh_video_t *sh)
|
||||||
|
ctx->do_slices = true;
|
||||||
|
lavc_param->threads = 1;
|
||||||
|
avctx->get_format = get_format;
|
||||||
|
- avctx->get_buffer = get_buffer;
|
||||||
|
- avctx->release_buffer = release_buffer;
|
||||||
|
- avctx->reget_buffer = get_buffer;
|
||||||
|
+ avctx->get_buffer2 = get_buffer2;
|
||||||
|
avctx->draw_horiz_band = draw_slice;
|
||||||
|
if (lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
|
||||||
|
mp_msg(MSGT_DECVIDEO, MSGL_V, "[VD_FFMPEG] VDPAU hardware "
|
||||||
|
@@ -212,10 +214,7 @@ static int init(sh_video_t *sh)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->do_dr1) {
|
||||||
|
- avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||||
|
- avctx->get_buffer = get_buffer;
|
||||||
|
- avctx->release_buffer = release_buffer;
|
||||||
|
- avctx->reget_buffer = get_buffer;
|
||||||
|
+ avctx->get_buffer2 = get_buffer2;
|
||||||
|
}
|
||||||
|
|
||||||
|
avctx->flags |= lavc_param->bitexact;
|
||||||
|
@@ -227,7 +226,6 @@ static int init(sh_video_t *sh)
|
||||||
|
avctx->flags |= CODEC_FLAG_GRAY;
|
||||||
|
avctx->flags2 |= lavc_param->fast;
|
||||||
|
avctx->codec_tag = sh->format;
|
||||||
|
- avctx->stream_codec_tag = sh->video.fccHandler;
|
||||||
|
avctx->idct_algo = lavc_param->idct_algo;
|
||||||
|
avctx->error_concealment = lavc_param->error_concealment;
|
||||||
|
avctx->debug = lavc_param->debug;
|
||||||
|
@@ -357,7 +355,7 @@ static void uninit(sh_video_t *sh)
|
||||||
|
|
||||||
|
av_freep(&avctx);
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
|
||||||
|
- avcodec_free_frame(&ctx->pic);
|
||||||
|
+ av_frame_free(&ctx->pic);
|
||||||
|
#else
|
||||||
|
av_freep(&ctx->pic);
|
||||||
|
#endif
|
||||||
|
@@ -423,7 +421,7 @@ static enum mp_csp_levels avcol_range_to
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt)
|
||||||
|
+static int init_vo(sh_video_t *sh, enum AVPixelFormat pix_fmt)
|
||||||
|
{
|
||||||
|
vd_ffmpeg_ctx *ctx = sh->context;
|
||||||
|
AVCodecContext *avctx = ctx->avctx;
|
||||||
|
@@ -488,7 +486,7 @@ static int init_vo(sh_video_t *sh, enum
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int get_buffer(AVCodecContext *avctx, AVFrame *pic)
|
||||||
|
+static int get_buffer(AVCodecContext *avctx, AVFrame *pic, int isreference)
|
||||||
|
{
|
||||||
|
sh_video_t *sh = avctx->opaque;
|
||||||
|
vd_ffmpeg_ctx *ctx = sh->context;
|
||||||
|
@@ -499,29 +497,11 @@ static int get_buffer(AVCodecContext *av
|
||||||
|
int width = avctx->width;
|
||||||
|
int height = avctx->height;
|
||||||
|
// special case to handle reget_buffer without buffer hints
|
||||||
|
- if (pic->opaque && pic->data[0] && !pic->buffer_hints)
|
||||||
|
+ if (pic->opaque && pic->data[0])
|
||||||
|
return 0;
|
||||||
|
avcodec_align_dimensions(avctx, &width, &height);
|
||||||
|
|
||||||
|
- if (pic->buffer_hints) {
|
||||||
|
- mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Buffer hints: %u\n",
|
||||||
|
- pic->buffer_hints);
|
||||||
|
- type = MP_IMGTYPE_TEMP;
|
||||||
|
- if (pic->buffer_hints & FF_BUFFER_HINTS_READABLE)
|
||||||
|
- flags |= MP_IMGFLAG_READABLE;
|
||||||
|
- if (pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) {
|
||||||
|
- type = MP_IMGTYPE_STATIC;
|
||||||
|
- flags |= MP_IMGFLAG_PRESERVE;
|
||||||
|
- }
|
||||||
|
- if (pic->buffer_hints & FF_BUFFER_HINTS_REUSABLE) {
|
||||||
|
- type = MP_IMGTYPE_STATIC;
|
||||||
|
- flags |= MP_IMGFLAG_PRESERVE;
|
||||||
|
- }
|
||||||
|
- flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0;
|
||||||
|
- mp_msg(MSGT_DECVIDEO, MSGL_DBG2,
|
||||||
|
- type == MP_IMGTYPE_STATIC ? "using STATIC\n" : "using TEMP\n");
|
||||||
|
- } else {
|
||||||
|
- if (!pic->reference) {
|
||||||
|
+ if (!isreference) {
|
||||||
|
ctx->b_count++;
|
||||||
|
flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0;
|
||||||
|
} else {
|
||||||
|
@@ -529,29 +509,25 @@ static int get_buffer(AVCodecContext *av
|
||||||
|
flags |= MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE
|
||||||
|
| (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0);
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
|
||||||
|
if (init_vo(sh, avctx->pix_fmt) < 0) {
|
||||||
|
- avctx->release_buffer = avcodec_default_release_buffer;
|
||||||
|
- avctx->get_buffer = avcodec_default_get_buffer;
|
||||||
|
- avctx->reget_buffer = avcodec_default_reget_buffer;
|
||||||
|
+ avctx->get_buffer2 = avcodec_default_get_buffer2;
|
||||||
|
if (pic->data[0])
|
||||||
|
- release_buffer(avctx, pic);
|
||||||
|
- return avctx->get_buffer(avctx, pic);
|
||||||
|
+ mpcodec_default_release_buffer(avctx, pic);
|
||||||
|
+ return avctx->get_buffer2(avctx, pic,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IMGFMT_IS_HWACCEL(ctx->best_csp))
|
||||||
|
type = MP_IMGTYPE_NUMBERED | (0xffff << 16);
|
||||||
|
- else if (!pic->buffer_hints) {
|
||||||
|
+ else {
|
||||||
|
if (ctx->b_count > 1 || ctx->ip_count > 2) {
|
||||||
|
mp_tmsg(MSGT_DECVIDEO, MSGL_WARN, "[VD_FFMPEG] DRI failure.\n");
|
||||||
|
|
||||||
|
ctx->do_dr1 = 0; //FIXME
|
||||||
|
- avctx->get_buffer = avcodec_default_get_buffer;
|
||||||
|
- avctx->reget_buffer = avcodec_default_reget_buffer;
|
||||||
|
+ avctx->get_buffer2 = avcodec_default_get_buffer2;
|
||||||
|
if (pic->data[0])
|
||||||
|
- release_buffer(avctx, pic);
|
||||||
|
- return avctx->get_buffer(avctx, pic);
|
||||||
|
+ mpcodec_default_release_buffer(avctx, pic);
|
||||||
|
+ return avctx->get_buffer2(avctx, pic,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (avctx->has_b_frames || ctx->b_count)
|
||||||
|
@@ -594,7 +570,6 @@ static int get_buffer(AVCodecContext *av
|
||||||
|
|
||||||
|
pic->opaque = mpi;
|
||||||
|
|
||||||
|
- pic->type = FF_BUFFER_TYPE_USER;
|
||||||
|
|
||||||
|
/* The libavcodec reordered_opaque functionality is implemented by
|
||||||
|
* a similar copy in avcodec_default_get_buffer() and without a
|
||||||
|
@@ -626,8 +601,8 @@ static void release_buffer(struct AVCode
|
||||||
|
mpi->usage_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (pic->type != FF_BUFFER_TYPE_USER) {
|
||||||
|
- avcodec_default_release_buffer(avctx, pic);
|
||||||
|
+ if (pic->opaque == NULL) {
|
||||||
|
+ mpcodec_default_release_buffer(avctx, pic);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -822,13 +797,13 @@ static struct mp_image *decode(struct sh
|
||||||
|
return mpi;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static enum PixelFormat get_format(struct AVCodecContext *avctx,
|
||||||
|
- const enum PixelFormat *fmt)
|
||||||
|
+static enum AVPixelFormat get_format(struct AVCodecContext *avctx,
|
||||||
|
+ const enum AVPixelFormat *fmt)
|
||||||
|
{
|
||||||
|
sh_video_t *sh = avctx->opaque;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
- for (i = 0; fmt[i] != PIX_FMT_NONE; i++) {
|
||||||
|
+ for (i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) {
|
||||||
|
int imgfmt = pixfmt2imgfmt(fmt[i]);
|
||||||
|
if (!IMGFMT_IS_HWACCEL(imgfmt))
|
||||||
|
continue;
|
||||||
|
@@ -886,3 +861,144 @@ const struct vd_functions mpcodecs_vd_ff
|
||||||
|
.control = control,
|
||||||
|
.decode2 = decode
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+FFWrapper
|
||||||
|
+*/
|
||||||
|
+static int mpcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
|
||||||
|
+{
|
||||||
|
+ return avcodec_default_get_buffer2(avctx, frame, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mpcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
|
||||||
|
+{
|
||||||
|
+ av_frame_unref(pic);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+typedef struct CompatReleaseBufPriv {
|
||||||
|
+ AVCodecContext avctx;
|
||||||
|
+ AVFrame frame;
|
||||||
|
+ uint8_t avframe_padding[1024]; // hack to allow linking to a avutil larger AVFrame
|
||||||
|
+} CompatReleaseBufPriv;
|
||||||
|
+
|
||||||
|
+static void compat_free_buffer(void *opaque, uint8_t *data)
|
||||||
|
+{
|
||||||
|
+ CompatReleaseBufPriv *priv = opaque;
|
||||||
|
+ release_buffer(&priv->avctx, &priv->frame);
|
||||||
|
+ av_freep(&priv);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void compat_release_buffer(void *opaque, uint8_t *data)
|
||||||
|
+{
|
||||||
|
+ AVBufferRef *buf = opaque;
|
||||||
|
+ av_buffer_unref(&buf);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags)
|
||||||
|
+{
|
||||||
|
+ /*
|
||||||
|
+ * Wrap an old get_buffer()-allocated buffer in a bunch of AVBuffers.
|
||||||
|
+ * We wrap each plane in its own AVBuffer. Each of those has a reference to
|
||||||
|
+ * a dummy AVBuffer as its private data, unreffing it on free,
|
||||||
|
+ * When all the planes are freed, the dummy buffer's free callback calls
|
||||||
|
+ * release_buffer().
|
||||||
|
+ */
|
||||||
|
+ CompatReleaseBufPriv *priv = NULL;
|
||||||
|
+ AVBufferRef *dummy_buf = NULL;
|
||||||
|
+ int planes, i, ret;
|
||||||
|
+
|
||||||
|
+ ret = get_buffer(avctx, frame, flags & AV_GET_BUFFER_FLAG_REF);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ /* return if the buffers are already set up
|
||||||
|
+ * this would happen e.g. when a custom get_buffer() calls
|
||||||
|
+ * avcodec_default_get_buffer
|
||||||
|
+ */
|
||||||
|
+ if (frame->buf[0])
|
||||||
|
+ goto end0;
|
||||||
|
+
|
||||||
|
+ priv = av_mallocz(sizeof(*priv));
|
||||||
|
+ if (!priv) {
|
||||||
|
+ ret = AVERROR(ENOMEM);
|
||||||
|
+ goto fail;
|
||||||
|
+ }
|
||||||
|
+ priv->avctx = *avctx;
|
||||||
|
+ priv->frame = *frame;
|
||||||
|
+
|
||||||
|
+ dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, priv, 0);
|
||||||
|
+ if (!dummy_buf) {
|
||||||
|
+ ret = AVERROR(ENOMEM);
|
||||||
|
+ goto fail;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+#define WRAP_PLANE(ref_out, data, data_size) \
|
||||||
|
+do { \
|
||||||
|
+ AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \
|
||||||
|
+ if (!dummy_ref) { \
|
||||||
|
+ ret = AVERROR(ENOMEM); \
|
||||||
|
+ goto fail; \
|
||||||
|
+ } \
|
||||||
|
+ ref_out = av_buffer_create(data, data_size, compat_release_buffer, \
|
||||||
|
+ dummy_ref, 0); \
|
||||||
|
+ if (!ref_out) { \
|
||||||
|
+ av_buffer_unref(&dummy_ref); \
|
||||||
|
+ av_frame_unref(frame); \
|
||||||
|
+ ret = AVERROR(ENOMEM); \
|
||||||
|
+ goto fail; \
|
||||||
|
+ } \
|
||||||
|
+} while (0)
|
||||||
|
+
|
||||||
|
+ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||||
|
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
|
||||||
|
+
|
||||||
|
+ planes = av_pix_fmt_count_planes(frame->format);
|
||||||
|
+ /* workaround for AVHWAccel plane count of 0, buf[0] is used as
|
||||||
|
+ check for allocated buffers: make libavcodec happy */
|
||||||
|
+ if (desc && desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
|
||||||
|
+ planes = 1;
|
||||||
|
+ if (!desc || planes <= 0) {
|
||||||
|
+ ret = AVERROR(EINVAL);
|
||||||
|
+ goto fail;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < planes; i++) {
|
||||||
|
+ int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
|
||||||
|
+ int plane_size = (frame->height >> v_shift) * frame->linesize[i];
|
||||||
|
+
|
||||||
|
+ WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ int planar = av_sample_fmt_is_planar(frame->format);
|
||||||
|
+ planes = planar ? avctx->channels : 1;
|
||||||
|
+
|
||||||
|
+ if (planes > FF_ARRAY_ELEMS(frame->buf)) {
|
||||||
|
+ frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf);
|
||||||
|
+ frame->extended_buf = av_malloc_array(sizeof(*frame->extended_buf),
|
||||||
|
+ frame->nb_extended_buf);
|
||||||
|
+ if (!frame->extended_buf) {
|
||||||
|
+ ret = AVERROR(ENOMEM);
|
||||||
|
+ goto fail;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++)
|
||||||
|
+ WRAP_PLANE(frame->extended_buf[i],
|
||||||
|
+ frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)],
|
||||||
|
+ frame->linesize[0]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ av_buffer_unref(&dummy_buf);
|
||||||
|
+
|
||||||
|
+end0:
|
||||||
|
+ frame->width = avctx->width;
|
||||||
|
+ frame->height = avctx->height;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+fail:
|
||||||
|
+ release_buffer(avctx, frame);
|
||||||
|
+ av_freep(&priv);
|
||||||
|
+ av_buffer_unref(&dummy_buf);
|
||||||
|
+ return ret;
|
||||||
|
+}
|
15
multimedia/mplayer2/files/patch-libmpcodecs_vf__halfpack.c
Normal file
15
multimedia/mplayer2/files/patch-libmpcodecs_vf__halfpack.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--- libmpcodecs/vf_halfpack.c.orig 2013-07-09 16:33:16 UTC
|
||||||
|
+++ libmpcodecs/vf_halfpack.c
|
||||||
|
@@ -198,9 +198,9 @@ static int config(struct vf_instance *vf
|
||||||
|
sws_freeContext(vf->priv->ctx);
|
||||||
|
// get unscaled 422p -> yuy2 conversion
|
||||||
|
vf->priv->ctx =
|
||||||
|
- sws_getContext(width, height / 2, PIX_FMT_YUV422P,
|
||||||
|
- width, height / 2, PIX_FMT_YUYV422,
|
||||||
|
- SWS_POINT | SWS_PRINT_INFO | get_sws_cpuflags(),
|
||||||
|
+ sws_getContext(width, height / 2, AV_PIX_FMT_YUV422P,
|
||||||
|
+ width, height / 2, AV_PIX_FMT_YUYV422,
|
||||||
|
+ SWS_POINT | SWS_PRINT_INFO,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
/* FIXME - also support UYVY output? */
|
47
multimedia/mplayer2/files/patch-libmpcodecs_vf__lavc.c
Normal file
47
multimedia/mplayer2/files/patch-libmpcodecs_vf__lavc.c
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
--- libmpcodecs/vf_lavc.c.orig 2013-07-09 16:33:16 UTC
|
||||||
|
+++ libmpcodecs/vf_lavc.c
|
||||||
|
@@ -83,6 +83,8 @@ static int put_image(struct vf_instance
|
||||||
|
mp_image_t* dmpi;
|
||||||
|
int out_size;
|
||||||
|
AVFrame *pic= vf->priv->pic;
|
||||||
|
+ int ret, got_pkt;
|
||||||
|
+ AVPacket pkt;
|
||||||
|
|
||||||
|
pic->data[0]=mpi->planes[0];
|
||||||
|
pic->data[1]=mpi->planes[1];
|
||||||
|
@@ -91,10 +93,14 @@ static int put_image(struct vf_instance
|
||||||
|
pic->linesize[1]=mpi->stride[1];
|
||||||
|
pic->linesize[2]=mpi->stride[2];
|
||||||
|
|
||||||
|
- out_size = avcodec_encode_video(&lavc_venc_context,
|
||||||
|
- vf->priv->outbuf, vf->priv->outbuf_size, pic);
|
||||||
|
+ av_init_packet(&pkt);
|
||||||
|
+ pkt.data = vf->priv->outbuf;
|
||||||
|
+ pkt.size = vf->priv->outbuf_size;
|
||||||
|
+ ret = avcodec_encode_video2(&lavc_venc_context, &pkt, pic, &got_pkt);
|
||||||
|
|
||||||
|
- if(out_size<=0) return 1;
|
||||||
|
+ if(ret<=0) return 1;
|
||||||
|
+ if(!got_pkt) return 1;
|
||||||
|
+ out_size = pkt.size;
|
||||||
|
|
||||||
|
dmpi=vf_get_image(vf->next,IMGFMT_MPEGPES,
|
||||||
|
MP_IMGTYPE_EXPORT, 0,
|
||||||
|
@@ -139,7 +145,7 @@ static int vf_open(vf_instance_t *vf, ch
|
||||||
|
}
|
||||||
|
|
||||||
|
vf->priv->context=avcodec_alloc_context3(vf->priv->codec);
|
||||||
|
- vf->priv->pic = avcodec_alloc_frame();
|
||||||
|
+ vf->priv->pic = av_frame_alloc();
|
||||||
|
|
||||||
|
// TODO: parse args ->
|
||||||
|
if(args) sscanf(args, "%d:%f", &p_quality, &p_fps);
|
||||||
|
@@ -156,7 +162,7 @@ static int vf_open(vf_instance_t *vf, ch
|
||||||
|
lavc_venc_context.time_base.num = 1000*1001;
|
||||||
|
lavc_venc_context.time_base.den = (p_fps<1.0) ? 1000*1001*25 : (p_fps * lavc_venc_context.time_base.num);
|
||||||
|
lavc_venc_context.gop_size = 0; // I-only
|
||||||
|
- lavc_venc_context.pix_fmt= PIX_FMT_YUV420P;
|
||||||
|
+ lavc_venc_context.pix_fmt= AV_PIX_FMT_YUV420P;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
155
multimedia/mplayer2/files/patch-libmpcodecs_vf__lavcdeint.c
Normal file
155
multimedia/mplayer2/files/patch-libmpcodecs_vf__lavcdeint.c
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
--- libmpcodecs/vf_lavcdeint.c.orig 2013-07-09 16:33:16 UTC
|
||||||
|
+++ libmpcodecs/vf_lavcdeint.c
|
||||||
|
@@ -27,135 +27,6 @@
|
||||||
|
#include "img_format.h"
|
||||||
|
#include "mp_image.h"
|
||||||
|
#include "vf.h"
|
||||||
|
-#include "libavcodec/avcodec.h"
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-struct vf_priv_s
|
||||||
|
-{
|
||||||
|
- int width, height;
|
||||||
|
- int pix_fmt;
|
||||||
|
-};
|
||||||
|
-
|
||||||
|
-/* Support for avcodec's built-in deinterlacer.
|
||||||
|
- * Based on vf_lavc.c
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-//===========================================================================//
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-/* Convert mplayer's IMGFMT_* to avcodec's PIX_FMT_* for the supported
|
||||||
|
- * IMGFMT's, and return -1 if the deinterlacer doesn't support
|
||||||
|
- * that format (-1 because 0 is a valid PIX_FMT).
|
||||||
|
- */
|
||||||
|
-/* The deinterlacer supports planer 4:2:0, 4:2:2, and 4:4:4 YUV */
|
||||||
|
-static int
|
||||||
|
-imgfmt_to_pixfmt (int imgfmt)
|
||||||
|
-{
|
||||||
|
- switch(imgfmt)
|
||||||
|
- {
|
||||||
|
- /* I hope I got all the supported formats */
|
||||||
|
-
|
||||||
|
- /* 4:2:0 */
|
||||||
|
- case IMGFMT_YV12:
|
||||||
|
- case IMGFMT_I420:
|
||||||
|
- case IMGFMT_IYUV:
|
||||||
|
- return PIX_FMT_YUV420P;
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
-#if 0
|
||||||
|
- /* 4:2:2 */
|
||||||
|
- case IMGFMT_UYVY:
|
||||||
|
- case IMGFMT_UYNV:
|
||||||
|
- case IMGFMT_Y422:
|
||||||
|
- case IMGFMT_YUY2:
|
||||||
|
- case IMGFMT_YUNV:
|
||||||
|
- case IMGFMT_YVYU:
|
||||||
|
- case IMGFMT_Y42T:
|
||||||
|
- case IMGFMT_V422:
|
||||||
|
- case IMGFMT_V655:
|
||||||
|
- return PIX_FMT_YUV422P;
|
||||||
|
- break;
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
- /* Are there any _planar_ YUV 4:4:4 formats? */
|
||||||
|
-
|
||||||
|
- default:
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-static int
|
||||||
|
-config (struct vf_instance *vf,
|
||||||
|
- int width, int height, int d_width, int d_height,
|
||||||
|
- unsigned int flags, unsigned int outfmt)
|
||||||
|
-{
|
||||||
|
- struct vf_priv_s *priv = vf->priv;
|
||||||
|
-
|
||||||
|
- priv->pix_fmt = imgfmt_to_pixfmt(outfmt);
|
||||||
|
- if(priv->pix_fmt == -1)
|
||||||
|
- return 0;
|
||||||
|
-
|
||||||
|
- /* The deinterlacer will fail if this is false */
|
||||||
|
- if ((width & 3) != 0 || (height & 3) != 0)
|
||||||
|
- return 0;
|
||||||
|
-
|
||||||
|
- /* If we get here, the deinterlacer is guaranteed not to fail */
|
||||||
|
-
|
||||||
|
- priv->width = width;
|
||||||
|
- priv->height = height;
|
||||||
|
-
|
||||||
|
- return vf_next_config(vf,
|
||||||
|
- width, height,
|
||||||
|
- d_width, d_height,
|
||||||
|
- flags, outfmt);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static int
|
||||||
|
-put_image (struct vf_instance *vf, mp_image_t *mpi, double pts)
|
||||||
|
-{
|
||||||
|
- struct vf_priv_s *priv = vf->priv;
|
||||||
|
- mp_image_t* dmpi;
|
||||||
|
- AVPicture pic;
|
||||||
|
- AVPicture lavc_picture;
|
||||||
|
-
|
||||||
|
- lavc_picture.data[0] = mpi->planes[0];
|
||||||
|
- lavc_picture.data[1] = mpi->planes[1];
|
||||||
|
- lavc_picture.data[2] = mpi->planes[2];
|
||||||
|
- lavc_picture.linesize[0] = mpi->stride[0];
|
||||||
|
- lavc_picture.linesize[1] = mpi->stride[1];
|
||||||
|
- lavc_picture.linesize[2] = mpi->stride[2];
|
||||||
|
-
|
||||||
|
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
|
||||||
|
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
|
||||||
|
- priv->width, priv->height);
|
||||||
|
-
|
||||||
|
- pic.data[0] = dmpi->planes[0];
|
||||||
|
- pic.data[1] = dmpi->planes[1];
|
||||||
|
- pic.data[2] = dmpi->planes[2];
|
||||||
|
- pic.linesize[0] = dmpi->stride[0];
|
||||||
|
- pic.linesize[1] = dmpi->stride[1];
|
||||||
|
- pic.linesize[2] = dmpi->stride[2];
|
||||||
|
-
|
||||||
|
- if (avpicture_deinterlace(&pic, &lavc_picture,
|
||||||
|
- priv->pix_fmt, priv->width, priv->height) < 0)
|
||||||
|
- {
|
||||||
|
- /* This should not happen -- see config() */
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return vf_next_put_image(vf, dmpi, pts);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-static int
|
||||||
|
-query_format (struct vf_instance *vf, unsigned int fmt)
|
||||||
|
-{
|
||||||
|
- if(imgfmt_to_pixfmt(fmt) == -1)
|
||||||
|
- return 0;
|
||||||
|
-
|
||||||
|
- return vf_next_query_format(vf,fmt);
|
||||||
|
-}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
@@ -164,13 +35,10 @@ vf_open(vf_instance_t *vf, char *args)
|
||||||
|
/* We don't have any args */
|
||||||
|
(void) args;
|
||||||
|
|
||||||
|
- vf->config = config;
|
||||||
|
- vf->put_image = put_image;
|
||||||
|
- vf->query_format = query_format;
|
||||||
|
- vf->priv = malloc(sizeof(struct vf_priv_s));
|
||||||
|
- memset(vf->priv,0,sizeof(struct vf_priv_s));
|
||||||
|
+ mp_msg(MSGT_VFILTER,MSGL_FATAL, "lavcdeint has been removed, please use '-vf pp=fd' (same filter) or '-vf yadif'\n");
|
||||||
|
|
||||||
|
- return 1;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
11
multimedia/mplayer2/files/patch-libmpcodecs_vf__sab.c
Normal file
11
multimedia/mplayer2/files/patch-libmpcodecs_vf__sab.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--- libmpcodecs/vf_sab.c.orig 2016-11-29 23:52:42 UTC
|
||||||
|
+++ libmpcodecs/vf_sab.c
|
||||||
|
@@ -72,7 +72,7 @@ static int allocStuff(FilterParam *f, in
|
||||||
|
swsF.lumH= swsF.lumV= vec;
|
||||||
|
swsF.chrH= swsF.chrV= NULL;
|
||||||
|
f->preFilterContext= sws_getContext(
|
||||||
|
- width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, get_sws_cpuflags()|SWS_POINT, &swsF, NULL, NULL);
|
||||||
|
+ width, height, AV_PIX_FMT_GRAY8, width, height, AV_PIX_FMT_GRAY8, SWS_POINT, &swsF, NULL, NULL);
|
||||||
|
|
||||||
|
sws_freeVec(vec);
|
||||||
|
vec = sws_getGaussianVec(f->strength, 5.0);
|
78
multimedia/mplayer2/files/patch-libmpcodecs_vf__scale.c
Normal file
78
multimedia/mplayer2/files/patch-libmpcodecs_vf__scale.c
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
--- libmpcodecs/vf_scale.c.orig 2013-07-09 16:33:16 UTC
|
||||||
|
+++ libmpcodecs/vf_scale.c
|
||||||
|
@@ -201,7 +201,7 @@ static int config(struct vf_instance *vf
|
||||||
|
int round_w=0, round_h=0;
|
||||||
|
int i;
|
||||||
|
SwsFilter *srcFilter, *dstFilter;
|
||||||
|
- enum PixelFormat dfmt, sfmt;
|
||||||
|
+ enum AVPixelFormat dfmt, sfmt;
|
||||||
|
|
||||||
|
vf->priv->colorspace = (struct mp_csp_details) {0};
|
||||||
|
|
||||||
|
@@ -210,7 +210,7 @@ static int config(struct vf_instance *vf
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
sfmt = imgfmt2pixfmt(outfmt);
|
||||||
|
- if (outfmt == IMGFMT_RGB8 || outfmt == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8;
|
||||||
|
+ if (outfmt == IMGFMT_RGB8 || outfmt == IMGFMT_BGR8) sfmt = AV_PIX_FMT_PAL8;
|
||||||
|
dfmt = imgfmt2pixfmt(best);
|
||||||
|
|
||||||
|
vo_flags=vf->next->query_format(vf->next,best);
|
||||||
|
@@ -319,13 +319,13 @@ static int config(struct vf_instance *vf
|
||||||
|
sfmt,
|
||||||
|
vf->priv->w, vf->priv->h >> vf->priv->interlaced,
|
||||||
|
dfmt,
|
||||||
|
- int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
|
||||||
|
+ int_sws_flags, srcFilter, dstFilter, vf->priv->param);
|
||||||
|
if(vf->priv->interlaced){
|
||||||
|
vf->priv->ctx2=sws_getContext(width, height >> 1,
|
||||||
|
sfmt,
|
||||||
|
vf->priv->w, vf->priv->h >> 1,
|
||||||
|
dfmt,
|
||||||
|
- int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
|
||||||
|
+ int_sws_flags, srcFilter, dstFilter, vf->priv->param);
|
||||||
|
}
|
||||||
|
if(!vf->priv->ctx){
|
||||||
|
// error...
|
||||||
|
@@ -612,7 +612,7 @@ error_out:
|
||||||
|
// supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
|
||||||
|
|
||||||
|
static int query_format(struct vf_instance *vf, unsigned int fmt){
|
||||||
|
- if (!IMGFMT_IS_HWACCEL(fmt) && imgfmt2pixfmt(fmt) != PIX_FMT_NONE) {
|
||||||
|
+ if (!IMGFMT_IS_HWACCEL(fmt) && imgfmt2pixfmt(fmt) != AV_PIX_FMT_NONE) {
|
||||||
|
unsigned int best=find_best_out(vf, fmt);
|
||||||
|
int flags;
|
||||||
|
if(!best) return 0; // no matching out-fmt
|
||||||
|
@@ -661,14 +661,6 @@ int sws_chr_hshift= 0;
|
||||||
|
float sws_chr_sharpen= 0.0;
|
||||||
|
float sws_lum_sharpen= 0.0;
|
||||||
|
|
||||||
|
-int get_sws_cpuflags(void){
|
||||||
|
- return
|
||||||
|
- (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0)
|
||||||
|
- | (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0)
|
||||||
|
- | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0)
|
||||||
|
- | (gCpuCaps.hasAltiVec ? SWS_CPU_CAPS_ALTIVEC : 0);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)
|
||||||
|
{
|
||||||
|
static int firstTime=1;
|
||||||
|
@@ -717,14 +709,14 @@ static struct SwsContext *sws_getContext
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
SwsFilter *dstFilterParam, *srcFilterParam;
|
||||||
|
- enum PixelFormat dfmt, sfmt;
|
||||||
|
+ enum AVPixelFormat dfmt, sfmt;
|
||||||
|
|
||||||
|
dfmt = imgfmt2pixfmt(dstFormat);
|
||||||
|
sfmt = imgfmt2pixfmt(srcFormat);
|
||||||
|
- if (srcFormat == IMGFMT_RGB8 || srcFormat == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8;
|
||||||
|
+ if (srcFormat == IMGFMT_RGB8 || srcFormat == IMGFMT_BGR8) sfmt = AV_PIX_FMT_PAL8;
|
||||||
|
sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam);
|
||||||
|
|
||||||
|
- return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | extraflags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL);
|
||||||
|
+ return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags, srcFilterParam, dstFilterParam, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat)
|
10
multimedia/mplayer2/files/patch-libmpcodecs_vf__scale.h
Normal file
10
multimedia/mplayer2/files/patch-libmpcodecs_vf__scale.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--- libmpcodecs/vf_scale.h.orig 2016-11-30 00:01:44 UTC
|
||||||
|
+++ libmpcodecs/vf_scale.h
|
||||||
|
@@ -19,7 +19,6 @@
|
||||||
|
#ifndef MPLAYER_VF_SCALE_H
|
||||||
|
#define MPLAYER_VF_SCALE_H
|
||||||
|
|
||||||
|
-int get_sws_cpuflags(void);
|
||||||
|
struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
|
||||||
|
struct SwsContext *sws_getContextFromCmdLine_hq(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
|
||||||
|
|
14
multimedia/mplayer2/files/patch-libmpcodecs_vf__screenshot.c
Normal file
14
multimedia/mplayer2/files/patch-libmpcodecs_vf__screenshot.c
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
--- libmpcodecs/vf_screenshot.c.orig 2016-11-30 00:06:27 UTC
|
||||||
|
+++ libmpcodecs/vf_screenshot.c
|
||||||
|
@@ -167,9 +167,9 @@ static int control (vf_instance_t *vf, i
|
||||||
|
|
||||||
|
static int query_format(struct vf_instance *vf, unsigned int fmt)
|
||||||
|
{
|
||||||
|
- enum PixelFormat av_format = imgfmt2pixfmt(fmt);
|
||||||
|
+ enum AVPixelFormat av_format = imgfmt2pixfmt(fmt);
|
||||||
|
|
||||||
|
- if (av_format != PIX_FMT_NONE && sws_isSupportedInput(av_format))
|
||||||
|
+ if (av_format != AV_PIX_FMT_NONE && sws_isSupportedInput(av_format))
|
||||||
|
return vf_next_query_format(vf, fmt);
|
||||||
|
return 0;
|
||||||
|
}
|
11
multimedia/mplayer2/files/patch-libmpcodecs_vf__smartblur.c
Normal file
11
multimedia/mplayer2/files/patch-libmpcodecs_vf__smartblur.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--- libmpcodecs/vf_smartblur.c.orig 2016-11-30 00:10:36 UTC
|
||||||
|
+++ libmpcodecs/vf_smartblur.c
|
||||||
|
@@ -61,7 +61,7 @@ static int allocStuff(FilterParam *f, in
|
||||||
|
swsF.lumH= swsF.lumV= vec;
|
||||||
|
swsF.chrH= swsF.chrV= NULL;
|
||||||
|
f->filterContext= sws_getContext(
|
||||||
|
- width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_BICUBIC | get_sws_cpuflags(), &swsF, NULL, NULL);
|
||||||
|
+ width, height, AV_PIX_FMT_GRAY8, width, height, AV_PIX_FMT_GRAY8, SWS_BICUBIC, &swsF, NULL, NULL);
|
||||||
|
|
||||||
|
sws_freeVec(vec);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
--- libmpdemux/demux_lavf.c.orig 2016-03-16 10:57:42 UTC
|
--- libmpdemux/demux_lavf.c.orig 2013-07-09 16:33:16 UTC
|
||||||
+++ libmpdemux/demux_lavf.c
|
+++ libmpdemux/demux_lavf.c
|
||||||
@@ -159,6 +159,7 @@ static int lavf_check_file(demuxer_t *de
|
@@ -159,6 +159,7 @@ static int lavf_check_file(demuxer_t *de
|
||||||
int probe_data_size = 0;
|
int probe_data_size = 0;
|
||||||
|
@ -16,3 +16,15 @@
|
||||||
priv->avif = av_probe_input_format2(&avpd, probe_data_size > 0, &score);
|
priv->avif = av_probe_input_format2(&avpd, probe_data_size > 0, &score);
|
||||||
read_size = FFMIN(2 * read_size, PROBE_BUF_SIZE - probe_data_size);
|
read_size = FFMIN(2 * read_size, PROBE_BUF_SIZE - probe_data_size);
|
||||||
} while ((demuxer->desc->type != DEMUXER_TYPE_LAVF_PREFERRED ||
|
} while ((demuxer->desc->type != DEMUXER_TYPE_LAVF_PREFERRED ||
|
||||||
|
@@ -383,9 +385,9 @@ static void handle_stream(demuxer_t *dem
|
||||||
|
|
||||||
|
if (codec->codec_id == AV_CODEC_ID_RAWVIDEO) {
|
||||||
|
switch (codec->pix_fmt) {
|
||||||
|
- case PIX_FMT_RGB24:
|
||||||
|
+ case AV_PIX_FMT_RGB24:
|
||||||
|
codec->codec_tag = MKTAG(24, 'B', 'G', 'R');
|
||||||
|
- case PIX_FMT_BGR24:
|
||||||
|
+ case AV_PIX_FMT_BGR24:
|
||||||
|
codec->codec_tag = MKTAG(24, 'R', 'G', 'B');
|
||||||
|
}
|
||||||
|
if (!codec->codec_tag)
|
||||||
|
|
55
multimedia/mplayer2/files/patch-libvo_vo__png.c
Normal file
55
multimedia/mplayer2/files/patch-libvo_vo__png.c
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
--- libvo/vo_png.c.orig 2013-07-09 16:33:16 UTC
|
||||||
|
+++ libvo/vo_png.c
|
||||||
|
@@ -87,11 +87,12 @@ config(uint32_t width, uint32_t height,
|
||||||
|
|
||||||
|
|
||||||
|
static uint32_t draw_image(mp_image_t* mpi){
|
||||||
|
- AVFrame pic;
|
||||||
|
+ AVFrame *pic;
|
||||||
|
int buffersize;
|
||||||
|
- int res;
|
||||||
|
+ int res, got_pkt;
|
||||||
|
char buf[100];
|
||||||
|
FILE *outfile;
|
||||||
|
+ AVPacket pkt;
|
||||||
|
|
||||||
|
// if -dr or -slices then do nothing:
|
||||||
|
if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
|
||||||
|
@@ -103,24 +104,29 @@ static uint32_t draw_image(mp_image_t* m
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- pic.data[0] = mpi->planes[0];
|
||||||
|
- pic.linesize[0] = mpi->stride[0];
|
||||||
|
+ pic = av_frame_alloc();
|
||||||
|
+ pic->data[0] = mpi->planes[0];
|
||||||
|
+ pic->linesize[0] = mpi->stride[0];
|
||||||
|
buffersize = mpi->w * mpi->h * 8;
|
||||||
|
if (outbuffer_size < buffersize) {
|
||||||
|
av_freep(&outbuffer);
|
||||||
|
outbuffer = av_malloc(buffersize);
|
||||||
|
outbuffer_size = buffersize;
|
||||||
|
}
|
||||||
|
- res = avcodec_encode_video(avctx, outbuffer, outbuffer_size, &pic);
|
||||||
|
+ av_init_packet(&pkt);
|
||||||
|
+ pkt.data = outbuffer;
|
||||||
|
+ pkt.size = outbuffer_size;
|
||||||
|
+ res = avcodec_encode_video2(avctx, &pkt, pic, &got_pkt);
|
||||||
|
+ av_frame_free(&pic);
|
||||||
|
|
||||||
|
- if(res < 0){
|
||||||
|
- mp_msg(MSGT_VO,MSGL_WARN, "[VO_PNG] Error in create_png.\n");
|
||||||
|
- fclose(outfile);
|
||||||
|
- return 1;
|
||||||
|
+ if (res < 0 || !got_pkt) {
|
||||||
|
+ mp_msg(MSGT_VO,MSGL_WARN, "[VO_PNG] Error in create_png.\n");
|
||||||
|
+ } else {
|
||||||
|
+ fwrite(outbuffer, pkt.size, 1, outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
- fwrite(outbuffer, res, 1, outfile);
|
||||||
|
fclose(outfile);
|
||||||
|
+ av_free_packet(&pkt);
|
||||||
|
|
||||||
|
return VO_TRUE;
|
||||||
|
}
|
90
multimedia/mplayer2/files/patch-screenshot.c
Normal file
90
multimedia/mplayer2/files/patch-screenshot.c
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
--- screenshot.c.orig 2013-07-09 16:33:27 UTC
|
||||||
|
+++ screenshot.c
|
||||||
|
@@ -57,7 +57,7 @@ static int destroy_ctx(void *ptr)
|
||||||
|
{
|
||||||
|
struct screenshot_ctx *ctx = ptr;
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
|
||||||
|
- avcodec_free_frame(&ctx->pic);
|
||||||
|
+ av_frame_free(&ctx->pic);
|
||||||
|
#else
|
||||||
|
av_free(ctx->pic);
|
||||||
|
#endif
|
||||||
|
@@ -69,7 +69,7 @@ static screenshot_ctx *screenshot_get_ct
|
||||||
|
if (!mpctx->screenshot_ctx) {
|
||||||
|
struct screenshot_ctx *ctx = talloc_zero(mpctx, screenshot_ctx);
|
||||||
|
talloc_set_destructor(ctx, destroy_ctx);
|
||||||
|
- ctx->pic = avcodec_alloc_frame();
|
||||||
|
+ ctx->pic = av_frame_alloc();
|
||||||
|
assert(ctx->pic);
|
||||||
|
mpctx->screenshot_ctx = ctx;
|
||||||
|
}
|
||||||
|
@@ -80,8 +80,12 @@ static int write_png(screenshot_ctx *ctx
|
||||||
|
{
|
||||||
|
char *fname = ctx->fname;
|
||||||
|
FILE *fp = NULL;
|
||||||
|
- void *outbuffer = NULL;
|
||||||
|
int success = 0;
|
||||||
|
+ int got_pkt;
|
||||||
|
+ AVPacket pkt = {0};
|
||||||
|
+ int got_output = 0;
|
||||||
|
+
|
||||||
|
+ av_init_packet(&pkt);
|
||||||
|
|
||||||
|
struct AVCodec *png_codec = avcodec_find_encoder(AV_CODEC_ID_PNG);
|
||||||
|
AVCodecContext *avctx = NULL;
|
||||||
|
@@ -94,7 +98,7 @@ static int write_png(screenshot_ctx *ctx
|
||||||
|
avctx->time_base = AV_TIME_BASE_Q;
|
||||||
|
avctx->width = image->width;
|
||||||
|
avctx->height = image->height;
|
||||||
|
- avctx->pix_fmt = PIX_FMT_RGB24;
|
||||||
|
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
|
||||||
|
avctx->compression_level = 0;
|
||||||
|
|
||||||
|
if (avcodec_open2(avctx, png_codec, NULL) < 0) {
|
||||||
|
@@ -104,19 +108,14 @@ static int write_png(screenshot_ctx *ctx
|
||||||
|
goto error_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- size_t outbuffer_size = image->width * image->height * 3 * 2;
|
||||||
|
- outbuffer = malloc(outbuffer_size);
|
||||||
|
- if (!outbuffer)
|
||||||
|
- goto error_exit;
|
||||||
|
-
|
||||||
|
AVFrame *pic = ctx->pic;
|
||||||
|
- avcodec_get_frame_defaults(pic);
|
||||||
|
+ av_frame_unref(pic);
|
||||||
|
for (int n = 0; n < 4; n++) {
|
||||||
|
pic->data[n] = image->planes[n];
|
||||||
|
pic->linesize[n] = image->stride[n];
|
||||||
|
}
|
||||||
|
- int size = avcodec_encode_video(avctx, outbuffer, outbuffer_size, pic);
|
||||||
|
- if (size < 1)
|
||||||
|
+ int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output);
|
||||||
|
+ if (ret < 0)
|
||||||
|
goto error_exit;
|
||||||
|
|
||||||
|
fp = fopen(fname, "wb");
|
||||||
|
@@ -126,20 +125,20 @@ static int write_png(screenshot_ctx *ctx
|
||||||
|
goto error_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- fwrite(outbuffer, size, 1, fp);
|
||||||
|
+ fwrite(pkt.data, pkt.size, 1, fp);
|
||||||
|
fflush(fp);
|
||||||
|
|
||||||
|
if (ferror(fp))
|
||||||
|
goto error_exit;
|
||||||
|
|
||||||
|
- success = 1;
|
||||||
|
+ success = !!got_output;
|
||||||
|
error_exit:
|
||||||
|
if (avctx)
|
||||||
|
avcodec_close(avctx);
|
||||||
|
av_free(avctx);
|
||||||
|
if (fp)
|
||||||
|
fclose(fp);
|
||||||
|
- free(outbuffer);
|
||||||
|
+ av_free_packet(&pkt);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
11
multimedia/mplayer2/files/patch-sub_spudec.c
Normal file
11
multimedia/mplayer2/files/patch-sub_spudec.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--- sub/spudec.c.orig 2016-11-30 00:23:04 UTC
|
||||||
|
+++ sub/spudec.c
|
||||||
|
@@ -861,7 +861,7 @@ static void sws_spu_image(unsigned char
|
||||||
|
oldvar = spu_gaussvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
- ctx=sws_getContext(sw, sh, PIX_FMT_GRAY8, dw, dh, PIX_FMT_GRAY8, SWS_GAUSS, &filter, NULL, NULL);
|
||||||
|
+ ctx=sws_getContext(sw, sh, AV_PIX_FMT_GRAY8, dw, dh, AV_PIX_FMT_GRAY8, SWS_GAUSS, &filter, NULL, NULL);
|
||||||
|
sws_scale(ctx,&s1,&ss,0,sh,&d1,&ds);
|
||||||
|
for (i=ss*sh-1; i>=0; i--) if (!s2[i]) s2[i] = 255; //else s2[i] = 1;
|
||||||
|
sws_scale(ctx,(const uint8_t **)&s2,&ss,0,sh,&d2,&ds);
|
Loading…
Add table
Reference in a new issue