]> git.sesse.net Git - ffmpeg/blobdiff - ffplay.c
remove now useless vars
[ffmpeg] / ffplay.c
index 7d983515d9618b79c88420b6bf17098975aede18..9af066e9ed073793636aacee52ba26b2c4d765a5 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
 #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
@@ -197,6 +180,7 @@ static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
 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;
@@ -1268,15 +1252,14 @@ 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_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);
@@ -1965,7 +1948,7 @@ static int decode_thread(void *arg)
                 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:
@@ -2466,6 +2449,7 @@ const OptionDef options[] = {
     { "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" },
@@ -2533,14 +2517,6 @@ int main(int argc, char **argv)
     /* 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)