Commit eb953d36 authored by Aymeric Moizard's avatar Aymeric Moizard
Browse files

support for external replacement for swscale

parents c8c47d58 f6e971d1
......@@ -567,6 +567,14 @@ read_rfc2435_header(DecState *s,mblk_t *inm)
static mblk_t *get_as_yuvmsg(MSFilter *f, DecState *s, AVFrame *orig){
AVCodecContext *ctx=&s->av_context;
if (ctx->width==0 || ctx->height==0){
ms_error("%s: wrong image size provided by decoder.",f->desc->name);
return NULL;
}
if (orig->data[0]==NULL){
ms_error("%s: no image data.",f->desc->name);
return NULL;
}
if (s->outbuf.w!=ctx->width || s->outbuf.h!=ctx->height){
if (s->sws_ctx!=NULL){
ms_sws_freeContext(s->sws_ctx);
......@@ -579,6 +587,10 @@ static mblk_t *get_as_yuvmsg(MSFilter *f, DecState *s, AVFrame *orig){
ctx->width,ctx->height,s->output_pix_fmt,SWS_FAST_BILINEAR,
NULL, NULL, NULL);
}
if (s->sws_ctx==NULL){
ms_error("%s: missing rescaling context.",f->desc->name);
return NULL;
}
if (ms_sws_scale(s->sws_ctx,orig->data,orig->linesize, 0,
ctx->height, s->outbuf.planes, s->outbuf.strides)<0){
ms_error("%s: error in ms_sws_scale().",f->desc->name);
......@@ -625,7 +637,9 @@ static void dec_process_frame(MSFilter *f, mblk_t *inm){
break;
}
if (got_picture) {
ms_queue_put(f->outputs[0],get_as_yuvmsg(f,s,&orig));
mblk_t *om = get_as_yuvmsg(f,s,&orig);
if (om!=NULL)
ms_queue_put(f->outputs[0],om);
}
frame->b_rptr+=len;
}
......
......@@ -109,7 +109,13 @@ static void sdl_display_uninit(MSDisplay *obj);
static int sdl_create_window(SdlDisplay *wd, int w, int h){
static bool_t once=TRUE;
wd->sdl_screen = SDL_SetVideoMode(w,h, 0,SDL_SWSURFACE|SDL_RESIZABLE);
wd->sdl_screen = SDL_SetVideoMode(w,h, 0,SDL_HWSURFACE|SDL_RESIZABLE);
if (wd->sdl_screen == NULL ) {
ms_warning("no hardware for video mode: %s\n",
SDL_GetError());
}
if (wd->sdl_screen == NULL )
wd->sdl_screen = SDL_SetVideoMode(w,h, 0,SDL_SWSURFACE|SDL_RESIZABLE);
if (wd->sdl_screen == NULL ) {
ms_warning("Couldn't set video mode: %s\n",
SDL_GetError());
......
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