Thread: How do i make that the function will show me all the types of codecs there is ?

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    1

    How do i make that the function will show me all the types of codecs there is ?

    In C i have:

    Code:
    constchar*Encoder_av_get_media_type_string(enumAVMediaType media_type){switch(media_type){case AVMEDIA_TYPE_VIDEO:return"video";case AVMEDIA_TYPE_AUDIO:return"audio";case AVMEDIA_TYPE_DATA:return"data";case AVMEDIA_TYPE_SUBTITLE:return"subtitle";case AVMEDIA_TYPE_ATTACHMENT:return"attachment";default:return NULL;}}
    
    Then in the header file which connect between the C and the CLI i have:

    Code:
    constchar*Encoder_av_get_media_type_string(enumAVMediaType media_type);
    
    Then in the CLI i have:

    Code:
    property List<String^>^GetCodec{List<String^>^get(){List<String^>^l = gcnew List<String^>;String^s;        s = gcnew String(Encoder_av_get_media_type_string(avm));        l->Add(s);return l;}}
    
    Then in CSHARP:

    Code:
    List<string> ss =newList<string>();for(int i =0; i < f.GetCodec.Count; i++){                ss.Add(f.GetCodec[i]);}
    
    But in the end also in CLI and also in CSHARP i'm getting one type i see in CSHARP that the variable ss contain only "video" i want it to contain all the other 6 types too.

    How can i do it ?


    Later i have edited my question so i think this edited part is the one i need solution for:

    I changed the type of the function in the cli to List<String^> type:

    Code:
    List<String^>^GetCodecsTypes(){List<String^>^l = gcnew List<String^>;String^s;        s = gcnew String(Encoder_av_get_media_type_string();return l;}
    
    I'm not sure what i should put in the () of the: Encoder_GetCurrentCodecName()
    It should get: AVMediaType media_type
    Then in Csharp this is my button1 click event code:

    Code:
    privatevoid button1_Click(object sender,EventArgs e){            f =newFFMPEGWrapper();List<FFMPEGWrapper> l = f.GetCodecs();var video_codecs = l.Where(w => w.CodecType==0);var audio_codecs = l.Where(w => w.CodecType==1);List<string> names =new[]{"***Video Codecs***"}.Concat(video_codecs.Select(w => w.CodecName)).Concat(new[]{"***Audio Codecs***"}).Concat(audio_codecs.Select(w => w.CodecName)).ToList();
    
    So i want to use it like: List<String> s = f.GetCodecsTypes();
    But i dont know how to make it right in the CLI file and in the C file.
    In the C file i didn;t change anything it's still as it was before:

    Code:
    constchar*Encoder_av_get_media_type_string(enumAVMediaType media_type){switch(media_type){case AVMEDIA_TYPE_VIDEO:return"video";case AVMEDIA_TYPE_AUDIO:return"audio";case AVMEDIA_TYPE_DATA:return"data";case AVMEDIA_TYPE_SUBTITLE:return"subtitle";case AVMEDIA_TYPE_ATTACHMENT:return"attachment";default:return NULL;}}
    
    In the end in Csharp i want that the variable s will contain all the types names.
    And maybe if it's possible i wanted to do it in the CLI or even in the C file that it will return all the types names without doing it manualy like it is now in C to return each type but to return a List of all the types to csharp.
    But first i don't know yet how to send it in the first time all the types names to Csharp.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I can't make bmp image files show up in an SDL window
    By Lucas89 in forum Game Programming
    Replies: 5
    Last Post: 05-25-2009, 01:04 PM
  2. Make a dialog show up
    By guitarist809 in forum Windows Programming
    Replies: 4
    Last Post: 05-04-2008, 01:08 AM
  3. Question that might show me up (return types!)
    By echorev in forum C# Programming
    Replies: 2
    Last Post: 11-20-2006, 08:33 AM
  4. Replies: 19
    Last Post: 08-15-2005, 06:02 AM
  5. Replies: 1
    Last Post: 03-12-2002, 06:31 AM

Tags for this Thread