[MPlayer-dev-eng] [PATCH] vd_null to output black frames

Alexander Strasser eclipse7 at gmx.net
Sat Nov 3 13:25:03 CET 2012


Xidorn Quan wrote:
> On Sat, Nov 3, 2012 at 9:20 AM, Alexander Strasser wrote:
> > Alexander Strasser wrote:
> > >   I also like Xidorn's idea of never choosing the decoder because it
> > > is flagged "dummy" and having the status set to "working" again for
> > > null and black. It would eliminate the misuse of the status property.
> > >
> > >   Reimar, what do you think?
> >
> >   Attached is a *not* very well tested RFC patch to implement the
> > behavior Xidorn described above. It must be applied incrementally
> > on top of Xidorn's patch.
> >
> >   I am unsure if this change of behavior has any additional (high
> > level) consequences I am not aware of.
> 
> 
> Well, in fact I have implemented this behavior in my local repo, and
> just forgot to send the patch.
> 
> The patch attached includes my prevous patch, and it implements the
> behavior in a different way. I think it should be more safe to keep
> changes inside codec-cfg instead of modifying both dec_audio and
> dec_video.

  I share your opinion that having it in a single place in codec-cfg
feels safer.

  Let me explain why I changed it in dec_audio/video. I fear if we
go with your solution e.g. "-vc null" would not work anymore. But
I might have missed something. The code regarding codec selection
and codecs.conf is tricky to say the least.

  So if I am right and we need to use "-vc +null" with your solution,
than that should definitely be discussed further and will need more
changes regarding documentation.

  Alexander

> Index: codec-cfg.c
> ===================================================================
> --- codec-cfg.c	(revision 35336)
> +++ codec-cfg.c	(working copy)
> @@ -752,6 +752,9 @@
>              if (!strcmp(token[0], "align16"))
>                  codec->flags |= CODECS_FLAG_ALIGN16;
>              else
> +            if (!strcmp(token[0], "dummy"))
> +                codec->flags |= CODECS_FLAG_DUMMY;
> +            else
>                  goto err_out_parse_error;
>          } else if (!strcmp(token[0], "status")) {
>              if (get_token(1, 1) < 0)
> @@ -869,9 +872,10 @@
>          if(!i) return NULL;
>          for (/* NOTHING */; i--; c++) {
>              if(start && c<=start) continue;
> +            if (!force && c->flags & CODECS_FLAG_DUMMY)
> +                continue;
>              for (j = 0; j < CODECS_MAX_FOURCC; j++) {
> -                // FIXME: do NOT hardwire 'null' and 'black' here:
> -                if (c->fourcc[j]==fourcc || !strcmp(c->drv,"null") || !strcmp(c->drv,"black")) {
> +                if (c->fourcc[j]==fourcc || c->flags & CODECS_FLAG_DUMMY) {
>                      if (fourccmap)
>                          *fourccmap = c->fourccmap[j];
>                      return c;
> Index: codec-cfg.h
> ===================================================================
> --- codec-cfg.h	(revision 35336)
> +++ codec-cfg.h	(working copy)
> @@ -26,6 +26,7 @@
>  // Global flags:
>  #define CODECS_FLAG_SEEKABLE    (1<<0)
>  #define CODECS_FLAG_ALIGN16     (1<<1)
> +#define CODECS_FLAG_DUMMY       (1<<2)
>  
>  // Outfmt flags:
>  #define CODECS_FLAG_FLIP        (1<<0)
> Index: etc/codecs.conf
> ===================================================================
> --- etc/codecs.conf	(revision 35337)
> +++ etc/codecs.conf	(working copy)
> @@ -4215,9 +4215,10 @@
>  
>  videocodec null
>    info "NULL codec (no decoding!)"
> -  status crashing
> +  status working
>    comment "for unknown/unsupported codecs or testing"
>    driver null
> +  flags dummy
>    out YV12
>    out I420
>    out YUY2
> @@ -4227,9 +4228,10 @@
>  
>  videocodec black
>    info "black codec (no decoding just output black frames!)"
> -  status crashing
> +  status working
>    comment "for unknown/unsupported codecs or testing"
>    driver black
> +  flags dummy
>    out YV12
>    out I420
>    out YUY2


More information about the MPlayer-dev-eng mailing list