Re: [MP3 ENCODER] TagItem issues...

2000-09-28 Thread David Balazic
Sigbjrn Skjret wrote: /* in my man page va_start has only one argument (ap) ... */ Your man-page is wrong then I think, the second argument is so that va_arg() knows where to start (ie, it makes ap point to the next argument). HP-UX 10.20 man varargs say that it has only one arg.

Re: [MP3 ENCODER] TagItem issues...

2000-09-28 Thread David Balazic
Frank Klemm wrote: :: /* Usage : :: lame_set_parameters(gfp, LAME_SAMP_FREQ__INT, 44100 , :: LAME_NR_CHANNELS__INT , 2 , :: LAME_LOW_PASS_VALUE__FLOAT , 16.050 , :: LAME_LOW_PASS_WIDTH__FLOAT , 0.75, :: LAME_COMMENT__STRING , "This is cool" ,

RE: [MP3 ENCODER] TagItem issues...

2000-09-28 Thread Mathew Hendry
-Original Message- From: David Balazic [mailto:[EMAIL PROTECTED]] Sigbjrn Skjret wrote: /* in my man page va_start has only one argument (ap) ... */ Your man-page is wrong then I think, the second argument is so that va_arg() knows where to start (ie, it makes ap point to

RE: [MP3 ENCODER] TagItem issues...

2000-09-28 Thread Robert Hegemann
Mathew Hendry schrieb am Don, 28 Sep 2000: From: Mathew Hendry varargs.h is pre-ANSI and non-standard - use stdarg.h for the standard stuff. Should be va_start(ap) Oops! I mean va_start(ap, lastarg) where ap is your va_list and lastarg is the last non-variadic

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Robert Hegemann
Mark Taylor schrieb am Die, 26 Sep 2000: I think we have to keep the old interface, since several applications use it. So lame_global_flags will still have to be instantiated by the calling program and exposed to the calling program. I dont think this is incompatiable with a shared library?

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Frank Klemm
:: Sigbjørn Skjæret schrieb am Die, 26 Sep 2000: ::Why do we need float at this point ?? :: :: Because several of the parsed arguments are floats? :: :: ie. frequencies could be passed in Hertz as ints, :: was just something to think about now while we :: change the API

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread David Balazic
Sigbjrn Skjret wrote: This way there is no need to parse any strings, we don't pass any pointers, the setup routine would just be a big switch/case. This is basically the way TagItems work when passed on stack, in fact, that combined with another identical function that does float

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Takehiro Tominaga
"R" == Robert Hegemann [EMAIL PROTECTED] writes: R Mark Taylor schrieb am Die, 26 Sep 2000: I think we have to keep the old interface, since several applications use it. So lame_global_flags will still have to be instantiated by the calling program and exposed to the

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Sigbjørn Skjæret
IIRC, if you use varargs then the compiler can't detect if the supplied parameters are of wrong type. Example : [...] The compiler won't notice that the parameter is of wrong type and when the function will try to extract an int from the stack, it will get garbage. This is indeed true, and

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Sigbjørn Skjæret
o main.c can't hold lame_global_flags, change lame_init() to allocate and return a pointer to lame_global_flags. o Move lame_global_flags out of lame.h, it should never be accessed externally. I think we have to keep the old interface, since several applications use it. So

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Sigbjørn Skjæret
and parsing gets abit more messy... How ? [...] This is how it looks now, better than using va_arg() at each case imho... void lame_set_int(lame_global_flags *gfp, lame_param_tag tag1, ...) { va_list ap; int param; /* (varargs promotes integrals to int) */ va_start(ap, tag1);

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Sigbjørn Skjæret
This is how it looks now, better than using va_arg() at each case imho... Why is it better ? You wasted an additional variable and gained ( maybe ) some code space by not doing a function call ( or maybe it is a macro , probably platform dependant ) every time. It's usually a (rather messy)

Re: [MP3 ENCODER] TagItem issues...

2000-09-27 Thread Frank Klemm
:: /* Usage : :: lame_set_parameters(gfp, LAME_SAMP_FREQ__INT, 44100 , :: LAME_NR_CHANNELS__INT , 2 , :: LAME_LOW_PASS_VALUE__FLOAT , 16.050 , :: LAME_LOW_PASS_WIDTH__FLOAT , 0.75, :: LAME_COMMENT__STRING , "This is cool" , :: LAME_END_MARKER); ::

Re: [MP3 ENCODER] TagItem issues...

2000-09-26 Thread Alexander Leidinger
On 25 Sep, Sigbjørn Skjæret wrote: simply making a new TagItems interface which allows you to specify the type of data the TagItem contains. This will be much better in the long run, and will allow the TagItems to contain any type of data. This sounds more complex than my proposed "void*"

Re: [MP3 ENCODER] TagItem issues...

2000-09-26 Thread Sigbjørn Skjæret
This sounds more complex than my proposed "void*" change. Keep in mind: More complex, but not that hard. "KISS". I'm not even gonna ask. ;) "Keep It Simple, Stupid". [...] Right, well, I believe that's exactly what it is now. ;) - CISC -- MP3 ENCODER mailing list (

Re: [MP3 ENCODER] TagItem issues...

2000-09-26 Thread Sigbjørn Skjæret
This way there is no need to parse any strings, we don't pass any pointers, the setup routine would just be a big switch/case. This is basically the way TagItems work when passed on stack, in fact, that combined with another identical function that does float we're pretty much set.

Re: [MP3 ENCODER] TagItem issues...

2000-09-26 Thread Robert Hegemann
Sigbjørn Skjæret schrieb am Die, 26 Sep 2000: Why do we need float at this point ?? Because several of the parsed arguments are floats? ie. frequencies could be passed in Hertz as ints, was just something to think about now while we change the API anyway Should

Re: [MP3 ENCODER] TagItem issues...

2000-09-26 Thread Sigbjørn Skjæret
Why do we need float at this point ?? Because several of the parsed arguments are floats? ie. frequencies could be passed in Hertz as ints, was just something to think about now while we change the API anyway Yes, but no reason not to have the possibility there. ;)

Re: [MP3 ENCODER] TagItem issues...

2000-09-26 Thread Mark Taylor
Should I start implementing this now, or wait after 3.87 release? Hi CISC, 3.87 was released last night. It's mostly just to have a last release before the code re-orginization that Takehiro is going to do this week. That will involve splitting the C code into a frontend and library

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Alexander Leidinger
On 24 Sep, Sigbjørn Skjæret wrote: 1.) Floats and doubles will lose all it's precision (this can be simply avoided by passing the string-pointer from arg-parsing and converting when parsing TagItems instead) What about passing the pointer to the float/double instead? Sure, but that

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Sigbjørn Skjæret
1.) Floats and doubles will lose all it's precision (this can be simply avoided by passing the string-pointer from arg-parsing and converting when parsing TagItems instead) What about passing the pointer to the float/double instead? Sure, but that means you will have to temporarily

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Robert Hegemann
I think we can make a very simple library setup stuff: proposal: int lame_open(); // allocates internal structures int lame_set_param( int handle, LameParameter Parameter, int Value ); // assigns Lame's parameter a value int lame_init_params( int

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Mark Taylor
The first proposal is IMHO enough for everyday use, the second is for architectures which didn't allow lossless transportation of information between a void* and an integer type (in case you use ti_data to contain the information instead of a pointer to the information). Only "problem" I

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Sigbjørn Skjæret
[...] This way there is no need to parse any strings, we don't pass any pointers, the setup routine would just be a big switch/case. This is basically the way TagItems work when passed on stack, in fact, that combined with another identical function that does float we're pretty much set. -

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Sigbjørn Skjæret
Why not something like: lame_set_float(char *variable_name, float val); lame_set_int(char *variable_name, int val); Hey, gr8, idea, and maybe another with void*? But this brings up another question: The code is going to do a lot of parsing, and it looks like each variable will require several

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Robert Hegemann
Sigbjørn Skjæret schrieb am Mon, 25 Sep 2000: [...] This way there is no need to parse any strings, we don't pass any pointers, the setup routine would just be a big switch/case. This is basically the way TagItems work when passed on stack, in fact, that combined with another identical

Re: [MP3 ENCODER] TagItem issues...

2000-09-25 Thread Frank Klemm
:: :: proposal: :: :: int lame_open(); :: // allocates internal structures :: :: int lame_set_param( int handle, LameParameter Parameter, int Value ); :: // assigns Lame's parameter a value :: a) Not every variable is an integer. C programmer try to store everything

Re: [MP3 ENCODER] TagItem issues...

2000-09-24 Thread Alexander Leidinger
On 23 Sep, Sigbjørn Skjæret wrote: Ok, after thinking about this for a while, and experimenting a little, I thought of a couple of issues with using TagItems to pass configuration settings in LAME... 1.) Floats and doubles will lose all it's precision (this can be simply avoided by

Re: [MP3 ENCODER] TagItem issues...

2000-09-24 Thread Sigbjørn Skjæret
1.) Floats and doubles will lose all it's precision (this can be simply avoided by passing the string-pointer from arg-parsing and converting when parsing TagItems instead) What about passing the pointer to the float/double instead? Sure, but that means you will have to temporarily

[MP3 ENCODER] TagItem issues...

2000-09-22 Thread Sigbjørn Skjæret
Ok, after thinking about this for a while, and experimenting a little, I thought of a couple of issues with using TagItems to pass configuration settings in LAME... 1.) Floats and doubles will lose all it's precision (this can be simply avoided by passing the string-pointer from arg-parsing