[vorbis] Using vorbisfile with an in-memory file instead of FILE*

Olaf van der Spek Olaf at XCC.TMFWeb.NL
Thu Dec 28 09:40:46 PST 2000



----- Original Message -----
From: "Michael Smith" <msmith at labyrinth.net.au>
To: <vorbis at xiph.org>
Sent: Thursday, December 28, 2000 4:23 PM
Subject: Re: [vorbis] Using vorbisfile with an in-memory file instead of
FILE*

>
> >> Those should work, but aren't a complete solution. You still need to
write
> >> the callbacks (although if you have the ENTIRE file in memory before
the
> >> open call, the callbacks can just return appropriate errors).
> >>
> >
> >I assume it should always indicate success for a close, or does it need
to
> >generate an error when close is called multiple times?
>
> The 'correct' answer is - it should do whatever stdio does on a real file
> if you do the equivalent. The reality is that it won't call close multiple
> times, so it doesn't matter. For your case, yes - just returning success
is
> sufficient, unless you want it to do other cleanup (like freeing the
> allocated memory, etc.)

Freeing memory isn't necessary at that place.
Should errno also be set in the callbacks if necessary?

>
> >
> >> The callbacks follow the prototypes (more or less - the seek function
uses
> >> a 64 bit offset, and they all use void pointers instead of FILE
pointers)
> >> for fread, ftell, fseek, and fclose. They also follow the return
> >semantics.
> >
> >Why exactly is a 64 bit offset used?
> >32 bit (signed) seems enough for more then one year music at 128 kbit/s.
> >And tell if still 32 bit.
>
> The offset is relevent at the ogg layer rather than at the vorbis layer.
> ogg is designed for more than just audio - a video codec is a future
> project, for instance. In that case, 32 bits certainly isn't enough. As a
> result, ogg really needs more than 32 bit offsets, so the external API
> exposes this (even though, for vorbis, it's not terribly neccesary).

Ok, that makes sense.
>
> If it's a problem, just using 32 bit offsets will work fine (casting them
> to 64 bits as appropriate, of course) - that's what the standard stdio
> calls do.

But then why doesn't the tell function use a 64 bit ofset as result?
>
> >
> >One small question:
> >When will the oggenc support mono?
>
> beta2, I think (yes, that was ages ago).

> OggEnc input files must currently be 44.1kHz, 16 bit stereo WAV files.

Maybe that usage should be updated then?

>
> >When will it support 22050 hz?
>
> beta3 (i.e. the current beta)

Same as above.
It seemed I had version 0.4 instead of 0.5, now it works, thanks.

> The default is the 160 kbps mode.  Lower sampling rates work properly,\n"
  " but don't scale the bitrate; -b 112 on a stereo 22kHz file will produce
a\n"
  " ~70kbps file, not 112kbps.)\n");
}

They seem to scale, but not in a lineair fashon. How exactly do they scale?

>
> >If the answer is beta 4, when can beta 4 be expected?
>
> It isn't the answer, but it should be roughly mid-january (hopefully).
> Mono works fully (and has for ages). Sample rates other than 44.1kHz work,
> but aren't completely optimised (i.e. although everything works, sound
> quality will be lower than vorbis is capable of). Try it and see.
>
Ok

oggenc -h dump:
OggEnc v0.5 (libvorbis beta3)
(c) 2000 Michael Smith <msmith at labyrinth.net.au)

Usage: oggenc [options] input.wav [...]

OPTIONS:
 General:
 -q, --quiet          Produce no output to stderr
 -h, --help           Print this help text
 -r, --raw            Raw mode. Input files are read directly as PCM data
 -b, --bitrate        Choose a bitrate to encode at. Internally,
                      a mode approximating this value is chosen.
                      Takes an argument in kbps. Default is 160kbps

 Naming:
 -o, --output=fn      Write file to fn (only valid in single-file mode)
 -n, --names=string   Produce filenames as this string, with %a, %t, %l,
                      %n, %d replaces by artist, title, album, track number,
                      and date, respectively (see below for specifying
these).
                      %% gives a literal %.
 -c, --comment=c      Add the given string as an extra comment. This may be
                      used multiple times.
 -d, --date           Date for track (usually date of performance)
 -N, --tracknum       Track number for this track
 -t, --title          Title for this track
 -l, --album          Name of album
 -a, --artist         Name of artist
                      If multiple input files are given, then multiple
                      instances of the previous five arguments will be used,
                      in the order they are given. If fewer titles are
                      specified than files, OggEnc will print a warning, and
                      reuse the final one for the remaining files. If fewer
                      track numbers are given, the remaining files will be
                      unnumbered. For the others, the final tag will be
reused
                      for all others without warning (so you can specify a
date
                      once, for example, and have it used for all the files)

INPUT FILES:
 OggEnc input files must currently be 44.1kHz, 16 bit stereo WAV files.
 You can specify taking the file from stdin by using - as the input
filename.
 Alternatively, the --raw option may be used to use a raw PCM data file,
with
 the same restrictions as above.
 In this mode, output is to stdout unless an outfile filename is specified
 with -o

MODES:
 OggEnc currently supports 5 different modes. Each of these is a fully VBR
 (variable bitrate) mode, but they vary in intended average bitrate. The
 bitrate option (--bitrate, -b) will choose the mode closest to the chosen
 bitrate. The 5 modes are approximately 128,160,192,256, and 350 kbps (for
 stereo input. Halve these numbers for mono input).
 The default is the 160 kbps mode.

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis mailing list