Exemplo n.º 1
0
OMX_BOOL AudioDecoder::AudioDecSetConext(sh_audio_t *sh){
    if(shContext)
    {				    
	memcpy(shContext,sh,sizeof(sh_audio_t));
	if(shContext->format == 0)
	    shContext->format = shContext->wf->wFormatTag;
	
	if(shContext->format != 0)
	{
	    if(shContext->format == 0)
		shContext->format = shContext->wf->wFormatTag;
	    
	    if(shContext->format != 0)
	    {
		parse_codec_cfg(NULL);
		
		if(FindAudioCodec(shContext))
		{
		    sh->i_bps=shContext->i_bps;
		    return OMX_TRUE;
		}else{
                    ALOGE("Error: No AudioCodec found!!!");

		    return OMX_FALSE;
		}
	    }else
	    {
		ALOGE("Error: sh format is 0!!!");

		return OMX_FALSE;
	    }
	}
    }

    return OMX_FALSE;
}
Exemplo n.º 2
0
int main(void)
{
    codecs_t *c;
    int i,j, nr_codecs, state;

    if (!(parse_codec_cfg("etc/codecs.conf")))
        return 0;
    if (!video_codecs)
        printf("no videoconfig.\n");
    if (!audio_codecs)
        printf("no audioconfig.\n");

    printf("videocodecs:\n");
    c = video_codecs;
    nr_codecs = nr_vcodecs;
    state = 0;
next:
    if (c) {
        printf("number of %scodecs: %d\n", state==0?"video":"audio",
               nr_codecs);
        for(i=0;i<nr_codecs;i++, c++){
            printf("\n============== %scodec %02d ===============\n",
                   state==0?"video":"audio",i);
            printf("name='%s'\n",c->name);
            printf("info='%s'\n",c->info);
            printf("comment='%s'\n",c->comment);
            printf("dll='%s'\n",c->dll);
            /* printf("flags=%X  driver=%d status=%d cpuflags=%d\n",
                      c->flags, c->driver, c->status, c->cpuflags); */
            printf("flags=%X status=%d cpuflags=%d\n",
                   c->flags, c->status, c->cpuflags);

            for(j=0;j<CODECS_MAX_FOURCC;j++){
                if(c->fourcc[j]!=0xFFFFFFFF){
                    printf("fourcc %02d:  %08X (%.4s) ===> %08X (%.4s)\n",j,c->fourcc[j],(char *) &c->fourcc[j],c->fourccmap[j],(char *) &c->fourccmap[j]);
                }
            }

            for(j=0;j<CODECS_MAX_OUTFMT;j++){
                if(c->outfmt[j]!=0xFFFFFFFF){
                    printf("outfmt %02d:  %08X (%.4s)  flags: %d\n",j,c->outfmt[j],(char *) &c->outfmt[j],c->outflags[j]);
                }
            }

            for(j=0;j<CODECS_MAX_INFMT;j++){
                if(c->infmt[j]!=0xFFFFFFFF){
                    printf("infmt %02d:  %08X (%.4s)  flags: %d\n",j,c->infmt[j],(char *) &c->infmt[j],c->inflags[j]);
                }
            }

            printf("GUID: %08lX %04X %04X",c->guid.f1,c->guid.f2,c->guid.f3);
            for(j=0;j<8;j++) printf(" %02X",c->guid.f4[j]);
            printf("\n");


        }
    }
    if (!state) {
        printf("audiocodecs:\n");
        c = audio_codecs;
        nr_codecs = nr_acodecs;
        state = 1;
        goto next;
    }
    return 0;
}
Exemplo n.º 3
0
int main(int argc, char* argv[])
{
    codecs_t *cl;
    FILE *f1;
    FILE *f2;
    int c,d,i;
    int pos;
    int section=-1;
    int nr_codecs;
    int win32=-1;
    int dshow=-1;
    int win32ex=-1;

    /*
     * Take path to codecs.conf from command line, or fall back on
     * etc/codecs.conf
     */
    if (!(nr_codecs = parse_codec_cfg((argc>1)?argv[1]:"etc/codecs.conf")))
        exit(1);
    if (codecs_conf_release < CODEC_CFG_MIN)
        exit(1);

    if (argc > 1) {
        int i, j;
        const char* nm[2];
        codecs_t* cod[2];
        int nr[2];

        nm[0] = "builtin_video_codecs";
        cod[0] = video_codecs;
        nr[0] = nr_vcodecs;

        nm[1] = "builtin_audio_codecs";
        cod[1] = audio_codecs;
        nr[1] = nr_acodecs;

        printf("/* GENERATED FROM %s, DO NOT EDIT! */\n\n",argv[1]);
        printf("#include <stddef.h>\n");
        printf("#include \"codec-cfg.h\"\n\n");
        printf("#define CODEC_CFG_MIN %i\n\n", codecs_conf_release);

        for (i=0; i<2; i++) {
            printf("const codecs_t %s[] = {\n", nm[i]);
            for (j = 0; j < nr[i]; j++) {
                printf("{");

                print_int_array(cod[i][j].fourcc, CODECS_MAX_FOURCC);
                printf(", /* fourcc */\n");

                print_int_array(cod[i][j].fourccmap, CODECS_MAX_FOURCC);
                printf(", /* fourccmap */\n");

                print_int_array(cod[i][j].outfmt, CODECS_MAX_OUTFMT);
                printf(", /* outfmt */\n");

                print_char_array(cod[i][j].outflags, CODECS_MAX_OUTFMT);
                printf(", /* outflags */\n");

                print_int_array(cod[i][j].infmt, CODECS_MAX_INFMT);
                printf(", /* infmt */\n");

                print_char_array(cod[i][j].inflags, CODECS_MAX_INFMT);
                printf(", /* inflags */\n");

                print_string(cod[i][j].name);    printf(", /* name */\n");
                print_string(cod[i][j].info);    printf(", /* info */\n");
                print_string(cod[i][j].comment); printf(", /* comment */\n");
                print_string(cod[i][j].dll);     printf(", /* dll */\n");
                print_string(cod[i][j].drv);     printf(", /* drv */\n");

                printf("{ 0x%08lx, %hu, %hu,",
                       cod[i][j].guid.f1,
                       cod[i][j].guid.f2,
                       cod[i][j].guid.f3);
                print_char_array(cod[i][j].guid.f4, sizeof(cod[i][j].guid.f4));
                printf(" }, /* GUID */\n");
                printf("%hd /* flags */, %hd /* status */, %hd /* cpuflags */ }\n",
                       cod[i][j].flags,
                       cod[i][j].status,
                       cod[i][j].cpuflags);
                if (j < nr[i]) printf(",\n");
            }
            printf("};\n\n");
        }
        exit(0);
    }

    f1=fopen("DOCS/tech/codecs-in.html","rb"); if(!f1) exit(1);
    f2=fopen("DOCS/codecs-status.html","wb"); if(!f2) exit(1);

    while((c=fgetc(f1))>=0){
        if(c!='%'){
            fputc(c,f2);
            continue;
        }
        d=fgetc(f1);
        if(d>='0' && d<='9'){
            // begin section
            section=d-'0';
            //printf("BEGIN %d\n",section);
            if(section>=5){
                // audio
                cl = audio_codecs;
                nr_codecs = nr_acodecs;
                dshow=7;win32=4;
            } else {
                // video
                cl = video_codecs;
                nr_codecs = nr_vcodecs;
                dshow=4;win32=2;win32ex=6;
            }
            pos=ftell(f1);
            for(i=0;i<nr_codecs;i++){
                fseek(f1,pos,SEEK_SET);
                switch(section){
                case 0:
                case 5:
                    if(cl[i].status==CODECS_STATUS_WORKING)
//                if(!(!strcmp(cl[i].drv,"vfw") || !strcmp(cl[i].drv,"dshow") || !strcmp(cl[i].drv,"vfwex") || !strcmp(cl[i].drv,"acm")))
                        parsehtml(f1,f2,&cl[i]);
                    break;
#if 0
                case 1:
                case 6:
                    if(cl[i].status==CODECS_STATUS_WORKING)
                        if((!strcmp(cl[i].drv,"vfw") || !strcmp(cl[i].drv,"dshow") || !strcmp(cl[i].drv,"vfwex") || !strcmp(cl[i].drv,"acm")))
                            parsehtml(f1,f2,&cl[i]);
                    break;
#endif
                case 2:
                case 7:
                    if(cl[i].status==CODECS_STATUS_PROBLEMS)
                        parsehtml(f1,f2,&cl[i]);
                    break;
                case 3:
                case 8:
                    if(cl[i].status==CODECS_STATUS_NOT_WORKING)
                        parsehtml(f1,f2,&cl[i]);
                    break;
                case 4:
                case 9:
                    if(cl[i].status==CODECS_STATUS_UNTESTED)
                        parsehtml(f1,f2,&cl[i]);
                    break;
                default:
                    printf("Warning! unimplemented section: %d\n",section);
                }
            }
            fseek(f1,pos,SEEK_SET);
            skiphtml(f1);

            continue;
        }
        fputc(c,f2);
        fputc(d,f2);
    }

    fclose(f2);
    fclose(f1);
    return 0;
}
Exemplo n.º 4
0
/**
 * Initialization code to be run after command-line parsing.
 */
int common_init(void)
{
#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
    set_path_env();
#endif
    sanitize_os();

#ifdef CONFIG_PRIORITY
    set_priority();
#endif

    if (codec_path)
        set_codec_path(codec_path);

    /* Check codecs.conf. */
    if (!codecs_file || !parse_codec_cfg(codecs_file)) {
        char *conf_path = get_path("codecs.conf");
        if (!parse_codec_cfg(conf_path)) {
            if (!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")) {
                if (!parse_codec_cfg(NULL)) {
                    free(conf_path);
                    return 0;
                }
                mp_msg(MSGT_CPLAYER,MSGL_V,MSGTR_BuiltinCodecsConf);
            }
        }
        free(conf_path);
    }

    // check font
#ifdef CONFIG_FREETYPE
    init_freetype();
#endif
#ifdef CONFIG_FONTCONFIG
    if (font_fontconfig <= 0)
#endif
    {
#ifdef CONFIG_BITMAP_FONT
        if (font_name) {
            vo_font = read_font_desc(font_name, font_factor, verbose>1);
            if (!vo_font)
                mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,
                       filename_recode(font_name));
        } else {
            // try default:
            char *desc_path = get_path("font/font.desc");
            vo_font = read_font_desc(desc_path, font_factor, verbose>1);
            free(desc_path);
            if (!vo_font)
                vo_font = read_font_desc(MPLAYER_DATADIR "/font/font.desc", font_factor, verbose>1);
        }
        if (sub_font_name)
            sub_font = read_font_desc(sub_font_name, font_factor, verbose>1);
        else
            sub_font = vo_font;
#endif
    }

    vo_init_osd();

#ifdef CONFIG_ASS
    ass_library = ass_init();
#endif
    return 1;
}