AVCodecTag tag

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

AVCodecTag tag

Steffen
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?
Reply | Threaded
Open this post in threaded view
|

Re: AVCodecTag tag

Gonzalo Garramuño
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
> [hidden email]
> 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() );

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user