Esempio n. 1
0
static int
lame_version_print(FILE * const fp)
{
    const char *b = get_lame_os_bitness();
    const char *v = get_lame_version();
    const char *u = get_lame_url();
    const size_t lenb = strlen(b);
    const size_t lenv = strlen(v);
    const size_t lenu = strlen(u);
    const size_t lw = 80;       /* line width of terminal in characters */
    const size_t sw = 16;       /* static width of text */

    if (lw >= lenb + lenv + lenu + sw || lw < lenu + 2)
        /* text fits in 80 chars per line, or line even too small for url */
        if (lenb > 0)
            fprintf(fp, "LAME %s version %s (%s)\n\n", b, v, u);
        else
            fprintf(fp, "LAME version %s (%s)\n\n", v, u);
    else
        /* text too long, wrap url into next line, right aligned */
    if (lenb > 0)
        fprintf(fp, "LAME %s version %s\n%*s(%s)\n\n", b, v, lw - 2 - lenu, "", u);
    else
        fprintf(fp, "LAME version %s\n%*s(%s)\n\n", v, lw - 2 - lenu, "", u);

    if (LAME_ALPHA_VERSION)
        fprintf(fp, "warning: alpha versions should be used for testing only\n\n");


    return 0;
}
Esempio n. 2
0
void lame_print_version(FILE *ofile) {
  fprintf(ofile,"LAME version %s (www.sulaco.org/mp3) \n",get_lame_version());
  fprintf(ofile,"GPSYCHO: GPL psycho-acoustic and noise shaping model version %s. \n",get_psy_version());
#ifdef LIBSNDFILE
  fprintf(ofile,"Input handled by libsndfile (www.zip.com.au/~erikd/libsndfile)\n");
#endif
}
Esempio n. 3
0
long MP3_create(const char* format_parameters, amci_codec_fmt_info_t* format_description) {
  mp3_coder_state* coder_state;
  int ret_code;
  
  coder_state = malloc(sizeof(mp3_coder_state));
  if (!coder_state) {
    ERROR("no memory for allocating mp3 coder state\n");
    return -1;
  }
  
  DBG("MP3: creating lame %s\n", get_lame_version());
  format_description[0].id = 0; 
  coder_state->gfp = lame_init(); 
    
  if (!coder_state->gfp) {
    ERROR("initialiting lame\n");
    free(coder_state);
    return -1;
  }

  lame_set_errorf(coder_state->gfp, &no_output);
  lame_set_debugf(coder_state->gfp, &no_output);
  lame_set_msgf(coder_state->gfp, &no_output);
  
  lame_set_num_channels(coder_state->gfp,1);
  lame_set_in_samplerate(coder_state->gfp,8000);
  lame_set_brate(coder_state->gfp,16);
  lame_set_mode(coder_state->gfp,3); // mono
  lame_set_quality(coder_state->gfp,2);   /* 2=high  5 = medium  7=low */ 
  
  id3tag_init(coder_state->gfp);
  id3tag_set_title(coder_state->gfp, "mp3 voicemail by iptel.org");
  ret_code = lame_init_params(coder_state->gfp);
  
  if (ret_code < 0) {
    ERROR("lame encoder init failed: return code is %d\n", ret_code);
    free(coder_state);
    return -1;
  }
  

#ifdef WITH_MPG123DECODER
  coder_state->mpg123_h = mpg123_new(NULL, NULL);
  if (!coder_state->mpg123_h) {
    ERROR("initializing mpg123 decoder instance\n");
    return -1;
  }

  /* suppress output */
  mpg123_param(coder_state->mpg123_h, MPG123_FLAGS, MPG123_QUIET /* | MPG123_FORCE_MONO */,0);

/*   mpg123_param(coder_state->mpg123_h, MPG123_VERBOSE, 0, 0); */

#endif

  return (long)coder_state;
}
Esempio n. 4
0
OutLame::OutLame() 
  : OutChannel("lame") {
  func("OutLame::OutLame()");
  
  sprintf(name,"Lame MP3 encoder");
  sprintf(version,"version %s",get_lame_version());

  tipo = MP3;
  enc_flags = NULL;

}
Esempio n. 5
0
/* initialize the lame library */
static void mp3streamout_tilde_lame_init(t_mp3streamout *x)
{
    int    ret;
    x->lgfp = lame_init(); /* set default parameters for now */

#ifdef _WIN32
    /* load lame_enc.dll library */
    HINSTANCE dll;
    dll=LoadLibrary("lame_enc.dll");
    if(dll==NULL)
    {
        error("mp3streamout~: error loading lame_enc.dll");
        closesocket(x->x_fd);
        x->x_fd = -1;
        outlet_float(x->x_obj.ob_outlet, 0);
        post("mp3streamout~: connection closed");
        return;
    }
#endif
    {
        const char *lameVersion = get_lame_version();
        logpost(NULL, 4,  "mp3streamout~ : using lame version : %s", lameVersion );
    }

    /* setting lame parameters */
    lame_set_num_channels( x->lgfp, 2);
    lame_set_in_samplerate( x->lgfp, sys_getsr() );
    lame_set_out_samplerate( x->lgfp, x->x_samplerate );
    lame_set_brate( x->lgfp, x->x_bitrate );
    lame_set_mode( x->lgfp, x->x_mp3mode );
    lame_set_quality( x->lgfp, x->x_mp3quality );
    lame_set_emphasis( x->lgfp, 1 );
    lame_set_original( x->lgfp, 1 );
    lame_set_copyright( x->lgfp, 1 ); /* viva free music societies !!! */
    lame_set_disable_reservoir( x->lgfp, 0 );
    //lame_set_padding_type( x->lgfp, PAD_NO ); /* deprecated in LAME */
    ret = lame_init_params( x->lgfp );
    if ( ret<0 )
    {
        post( "mp3streamout~ : error : lame params initialization returned : %d", ret );
    }
    else
    {
        x->x_lame=1;
        /* magic formula copied from windows dll for MPEG-I */
        x->x_lamechunk = 2*1152;

        post( "mp3streamout~ : lame initialization done. (%d)", x->x_lame );
    }
    lame_init_bitstream( x->lgfp );
}
Esempio n. 6
0
static void
id3v2AddLameVersion(lame_internal_flags * gfc)
{
    char    buffer[1024];
    const char *b = get_lame_os_bitness();
    const char *v = get_lame_version();
    const char *u = get_lame_url();
    const size_t lenb = strlen(b);

    if (lenb > 0) {
        sprintf(buffer, "LAME %s version %s (%s)", b, v, u);
    }
    else {
        sprintf(buffer, "LAME version %s (%s)", v, u);
    }
    copyV1ToV2(gfc, ID_ENCODER, buffer);
}
Esempio n. 7
0
QStringList Version::dependencyVersions() {
    char sndfile_version[128];
    sf_command(nullptr, SFC_GET_LIB_VERSION, sndfile_version, sizeof(sndfile_version));
    // Null-terminate just in case.
    sndfile_version[sizeof(sndfile_version) - 1] = '\0';
    // WARNING: may be inaccurate since some come from compile-time header
    // definitions instead of the actual dynamically loaded library).
    QStringList result;
    result
            // Should be accurate.
            << QString("Qt: %1").arg(qVersion())
#ifdef __BROADCAST__
            // Should be accurate.
            << QString("libshout: %1").arg(shout_version(NULL, NULL, NULL))
#endif
            << QString("PortAudio: %1 %2").arg(Pa_GetVersion()).arg(Pa_GetVersionText())
            // The version of the RubberBand headers Mixxx was compiled with.
            << QString("RubberBand: %1").arg(RUBBERBAND_VERSION)
            // The version of the SoundTouch headers Mixxx was compiled with.
            << QString("SoundTouch: %1").arg(SOUNDTOUCH_VERSION)
            // The version of the TagLib headers Mixxx was compiled with.
            << QString("TagLib: %1.%2.%3").arg(QString::number(TAGLIB_MAJOR_VERSION),
                                               QString::number(TAGLIB_MINOR_VERSION),
                                               QString::number(TAGLIB_PATCH_VERSION))
            // The version of the ChromaPrint headers Mixxx was compiled with.
            << QString("ChromaPrint: %1.%2.%3").arg(QString::number(CHROMAPRINT_VERSION_MAJOR),
                                                    QString::number(CHROMAPRINT_VERSION_MINOR),
                                                    QString::number(CHROMAPRINT_VERSION_PATCH))
            // Should be accurate.
            << QString("Vorbis: %1").arg(vorbis_version_string())
            // Should be accurate.
            << QString("libsndfile: %1").arg(sndfile_version)
            // The version of the FLAC headers Mixxx was compiled with.
            << QString("FLAC: %1").arg(FLAC__VERSION_STRING)
            << QString("libmp3lame: %1").arg(get_lame_version());

    return result;
}
Esempio n. 8
0
int main () {
  printf("get_lame_version(): %s\n", get_lame_version());
  return 0;
}
Esempio n. 9
0
    /* initialize the lame library */
static int mp3write_tilde_lame_init(t_mp3write *x)
{
  time_t now;

    int    ret;
    x->lgfp = lame_init(); /* set default parameters for now */

#ifndef UNIX
    /* load lame_enc.dll library */
    HINSTANCE dll;
    dll=LoadLibrary("lame_enc.dll");
    if(dll==NULL)
    {
        error("mp3write~: error loading lame_enc.dll");
        closesocket(x->x_fd);
        x->x_fd = -1;
        post("mp3write~: connection closed");
        return -1;
    }
#endif
    {
       const char *lameVersion = get_lame_version();
       post( "mp3write~ : using lame version : %s", lameVersion );
    }

        /* setting lame parameters */
    lame_set_num_channels( x->lgfp, 2);
    lame_set_in_samplerate( x->lgfp, sys_getsr() );
    lame_set_out_samplerate( x->lgfp, x->x_samplerate );
    lame_set_brate( x->lgfp, x->x_bitrate );
    lame_set_mode( x->lgfp, x->x_mp3mode );
    lame_set_quality( x->lgfp, x->x_mp3quality );
    lame_set_emphasis( x->lgfp, 1 );
    lame_set_original( x->lgfp, 1 );
    lame_set_copyright( x->lgfp, 1 ); /* viva free music societies !!! */
    lame_set_disable_reservoir( x->lgfp, 0 );
    lame_set_padding_type( x->lgfp, PAD_NO );
    ret = lame_init_params( x->lgfp );
    if ( ret<0 ) {
       post( "mp3write~ : error : lame params initialization returned : %d", ret );
       return -1;
    } else {
       x->x_lame=1;
       /* magic formula copied from windows dll for MPEG-I */
       x->x_lamechunk = 2*1152;

       post( "mp3write~ : lame initialization done. (%d)", x->x_lame );
    }
    lame_init_bitstream( x->lgfp );

    /* setting tag information */
    id3tag_init(x->lgfp);
    id3tag_v1_only(x->lgfp);
    id3tag_space_v1(x->lgfp);
    id3tag_set_artist(x->lgfp, "Pd Session");
    now=time(NULL);
    sprintf( x->x_title, "Started at %s", ctime(&now) );
    id3tag_set_title(x->lgfp, x->x_title );
    
    return 0;

}
Esempio n. 10
0
void lame_version(lame_global_flags *gfp,char *ostring) {
  strncpy(ostring,get_lame_version(),20);
}
jstring Java_mobi_cangol_mobile_utils_LameUtils_getVersion(JNIEnv *env, jobject instance) {

	return (*env)->NewStringUTF(env, get_lame_version());
}
Esempio n. 12
0
encoder_funcs_t* init_lame( output_format_t* format, int channels, int bitrate )
{
  encoder_funcs_t* funcs = NULL;

  lame_opts = lame_init();
  if (lame_opts==NULL) {
    rotter_error("lame error: failed to initialise.");
    return NULL;
  }

  if ( 0 > lame_set_num_channels( lame_opts, channels ) ) {
    rotter_error("lame error: failed to set number of channels.");
    return NULL;
  }

  if ( 0 > lame_set_in_samplerate( lame_opts, jack_get_sample_rate( client ) )) {
    rotter_error("lame error: failed to set input samplerate.");
    return NULL;
  }

  if ( 0 > lame_set_out_samplerate( lame_opts, jack_get_sample_rate( client ) )) {
    rotter_error("lame error: failed to set output samplerate.");
    return NULL;
  }

  if ( 0 > lame_set_brate( lame_opts, bitrate) ) {
    rotter_error("lame error: failed to set bitrate.");
    return NULL;
  }

  if ( 0 > lame_init_params( lame_opts ) ) {
    rotter_error("lame error: failed to initialize parameters.");
    return NULL;
  }


  rotter_info( "Encoding using liblame version %s.", get_lame_version() );
  rotter_debug( "  Input: %d Hz, %d channels",
            lame_get_in_samplerate(lame_opts),
            lame_get_num_channels(lame_opts));
  rotter_debug( "  Output: %s Layer 3, %d kbps, %s",
            lame_get_version_name(lame_opts),
            lame_get_brate(lame_opts),
            lame_get_mode_name(lame_opts));

  // Allocate memory for encoded audio
  mpeg_buffer = malloc( 1.25*SAMPLES_PER_FRAME + 7200 );
  if ( mpeg_buffer==NULL ) {
    rotter_error( "Failed to allocate memery for encoded audio." );
    return NULL;
  }

  // Allocate memory for callback functions
  funcs = calloc( 1, sizeof(encoder_funcs_t) );
  if ( funcs==NULL ) {
    rotter_error( "Failed to allocate memery for encoder callback functions structure." );
    return NULL;
  }


  funcs->file_suffix = "mp3";
  funcs->open = open_mpegaudio_file;
  funcs->close = close_mpegaudio_file;
  funcs->write = write_lame;
  funcs->deinit = deinit_lame;


  return funcs;
}