1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

better image sequence support (Charles Yates) - suppressed unused non overlay support

Originally committed as revision 2283 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Fabrice Bellard 2003-09-16 19:37:27 +00:00
parent 69ef9450d8
commit 61890b02b3

View File

@ -154,6 +154,7 @@ static int audio_write_get_buf_size(VideoState *is);
/* options specified by the user */ /* options specified by the user */
static AVInputFormat *file_iformat; static AVInputFormat *file_iformat;
static AVImageFormat *image_format;
static const char *input_filename; static const char *input_filename;
static int fs_screen_width; static int fs_screen_width;
static int fs_screen_height; static int fs_screen_height;
@ -672,14 +673,15 @@ static void alloc_picture(void *opaque)
{ {
VideoState *is = opaque; VideoState *is = opaque;
VideoPicture *vp; VideoPicture *vp;
int is_yuv;
vp = &is->pictq[is->pictq_windex]; vp = &is->pictq[is->pictq_windex];
if (vp->bmp) if (vp->bmp)
SDL_FreeYUVOverlay(vp->bmp); SDL_FreeYUVOverlay(vp->bmp);
#if 0
/* XXX: use generic function */ /* XXX: use generic function */
/* XXX: disable overlay if no hardware acceleration or if RGB format */
switch(is->video_st->codec.pix_fmt) { switch(is->video_st->codec.pix_fmt) {
case PIX_FMT_YUV420P: case PIX_FMT_YUV420P:
case PIX_FMT_YUV422P: case PIX_FMT_YUV422P:
@ -693,22 +695,11 @@ static void alloc_picture(void *opaque)
is_yuv = 0; is_yuv = 0;
break; break;
} }
if (is_yuv) {
vp->bmp = SDL_CreateYUVOverlay(is->video_st->codec.width,
is->video_st->codec.height,
SDL_YV12_OVERLAY,
screen);
} else {
#if 0
vp->bmp = bmp_alloc(screen,
is->video_st->codec.width,
is->video_st->codec.height,
screen->bitmap_format,
0);
#endif #endif
vp->bmp = NULL; vp->bmp = SDL_CreateYUVOverlay(is->video_st->codec.width,
} is->video_st->codec.height,
SDL_YV12_OVERLAY,
screen);
vp->width = is->video_st->codec.width; vp->width = is->video_st->codec.width;
vp->height = is->video_st->codec.height; vp->height = is->video_st->codec.height;
@ -1255,6 +1246,7 @@ static int decode_thread(void *arg)
AVFormatContext *ic; AVFormatContext *ic;
int err, i, ret, video_index, audio_index; int err, i, ret, video_index, audio_index;
AVPacket pkt1, *pkt = &pkt1; AVPacket pkt1, *pkt = &pkt1;
AVFormatParameters params, *ap = &params;
video_index = -1; video_index = -1;
audio_index = -1; audio_index = -1;
@ -1264,7 +1256,10 @@ static int decode_thread(void *arg)
global_video_state = is; global_video_state = is;
url_set_interrupt_cb(decode_interrupt_cb); url_set_interrupt_cb(decode_interrupt_cb);
err = av_open_input_file(&ic, is->filename, is->iformat, 0, NULL); memset(ap, 0, sizeof(*ap));
ap->image_format = image_format;
err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);
if (err < 0) { if (err < 0) {
print_error(is->filename, err); print_error(is->filename, err);
ret = -1; ret = -1;
@ -1613,6 +1608,22 @@ static void opt_format(const char *arg)
exit(1); exit(1);
} }
} }
static void opt_image_format(const char *arg)
{
AVImageFormat *f;
for(f = first_image_format; f != NULL; f = f->next) {
if (!strcmp(arg, f->name))
break;
}
if (!f) {
fprintf(stderr, "Unknown image format: '%s'\n", arg);
exit(1);
}
image_format = f;
}
#ifdef CONFIG_NETWORK #ifdef CONFIG_NETWORK
void opt_rtp_tcp(void) void opt_rtp_tcp(void)
{ {
@ -1645,6 +1656,7 @@ const OptionDef options[] = {
{ "vn", OPT_BOOL, {(void*)&video_disable}, "disable video" }, { "vn", OPT_BOOL, {(void*)&video_disable}, "disable video" },
{ "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" }, { "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
{ "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" }, { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
{ "img", HAS_ARG, {(void*)opt_image_format}, "force image format", "img_fmt" },
{ "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" }, { "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
#ifdef CONFIG_NETWORK #ifdef CONFIG_NETWORK
{ "rtp_tcp", OPT_EXPERT, {(void*)&opt_rtp_tcp}, "force RTP/TCP protocol usage", "" }, { "rtp_tcp", OPT_EXPERT, {(void*)&opt_rtp_tcp}, "force RTP/TCP protocol usage", "" },