* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define HAVE_AV_CONFIG_H
+
+#include <math.h>
+#include <limits.h>
#include "avformat.h"
#include "swscale.h"
+#include "avstring.h"
#include "version.h"
#include "cmdutils.h"
#undef main /* We don't want SDL to override our main() */
#endif
-#ifdef CONFIG_OS2
-#define INCL_DOS
- #include <os2.h>
- #include <stdio.h>
-
- void MorphToPM()
- {
- PPIB pib;
- PTIB tib;
-
- DosGetInfoBlocks(&tib, &pib);
-
- // Change flag from VIO to PM:
- if (pib->pib_ultype==2) pib->pib_ultype = 3;
- }
-#endif
-
#undef exit
//#define DEBUG_SYNC
static int audio_disable;
static int video_disable;
static int wanted_audio_stream= 0;
+static int wanted_video_stream= 0;
static int seek_by_bytes;
static int display_disable;
static int show_status;
pict.linesize[0] = vp->bmp->pitches[0];
pict.linesize[1] = vp->bmp->pitches[2];
pict.linesize[2] = vp->bmp->pitches[1];
+ img_convert_ctx = sws_getCachedContext(img_convert_ctx,
+ 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) {
- 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);
- }
+ 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);
ret = -1;
goto fail;
}
- ic->pb.eof_reached= 0; //FIXME hack, ffplay maybe shouldnt use url_feof() to test for the end
+ ic->pb.eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
}
/* if seeking requested, we execute it */
audio_index = i;
break;
case CODEC_TYPE_VIDEO:
- if (video_index < 0 && !video_disable)
+ if ((video_index < 0 || wanted_video_stream-- > 0) && !video_disable)
video_index = i;
break;
default:
for(;;) {
if (is->abort_request)
break;
-#ifdef CONFIG_NETWORK
if (is->paused != is->last_paused) {
is->last_paused = is->paused;
if (is->paused)
else
av_read_play(ic);
}
+#ifdef CONFIG_RTSP_DEMUXER
if (is->paused && ic->iformat == &rtsp_demuxer) {
/* wait 10 ms to avoid trying to get another packet */
/* XXX: horrible */
is = av_mallocz(sizeof(VideoState));
if (!is)
return NULL;
- pstrcpy(is->filename, sizeof(is->filename), filename);
+ av_strlcpy(is->filename, filename, sizeof(is->filename));
is->iformat = iformat;
is->ytop = 0;
is->xleft = 0;
static void opt_frame_size(const char *arg)
{
- if (parse_image_size(&frame_width, &frame_height, arg) < 0) {
+ if (av_parse_video_frame_size(&frame_width, &frame_height, arg) < 0) {
fprintf(stderr, "Incorrect frame size\n");
exit(1);
}
{ "an", OPT_BOOL, {(void*)&audio_disable}, "disable audio" },
{ "vn", OPT_BOOL, {(void*)&video_disable}, "disable video" },
{ "ast", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_audio_stream}, "", "" },
+ { "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_video_stream}, "", "" },
{ "ss", HAS_ARG, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
{ "bytes", OPT_BOOL, {(void*)&seek_by_bytes}, "seek by bytes" },
{ "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
void show_help(void)
{
- printf("ffplay version " FFMPEG_VERSION ", Copyright (c) 2003-2006 Fabrice Bellard, et al.\n"
+ printf("ffplay version " FFMPEG_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard, et al.\n"
"usage: ffplay [options] input_file\n"
"Simple media player\n");
printf("\n");
/* register all codecs, demux and protocols */
av_register_all();
- #ifdef CONFIG_OS2
- MorphToPM(); // Morph the VIO application to a PM one to be able to use Win* functions
-
- // Make stdout and stderr unbuffered
- setbuf( stdout, NULL );
- setbuf( stderr, NULL );
- #endif
-
parse_options(argc, argv, options);
if (!input_filename)