[Libav-user] AVCodecTag tag

Gonzalo Garramuno ggarra13 at gmail.com
Tue May 7 16:10:09 CEST 2013


On 29/04/13 10:19, Steffen wrote:
> I want to provide a list of codesc that is supported by a file format. I try
> to iterate over the codec_tag element in avoutputformat . But this is
> impossible because it's private. What can I do?
>
>
>
> --
> View this message in context: http://libav-users.943685.n4.nabble.com/AVCodecTag-tag-tp4657434.html
> Sent from the libav-users mailing list archive at Nabble.com.
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

 From some I code I borrowed from ffmpeg.

static void ffmpeg_codecs(fltk::Browser& browser, int type)
   {
     using namespace std;

     AVCodec *p, *p2;
     const char* last_name;

     std::ostringstream o;
     last_name= "000";
     for(;;){
       int decode=0;
       int encode=0;
       int cap=0;
       const char *type_str;

       p2=NULL;

       for(p = av_codec_next(NULL); p; p = av_codec_next(p) ) {
     if((p2==NULL || strcmp(p->name, p2->name)<0) &&
        strcmp(p->name, last_name)>0){
       p2= p;
       decode= encode= cap=0;
     }
     if(p2 && strcmp(p->name, p2->name)==0){
       if(p->decode) decode=1;
       if(p->encode2) encode=1;
       cap |= p->capabilities;
     }
       }

       if(p2==NULL)
     break;
       last_name= p2->name;

       if ( p2->type != type )
     continue;

       switch(p2->type) {
       case AVMEDIA_TYPE_VIDEO:
     type_str = "V";
     break;
       case AVMEDIA_TYPE_AUDIO:
     type_str = "A";
     break;
       case AVMEDIA_TYPE_SUBTITLE:
     type_str = "S";
     break;
       default:
     type_str = "?";
     break;
       }

       std::ostringstream o;
       o << ( decode ? "D\t" : " \t" )
     << ( encode ? "E\t" : " \t" )
     << "\t"
     << ( cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S\t":" \t" )
     << ( cap & CODEC_CAP_DR1 ? "D\t":" \t" )
     << ( cap & CODEC_CAP_TRUNCATED ? "T\t":" \t" )
     << p2->name;

       browser.add( o.str().c_str() );



More information about the Libav-user mailing list