diff options
author | Luca Abeni <lucabe72@email.it> | 2006-08-03 16:55:36 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2006-08-03 16:55:36 +0000 |
commit | 03ae87a3e8cc8ab50c25626c1ff9e5fcc2267602 (patch) | |
tree | 431088ad2d084401ef061478405b3986330bace6 /ffplay.c | |
parent | dfeb80a5a97a9a6bbc48d7c7899308fa29714c8b (diff) | |
download | ffmpeg-03ae87a3e8cc8ab50c25626c1ff9e5fcc2267602.tar.gz |
Move output_example.c and ffplay.c to the swscale interface
Originally committed as revision 5923 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -18,6 +18,7 @@ */ #define HAVE_AV_CONFIG_H #include "avformat.h" +#include "swscale.h" #include "version.h" #include "cmdutils.h" @@ -70,6 +71,8 @@ /* NOTE: the size must be big enough to compensate the hardware audio buffersize size */ #define SAMPLE_ARRAY_SIZE (2*65536) +static int sws_flags = SWS_BICUBIC; + typedef struct PacketQueue { AVPacketList *first_pkt, *last_pkt; int nb_packets; @@ -1143,6 +1146,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) VideoPicture *vp; int dst_pix_fmt; AVPicture pict; + static struct SwsContext *img_convert_ctx; /* wait until we have space to put a new picture */ SDL_LockMutex(is->pictq_mutex); @@ -1195,9 +1199,18 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) pict.linesize[0] = vp->bmp->pitches[0]; pict.linesize[1] = vp->bmp->pitches[2]; pict.linesize[2] = vp->bmp->pitches[1]; - img_convert(&pict, dst_pix_fmt, - (AVPicture *)src_frame, is->video_st->codec->pix_fmt, - is->video_st->codec->width, is->video_st->codec->height); + if (img_convert_ctx == NULL) { + img_convert_ctx = sws_getContext(is->video_st->codec->width, + is->video_st->codec->height, is->video_st->codec->pix_fmt, + is->video_st->codec->width, is->video_st->codec->height, + dst_pix_fmt, sws_flags, NULL, NULL, NULL); + if (img_convert_ctx == NULL) { + fprintf(stderr, "Cannot initialize the conversion context\n"); + exit(1); + } + } + sws_scale(img_convert_ctx, src_frame->data, src_frame->linesize, + 0, is->video_st->codec->height, pict.data, pict.linesize); /* update the bitmap content */ SDL_UnlockYUVOverlay(vp->bmp); |