> On Dec 10, 2018, at 7:29 PM, Carl Eugen Hoyos <[email protected]> wrote:
> 
> 2018-12-11 1:07 GMT+01:00, Ronak <[email protected]>:
>> Hey guys,
>> 
>> I'm trying to use the dynaudnorm and earwax filters in my iPhone app, and
>> I've noticed that the dynaudnorm filter wants to resample the audio.
>> 
>> Is there any way to avoid resampling the audio? What format does the filter
>> expect the input to be?
> 
> The dynaudnorm filter only accepts planar double, the earwax filter only
> packed s16.

Ok thanks. I tried to use this filter in my iOS code; but I'm getting errors 
with an error code -35.

This is my code that tries to write data into the filter graph and reads it 
back; what am I doing wrong?


private func filterBuffer(_ inputBuffer: UnsafeMutableAudioBufferListPointer, 
frameCount: UInt32, outputBuffer: UnsafeMutableAudioBufferListPointer) throws {

    // copy the pointers to the audio buffer into the frame for manipulation

    // each buffer represents the audio per channel
    for index in 0..<inputBuffer.count {
      let dataByteSize = Int(inputBuffer[index].mDataByteSize)
      let buffer = inputBuffer[index].mData?.bindMemory(to: UInt8.self, 
capacity: dataByteSize)

      inputAudioFrame?.pointee.extended_data[index] = buffer
    }

    // write the audio frame into the audioInputContext so it can be filtered
    let writeResult = av_buffersrc_write_frame(audioInputContext, 
inputAudioFrame)
    if writeResult == 0 {

      // pull the filtered audio out of the audioOutputContext
      let pullResult = av_buffersink_get_frame(audioOutputContext, 
outputAudioFrame)
      if pullResult >= 0 {
        let filteredAudioBufferData = outputAudioFrame?.pointee.extended_data

        // copy the pointers to the filtered audio into the output buffers
        for index in 0..<outputBuffer.count {
          outputBuffer[index].mData = 
UnsafeMutableRawPointer(filteredAudioBufferData?[index])
        }
      } else {

        // the audio couldn't be filtered properly, throw an error
        throw PlayerError.filterFailure([:])
      }
    } else {

      // the audio couldn't be filtered properly, throw an error
      throw PlayerError.filterFailure([:])
    }
  }

Thanks,

Ronak


> 
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> [email protected] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to