誰かがffmpegをオーディオキューで動作させることができましたか?キューを作成しようとするとエラーが発生します。
ret = avcodec_open(enc, codec);
if (ret < 0) {
NSLog(@"Error: Could not open video decoder: %d", ret);
av_close_input_file(avfContext);
return;
}
if (audio_index >= 0) {
AudioStreamBasicDescription
audioFormat;
audioFormat.mFormatID = -1;
audioFormat.mSampleRate =
avfContext->streams[audio_index]->codec->sample_rate;
audioFormat.mFormatFlags = 0;
switch (avfContext->streams[audio_index]->codec->codec_id)
{
case CODEC_ID_MP3:
audioFormat.mFormatID = kAudioFormatMPEGLayer3;
break;
case CODEC_ID_AAC:
audioFormat.mFormatID = kAudioFormatMPEG4AAC;
audioFormat.mFormatFlags = kMPEG4Object_AAC_Main;
break;
case CODEC_ID_AC3:
audioFormat.mFormatID = kAudioFormatAC3;
break;
default:
break;
}
if (audioFormat.mFormatID != -1) {
audioFormat.mBytesPerPacket = 0;
audioFormat.mFramesPerPacket =
avfContext->streams[audio_index]->codec->frame_size;
audioFormat.mBytesPerFrame = 0;
audioFormat.mChannelsPerFrame = avfContext->streams[audio_index]->codec->channels;
audioFormat.mBitsPerChannel = 0;
if (ret = AudioQueueNewOutput(&audioFormat, audioQueueOutputCallback, self, NULL, NULL, 0, &audioQueue)) {
NSLog(@"Error creating audio output queue: %d", ret);
}
オーディオのみの問題、
オーディオキューを機能させる方法を理解できれば、ビデオは完璧です。
http://web.me.com/cannonwc/Site/Photos_6.html
私はremoteioのことを考えていますが、それに関するドキュメントはあまりありません。
クラス全体のコードを、それを機能させるのに役立つ人と共有します。
アイデアは、iphoneのffplayに似ていますが、sdlのオーバーヘッドがない、渡されたストリーミングビデオを再生する単一のViewControllerを用意することです。