Ejemplo n.º 1
0
static gboolean
gst_two_lame_get_default_settings (void)
{
    twolame_options *glopts = NULL;

    glopts = twolame_init ();
    if (glopts == NULL) {
        GST_ERROR ("Couldn't initialize TwoLAME");
        return FALSE;
    }

    twolame_set_num_channels (glopts, 2);
    twolame_set_in_samplerate (glopts, 44100);

    if (twolame_init_params (glopts) != 0) {
        GST_ERROR ("Couldn't set default parameters");
        return FALSE;
    }

    gst_two_lame_default_settings.mode = TWOLAME_JOINT_STEREO;    /* twolame_get_mode (glopts); */
    gst_two_lame_default_settings.psymodel = twolame_get_psymodel (glopts);
    gst_two_lame_default_settings.bitrate = twolame_get_bitrate (glopts);
    gst_two_lame_default_settings.padding = twolame_get_padding (glopts);
    gst_two_lame_default_settings.energy_level_extension =
        twolame_get_energy_levels (glopts);
    gst_two_lame_default_settings.emphasis = twolame_get_emphasis (glopts);
    gst_two_lame_default_settings.error_protection =
        twolame_get_error_protection (glopts);
    gst_two_lame_default_settings.copyright = twolame_get_copyright (glopts);
    gst_two_lame_default_settings.original = twolame_get_original (glopts);
    gst_two_lame_default_settings.vbr = twolame_get_VBR (glopts);
    gst_two_lame_default_settings.vbr_level = twolame_get_VBR_level (glopts);
    gst_two_lame_default_settings.ath_level = twolame_get_ATH_level (glopts);
    gst_two_lame_default_settings.vbr_max_bitrate =
        twolame_get_VBR_max_bitrate_kbps (glopts);
    gst_two_lame_default_settings.quick_mode = twolame_get_quick_mode (glopts);
    gst_two_lame_default_settings.quick_mode_count =
        twolame_get_quick_count (glopts);

    twolame_close (&glopts);

    return TRUE;
}
Ejemplo n.º 2
0
// Print the library version and 
//  encoder parameter settings to STDERR
void twolame_print_config(twolame_options *glopts)
{
	FILE* fd = stderr;

    // Are we being silent ?
    if (glopts->verbosity<=0) return; 
    


	// Are we being brief ?
	if (glopts->verbosity==1) {
	
		fprintf(fd, "LibTwoLame version %s (%s)\n", get_twolame_version(), get_twolame_url());
		fprintf (fd, "Encoding as %dHz, ", twolame_get_out_samplerate(glopts));
		fprintf (fd, "%d kbps, ", twolame_get_bitrate(glopts) );
		if (twolame_get_VBR(glopts)) 	fprintf (fd, "VBR, " );
		else							fprintf (fd, "CBR, " );
		fprintf (fd, "%s Layer II\n", twolame_get_version_name(glopts));
		
	} else {
	
		fprintf (fd, "---------------------------------------------------------\n");
   		fprintf (fd, "LibTwoLame %s (%s)\n", get_twolame_version(), get_twolame_url());
		fprintf (fd, "Input : %d Hz, %d channels\n",
					twolame_get_in_samplerate(glopts),
					twolame_get_num_channels(glopts));
		fprintf (fd, "Output: %d Hz, %s\n",
					twolame_get_out_samplerate(glopts), 
					twolame_get_mode_name(glopts));
		fprintf (fd, "%d kbps ", twolame_get_bitrate(glopts) );
		if (twolame_get_VBR(glopts)) 	fprintf (fd, "VBR " );
		else							fprintf (fd, "CBR " );
		fprintf (fd, "%s Layer II ", twolame_get_version_name(glopts));
		fprintf (fd, "psycho model=%d \n", twolame_get_psymodel(glopts));
		
		fprintf (fd, "[De-emph:%s    Copyright:%s   Original:%s]\n",
		((twolame_get_emphasis(glopts)) ? "On " : "Off"),
		((twolame_get_copyright(glopts)) ? "Yes" : "No "),
		((twolame_get_original(glopts)) ? "Yes" : "No "));
		
		fprintf (fd, "[Padding:%s CRC:%s         DAB:%s     ]\n",
		((twolame_get_padding(glopts)) ? "Normal" : "Off   "),
		((twolame_get_error_protection(glopts)) ? "On " : "Off"),
		((twolame_get_DAB(glopts)) ? "On " : "Off")); 
		
		if (glopts->verbosity>=3) {
			if (twolame_get_VBR(glopts)) {
				fprintf (fd, " - VBR Enabled. Using MNR boost of %f\n", twolame_get_VBR_level(glopts));
				fprintf (fd, " - VBR bitrate index limits [%i -> %i]\n", glopts->lower_index, glopts->upper_index);
			}

			fprintf(fd," - ATH adjustment %f\n", twolame_get_ATH_level(glopts));
			fprintf(fd," - Reserving %i Ancillary bits\n", twolame_get_num_ancillary_bits(glopts));
			
			if (twolame_get_scale(glopts)!=1.0f)
				fprintf(fd," - Scaling audio by %f\n", twolame_get_scale(glopts));
			if (twolame_get_scale_left(glopts)!=1.0f)
				fprintf(fd," - Scaling left channel by %f\n", twolame_get_scale_left(glopts));
			if (twolame_get_scale_right(glopts)!=1.0f)
				fprintf(fd," - Scaling right channel by %f\n", twolame_get_scale_right(glopts));

			//if (glopts->num_channels_in == 2 && glopts->num_channels_out == 1 ) {
			//	fprintf(fd, " - Downmixing from stereo to mono.\n");
			//} else if (glopts->num_channels_in == 1 && glopts->num_channels_out == 2 ) {
			//	fprintf(fd, " - Upmixing from mono to stereo.\n");
			//}
		}
		
		fprintf (fd, "---------------------------------------------------------\n");
		
	}
}