Commit 73806e66 authored by Simon Morlat's avatar Simon Morlat

update for newest ffmpeg, migth break older ones but will fix later.

parent 06168d84
......@@ -132,7 +132,7 @@ static mblk_t *get_as_yuvmsg(MSFilter *f, DecData *s, AVFrame *orig){
s->vsize.width=ctx->width;
s->vsize.height=ctx->height;
s->sws_ctx=sws_getContext(ctx->width,ctx->height,ctx->pix_fmt,
ctx->width,ctx->height,PIX_FMT_YUV420P,SWS_FAST_BILINEAR,
ctx->width,ctx->height,AV_PIX_FMT_YUV420P,SWS_FAST_BILINEAR,
NULL, NULL, NULL);
ms_filter_notify_no_arg(f,MS_FILTER_OUTPUT_FMT_CHANGED);
}
......
......@@ -127,7 +127,7 @@ static void jpg_process(MSFilter *f){
avctx->height=yuvbuf.h;
avctx->time_base.num = 1;
avctx->time_base.den =1;
avctx->pix_fmt=PIX_FMT_YUVJ420P;
avctx->pix_fmt=AV_PIX_FMT_YUVJ420P;
error=avcodec_open2(avctx,s->codec,NULL);
if (error!=0) {
......@@ -136,7 +136,7 @@ static void jpg_process(MSFilter *f){
av_free(avctx);
goto end;
}
sws_ctx=sws_getContext(avctx->width,avctx->height,PIX_FMT_YUV420P,
sws_ctx=sws_getContext(avctx->width,avctx->height,AV_PIX_FMT_YUV420P,
avctx->width,avctx->height,avctx->pix_fmt,SWS_FAST_BILINEAR,NULL, NULL, NULL);
if (sws_ctx==NULL) {
ms_error(" sws_getContext() failed.");
......
......@@ -84,9 +84,9 @@ static mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bufsize, MSVideoSize *reqsize){
}
ret=ms_yuv_buf_alloc(&dest, reqsize->width,reqsize->height);
/* not using SWS_FAST_BILINEAR because it doesn't play well with
* av_context.pix_fmt set to PIX_FMT_YUVJ420P by jpeg decoder */
* av_context.pix_fmt set to AV_PIX_FMT_YUVJ420P by jpeg decoder */
sws_ctx=sws_getContext(av_context.width,av_context.height,av_context.pix_fmt,
reqsize->width,reqsize->height,PIX_FMT_YUV420P,SWS_BILINEAR,
reqsize->width,reqsize->height,AV_PIX_FMT_YUV420P,SWS_BILINEAR,
NULL, NULL, NULL);
if (sws_ctx==NULL) {
ms_error("jpeg2yuv: ms_sws_getContext() failed.");
......
......@@ -40,7 +40,7 @@ typedef struct DecState{
YuvBuf outbuf;
mblk_t *yuv_msg;
struct SwsContext *sws_ctx;
enum PixelFormat output_pix_fmt;
enum AVPixelFormat output_pix_fmt;
uint8_t dci[512];
int dci_size;
MSAverageFPS fps;
......@@ -59,7 +59,7 @@ static void dec_init(MSFilter *f, enum CodecID cid){
s->codec=cid;
s->input=NULL;
s->yuv_msg=NULL;
s->output_pix_fmt=PIX_FMT_YUV420P;
s->output_pix_fmt=AV_PIX_FMT_YUV420P;
s->snow_initialized=FALSE;
s->outbuf.w=0;
s->outbuf.h=0;
......
......@@ -259,13 +259,13 @@ static void prepare(EncState *s){
avcodec_get_context_defaults3(c, NULL);
if (s->codec==CODEC_ID_MJPEG)
{
ms_message("Codec bitrate set to %i",c->bit_rate);
ms_message("Codec bitrate set to %i",(int)c->bit_rate);
c->width = s->vconf.vsize.width;
c->height = s->vconf.vsize.height;
c->time_base.num = 1;
c->time_base.den = (int)s->vconf.fps;
c->gop_size=(int)s->vconf.fps*5; /*emit I frame every 5 seconds*/
c->pix_fmt=PIX_FMT_YUVJ420P;
c->pix_fmt=AV_PIX_FMT_YUVJ420P;
s->comp_buf=allocb(c->bit_rate*2,0);
return;
}
......@@ -297,20 +297,19 @@ static void prepare(EncState *s){
c->qmin=s->qmin;
}
ms_message("Codec bitrate set to %i",c->bit_rate);
c->width = s->vconf.vsize.width;
c->height = s->vconf.vsize.height;
c->time_base.num = 1;
c->time_base.den = (int)s->vconf.fps;
c->gop_size=(int)s->vconf.fps*10; /*emit I frame every 10 seconds*/
c->pix_fmt=PIX_FMT_YUV420P;
c->pix_fmt=AV_PIX_FMT_YUV420P;
s->comp_buf=allocb(c->bit_rate*2,0);
#if HAVE_AVCODEC_SNOW
if (s->codec==CODEC_ID_SNOW){
c->strict_std_compliance=-2;
}
#endif
ms_message("Codec size set to w=%i/h=%i",c->width, c->height);
ms_message("Codec size set to w=%i/h=%i, bitrate=%i",c->width, c->height, (int)c->bit_rate);
}
......
......@@ -404,21 +404,21 @@ void ms_rgb_to_yuv(const uint8_t rgb[3], uint8_t yuv[3]){
int ms_pix_fmt_to_ffmpeg(MSPixFmt fmt){
switch(fmt){
case MS_RGBA32:
return PIX_FMT_RGBA;
return AV_PIX_FMT_RGBA;
case MS_RGB24:
return PIX_FMT_RGB24;
return AV_PIX_FMT_RGB24;
case MS_RGB24_REV:
return PIX_FMT_BGR24;
return AV_PIX_FMT_BGR24;
case MS_YUV420P:
return PIX_FMT_YUV420P;
return AV_PIX_FMT_YUV420P;
case MS_YUYV:
return PIX_FMT_YUYV422;
return AV_PIX_FMT_YUYV422;
case MS_UYVY:
return PIX_FMT_UYVY422;
return AV_PIX_FMT_UYVY422;
case MS_YUY2:
return PIX_FMT_YUYV422; /* <- same as MS_YUYV */
return AV_PIX_FMT_YUYV422; /* <- same as MS_YUYV */
case MS_RGB565:
return PIX_FMT_RGB565;
return AV_PIX_FMT_RGB565;
default:
ms_fatal("format not supported.");
return -1;
......@@ -428,19 +428,19 @@ int ms_pix_fmt_to_ffmpeg(MSPixFmt fmt){
MSPixFmt ffmpeg_pix_fmt_to_ms(int fmt){
switch(fmt){
case PIX_FMT_RGB24:
case AV_PIX_FMT_RGB24:
return MS_RGB24;
case PIX_FMT_BGR24:
case AV_PIX_FMT_BGR24:
return MS_RGB24_REV;
case PIX_FMT_YUV420P:
case AV_PIX_FMT_YUV420P:
return MS_YUV420P;
case PIX_FMT_YUYV422:
case AV_PIX_FMT_YUYV422:
return MS_YUYV; /* same as MS_YUY2 */
case PIX_FMT_UYVY422:
case AV_PIX_FMT_UYVY422:
return MS_UYVY;
case PIX_FMT_RGBA:
case AV_PIX_FMT_RGBA:
return MS_RGBA32;
case PIX_FMT_RGB565:
case AV_PIX_FMT_RGB565:
return MS_RGB565;
default:
ms_fatal("format not supported.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment