Hi,

i am trying to write a volume control for pvr350 cards for the vdr.

The method gets a buffer in MP2-format (at last i think so) and writes it to 
the pvr350 card. This is where i want to decode, change volume and then encode 
the sound back to mp2.

But when encoding, i am getting an Segmentation fault error.

My libavcodec-dev-Version is 3:0.svn20080206-12ubuntu3.1 from Ubuntu 8.10

Here are some code-snippets:

int frame_size = 1024*1024, ac2BufferSize=1024*1024;
avcodec_register_all();
decodeContext = avcodec_alloc_context();
encodeContext = avcodec_alloc_context();
samples = new int16_t[frame_size];
ac2Buffer = new uint8_t[ac2BufferSize];

// decoding it. alignedData is the mp2 data 
// with length Length and of type uint8_t *
avcodec_decode_audio2(decodeContext, samples, &curFrameSize,
  alignedData, Length);

// copy parameters from decode to encode context. 
// Dont know whether this is correct
encodeContext->frame_size = decodeContext->frame_size;
encodeContext->channels = decodeContext->channels;
encodeContext->sample_rate = decodeContext->sample_rate;
encodeContext->bit_rate = decodeContext->bit_rate;
// and now encode
avcodec_encode_audio(encodeContext, ac2Buffer, 
  ac2BufferSize, samples);
// Segmentation fault

i removed all error-checking code.

Is there an obvious error i have done or can somebody help me ?

Thanks in advice

Rainer Blickle
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to