First example and test of private codec parameters.
Originally committed as revision 25258 to svn://svn.ffmpeg.org/ffmpeg/trunk
#include <vorbis/vorbisenc.h>
#include <vorbis/vorbisenc.h>
+#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "vorbis.h"
#include "avcodec.h"
#include "bytestream.h"
#include "vorbis.h"
#define BUFFER_SIZE (1024*64)
typedef struct OggVorbisContext {
#define BUFFER_SIZE (1024*64)
typedef struct OggVorbisContext {
vorbis_info vi ;
vorbis_dsp_state vd ;
vorbis_block vb ;
vorbis_info vi ;
vorbis_dsp_state vd ;
vorbis_block vb ;
/* decoder */
vorbis_comment vc ;
ogg_packet op;
/* decoder */
vorbis_comment vc ;
ogg_packet op;
+static const AVOption options[]={
+{"iblock", "Sets the impulse block bias", offsetof(OggVorbisContext, iblock), FF_OPT_TYPE_DOUBLE, 0, -15, 0, AV_OPT_FLAG_ENCODING_PARAM},
+{NULL}
+};
+static const AVClass class = { "libvorbis", NULL, options, LIBAVUTIL_VERSION_INT };
static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
+ OggVorbisContext *context = avccontext->priv_data ;
double cfreq;
if(avccontext->flags & CODEC_FLAG_QSCALE) {
double cfreq;
if(avccontext->flags & CODEC_FLAG_QSCALE) {
+ if(context->iblock){
+ vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &context->iblock);
+ }
+
return vorbis_encode_setup_init(vi);
}
return vorbis_encode_setup_init(vi);
}
.capabilities= CODEC_CAP_DELAY,
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
.capabilities= CODEC_CAP_DELAY,
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),