uint8_t DIA_audioCodec( AUDIOENCODER *codec )
{

    uint8_t ret=0;
    AUDIOENCODER old=*codec;

    dialog=create_dialogAudioCodec();
//	gtk_transient(dialog);
    gtk_register_dialog(dialog);


    // now set the input one
    for(uint32_t i=0; i<sizeof(myCodecList)/sizeof(CODECLIST); i++)
        if(*codec==myCodecList[i].codec)
        {
            // set
            gtk_option_menu_set_history(GTK_OPTION_MENU(lookup_widget(dialog,"optionmenu_CodecList")), i);
        }
    if(gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_OK)
    {

        *codec=findCodec();
        ret=1;

    }
    else
    {
        *codec=old;
    }
    gtk_unregister_dialog(dialog);
    gtk_widget_destroy(dialog);

    return ret;
}
void okCallback(GtkButton * button, gpointer user_data)
{
    AUDIOENCODER cur;


    UNUSED_ARG(button);
    UNUSED_ARG(user_data);

    cur=findCodec();
    audioCodecSetcodec(cur);
    audioCodecConfigure();

}
Esempio n. 3
0
snd_stream_t *S_OpenStream( const char *filename, qboolean *delay )
{
	snd_decoder_t *decoder;
	char fn[MAX_QPATH];

	decoder = findCodec( filename );
	if( !decoder )
	{
		//Com_Printf( "No decoder found for file: %s\n", filename );
		return NULL;
	}

	Q_strncpyz( fn, filename, sizeof( fn ) );
	COM_DefaultExtension( fn, decoder->ext, sizeof( fn ) );

	return decoder->open( fn, delay );
}
Esempio n. 4
0
void *S_LoadSound( const char *filename, snd_info_t *info )
{
	snd_decoder_t *decoder;
	char fn[MAX_QPATH];

	decoder = findCodec( filename );
	if( !decoder )
	{
		//Com_Printf( "No decoder found for file: %s\n", filename );
		return NULL;
	}

	Q_strncpyz( fn, filename, sizeof( fn ) );
	COM_DefaultExtension( fn, decoder->ext, sizeof( fn ) );

	return decoder->load( fn, info );
}
Esempio n. 5
0
int GenericAudio::init()
{
	AVCodec* codec = avcodec_find_decoder(stream()->codec->codec_id);
	
	if(!codec)
		return error("Could not find decoder");
	
	if(avcodec_open2(stream()->codec, codec, 0) != 0)
		return error("Could not open decoder");
	
	// avcodec_find_decoder does not take sample_fmt into account,
	// so we have to find the decoder ourself...
	AVCodec* encoder = findCodec(
		stream()->codec->codec_id,
		stream()->codec->sample_fmt
	);
	
	if(!encoder)
		return error("Could not find encoder");
	
	outputStream()->disposition = stream()->disposition;
	av_dict_copy(&outputStream()->metadata, stream()->metadata, 0);
	
	outputStream()->codec = avcodec_alloc_context3(encoder);
	avcodec_copy_context(outputStream()->codec, stream()->codec);
	
	if(avcodec_open2(outputStream()->codec, encoder, 0) != 0)
		return error("Could not open encoder");
	
	// Allocate sample buffer
	m_cutout_buf = (int16_t*)av_malloc(BUFSIZE);
	m_cutin_buf = (int16_t*)av_malloc(BUFSIZE);
	if(!m_cutout_buf || !m_cutin_buf)
		return error("Could not allocate sample buffer");
	
	m_nc = cutList().nextCutPoint(0);
	m_cutout = m_nc->direction == CutPoint::IN;
	
	return 0;
}
Esempio n. 6
0
// load options file
void LoadOptions(char *filename)
{
    FILE *f;
    char section[64], line[1024], group[64], key[64],  *val;
    TexCodec *codec;
    TexTool *tool;
    int linenum, l;

    // parse file
    sprintf(line, "%s%s", progpath, filename);
    f = fopen(line, "r");
    if (!f)
    {
        Warning("LoadOptions: failed to open '%s' - %s!", filename, strerror(errno));
        return;
    }
    linenum = 0;
    strcpy(section, "GENERAL");
    while (fgets(line, sizeof(line), f) != NULL)
    {
        linenum++;

        // parse comment
        if (line[0] == ';' || line[0] == '#' || line[0] == '\n')
            continue;

        // parse group
        if (line[0] == '[')
        {
            val = strstr(line, "]");
            if (!val)
                Warning("%s:%i: bad group %s", filename, linenum, line);
            else
            {
                l = min(val - line - 1, sizeof(group) - 1);
                strncpy(group, line + 1, l);
                group[l] = 0;
                if (group[0] == '!')
                {
                    strncpy(section, group + 1, sizeof(section));
                    if (!strnicmp(section, "CODEC:", 6))
                    {
                        codec = findCodec(section + 6, true);
                        if (!codec)
                            Error("LoadOptions: unknown codec section [%s], please fix your config file\n", section);
                    }
                    if (!strnicmp(section, "TOOL:", 5))
                    {
                        tool = findTool(section + 5, true);
                        if (!tool)
                            Error("LoadOptions: unknown tool section [%s], please fix your config file\n", tool);
                    }
                    strcpy(group, "options");
                }
            }
            continue;
        }

        // key=value pair
        while(val = strstr(line, "\n")) val[0] = 0;
        val = strstr(line, "=");
        if (!val)
        {
            Warning("%s:%i: bad key pair '%s'", filename, linenum, line);
            continue;
        }
        l = min(val - line, sizeof(key) - 1);
        strncpy(key, line, l);
        key[l] = 0;
        val++;

        // parse
        if (!strcmp(section, "GENERAL"))
        {
            if (!stricmp(key, "waitforkey"))
                waitforkey = OptionBoolean(val, waitforkey);
            continue;
        }
        if (!strcmp(section, "TEXCOMPRESS"))
        {
            TexCompress_Option(section, group, key, val, filename, linenum);
            continue;
        }
        if (!strnicmp(section, "CODEC:", 6))
        {
            TexCompress_CodecOption(codec, group, key, val, filename, linenum);

            continue;
        }
        if (!strnicmp(section, "TOOL:", 5))
        {
            if (tool)
                TexCompress_ToolOption(tool, group, key, val, filename, linenum);
            continue;
        }
        Warning("%s:%i: unknown section '%s'", filename, linenum, section);
    }
    fclose(f);
}