[FFmpeg-devel] [PATCH] ffplay: fix logic for selecting the show mode in case of missing video

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon Apr 25 22:49:45 CEST 2011


On date Monday 2011-04-25 00:56:57 +0200, Stefano Sabatini encoded:
> Also automatically select the show mode only if not specified by the
> user.
> 
> Fix trac issue #109.
> ---
>  ffplay.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/ffplay.c b/ffplay.c
> index 063cf37..9f455ec 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -168,7 +168,7 @@ typedef struct VideoState {
>      AVAudioConvert *reformat_ctx;
>  
>      enum ShowMode {
> -        SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB
> +        SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB
>      } show_mode;
>      int16_t sample_array[SAMPLE_ARRAY_SIZE];
>      int sample_array_index;
> @@ -264,7 +264,7 @@ static int exit_on_keydown;
>  static int exit_on_mousedown;
>  static int loop=1;
>  static int framedrop=1;
> -static enum ShowMode show_mode = SHOW_MODE_VIDEO;
> +static enum ShowMode show_mode = SHOW_MODE_NONE;
>  
>  static int rdftspeed=20;
>  #if CONFIG_AVFILTER
> @@ -2471,10 +2471,8 @@ static int decode_thread(void *arg)
>          ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]);
>      }
>      is->refresh_tid = SDL_CreateThread(refresh_thread, is);
> -    if(ret<0) {
> -        if (!display_disable)
> -            is->show_mode = SHOW_MODE_RDFT;
> -    }
> +    if (is->show_mode == SHOW_MODE_NONE)
> +        is->show_mode = ret < 0 ? SHOW_MODE_RDFT : SHOW_MODE_VIDEO;
>  
>      if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) {
>          stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]);
> -- 
> 1.7.2.3

Pushed, blame me on cvs-log.
-- 
FFmpeg = Fancy and Fucking Mythic Purposeless Easy Gadget


More information about the ffmpeg-devel mailing list