Commit a556c8b3 authored by Jack Moffitt's avatar Jack Moffitt

Commit changes for RC3 on behalf of Mike, since he is travelling.

svn path=/trunk/vorbis-tools/; revision=2640
parent 37b7a37d
......@@ -154,32 +154,36 @@ int oe_encode(oe_enc_opt *opt)
{
/* Do the main analysis, creating a packet */
vorbis_analysis(&vb, &op);
vorbis_analysis(&vb, NULL);
vorbis_bitrate_addblock(&vb);
/* Add packet to bitstream */
ogg_stream_packetin(&os,&op);
packetsdone++;
/* If we've gone over a page boundary, we can do actual output,
so do so (for however many pages are available) */
while(!eos)
while(vorbis_bitrate_flushpacket(&vd, &op))
{
int result = ogg_stream_pageout(&os,&og);
if(!result) break;
/* Add packet to bitstream */
ogg_stream_packetin(&os,&op);
packetsdone++;
/* If we've gone over a page boundary, we can do actual output,
so do so (for however many pages are available) */
ret = oe_write_page(&og, opt->out);
if(ret != og.header_len + og.body_len)
while(!eos)
{
opt->error("Failed writing data to output stream\n");
ret = 1;
goto cleanup; /* Bail */
int result = ogg_stream_pageout(&os,&og);
if(!result) break;
ret = oe_write_page(&og, opt->out);
if(ret != og.header_len + og.body_len)
{
opt->error("Failed writing data to output stream\n");
ret = 1;
goto cleanup; /* Bail */
}
else
bytes_written += ret;
if(ogg_page_eos(&og))
eos = 1;
}
else
bytes_written += ret;
if(ogg_page_eos(&og))
eos = 1;
}
}
}
......
......@@ -61,12 +61,15 @@ typedef struct
char *namefmt_remove;
char *namefmt_replace;
char *outfile;
/* All 3 in kbps */
int min_bitrate;
int nominal_bitrate;
int max_bitrate;
/* Float from 0 to 1 (low->high) */
float quality;
unsigned int serial;
} oe_options;
......@@ -87,6 +90,8 @@ typedef struct
int channels;
long rate;
int samplesize;
/* Various bitrate/quality options */
int bitrate;
int min_bitrate;
int max_bitrate;
......
......@@ -22,7 +22,7 @@
#include "audio.h"
#include "utf8.h"
#define VERSION_STRING "OggEnc v0.8 (libvorbis rc2)\n"
#define VERSION_STRING "OggEnc v0.9 (libvorbis rc3)\n"
#define COPYRIGHT "(c) 2001 Michael Smith <msmith@labyrinth.net.au)\n"
#define CHUNK 4096 /* We do reads, etc. in multiples of this */
......@@ -525,16 +525,31 @@ static void parse_options(int argc, char **argv, oe_options *opt)
opt->title[opt->title_count - 1] = strdup(optarg);
break;
case 'b':
opt->nominal_bitrate = atoi(optarg);
if(sscanf(optarg, "%d", &opt->nominal_bitrate)
!= 1) {
fprintf(stderr, "Warning: nominal bitrate \"%s\" not recognised\n", optarg);
opt->nominal_bitrate = -1;
}
break;
case 'm':
opt->min_bitrate = atoi(optarg);
if(sscanf(optarg, "%d", &opt->min_bitrate)
!= 1) {
fprintf(stderr, "Warning: minimum bitrate \"%s\" not recognised\n", optarg);
opt->min_bitrate = -1;
}
break;
case 'M':
opt->max_bitrate = atoi(optarg);
if(sscanf(optarg, "%d", &opt->max_bitrate)
!= 1) {
fprintf(stderr, "Warning: maximum bitrate \"%s\" not recognised\n", optarg);
opt->max_bitrate = -1;
}
break;
case 'q':
opt->quality = (float)(atof(optarg) * 0.1);
if(sscanf(optarg, "%f", &opt->quality) != 1) {
fprintf(stderr, "Quality option \"%s\" not recognised, ignoring\n", optarg);
break;
}
if(opt->quality > 1.0f)
{
opt->quality = 1.0f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment