Trouble with kAudioCodecPropertySettings
Trouble with kAudioCodecPropertySettings
- Subject: Trouble with kAudioCodecPropertySettings
- From: Stevo Brock <email@hidden>
- Date: Fri, 29 Aug 2008 14:24:35 -0700
Hi All,
We're having trouble setting kAudioCodecPropertySettings into an
AudioCodec. We've tried many, many slight variations on the
CFDictionary that is passed in, but so far we haven't found a reliable
way to set a parameter. Here is the simplest attempt detailed below:
This example is for a codec kAudioFormatMPEG4AAC.
The code used to set the property settings:
CFDictionaryRef dictRef = dict.getCFDictionaryRef();
error = MAKE_OSUError(::AudioCodecSetProperty(mCodec,
kAudioCodecPropertySettings,
sizeof(CFDictionaryRef), &dictRef));
The code used to immediately retrieve the property settings:
CFMutableDictionaryRef mutDictRef = nil;
size = sizeof(CFMutableDictionaryRef);
error = MAKE_OSUError(::AudioCodecGetProperty(mCodec,
kAudioCodecPropertySettings,
&size, &mutDictRef));
The CFDictionaryRef passed in:
<CFDictionary 0x1641f9b0 [0xa050e1a0]>{type = mutable, count = 1,
capacity = 3, pairs = (
2 : <CFString 0x1647d6e0 [0xa050e1a0]>{contents = "parameters"} =
<CFArray 0x16487100 [0xa050e1a0]>{type = mutable-small, count = 1,
values = (
0 : <CFDictionary 0x16478470 [0xa050e1a0]>{type = mutable, count = 2,
capacity = 3, pairs = (
1 : <CFString 0x1647adf0 [0xa050e1a0]>{contents = "current value"} =
<CFNumber 0x90df80 [0xa050e1a0]>{value = +0, type = kCFNumberSInt32Type}
2 : <CFString 0xa05200a0 [0xa050e1a0]>{contents = "key"} = <CFString
0x16476890 [0xa050e1a0]>{contents = "Target Format"}
)}
)}
)}
The relevant portions of the CFMutableDictionaryRef returned:
2 : <CFDictionary 0x16486920 [0xa050e1a0]>{type = mutable, count = 9,
capacity = 12, pairs = (
1 : <CFString 0x150375b0 [0xa050e1a0]>{contents = "current value"} =
<CFNumber 0x912170 [0xa050e1a0]>{value = +3, type = kCFNumberSInt32Type}
4 : <CFString 0x150375a0 [0xa050e1a0]>{contents = "name"} = <CFString
0x1644c830 [0xa050e1a0]>{contents = "Encoding Strategy"}
5 : <CFString 0x15037600 [0xa050e1a0]>{contents = "summary"} =
<CFString 0x1644c660 [0xa050e1a0]>{contents = "The encoding strategy
used for the bit allocation"}
6 : <CFString 0x15037610 [0xa050e1a0]>{contents = "hint"} = <CFNumber
0x9285c0 [0xa050e1a0]>{value = +5, type = kCFNumberSInt32Type}
10 : <CFString 0x150375c0 [0xa050e1a0]>{contents = "key"} = <CFString
0x15037660 [0xa050e1a0]>{contents = "Target Format"}
11 : <CFString 0x15037640 [0xa050e1a0]>{contents = "value type"} =
<CFNumber 0x1647b240 [0xa050e1a0]>{value = +22, type =
kCFNumberSInt32Type}
12 : <CFString 0x15037630 [0xa050e1a0]>{contents = "available
values"} = <CFArray 0x1647cbf0 [0xa050e1a0]>{type = mutable-small,
count = 4, values = (
0 : <CFString 0x1644c740 [0xa050e1a0]>{contents = "Average Bit Rate"}
1 : <CFString 0x1644c760 [0xa050e1a0]>{contents = "Variable Bit Rate"}
2 : <CFString 0x1644c780 [0xa050e1a0]>{contents = "Variable Bit Rate
Constrained"}
3 : <CFString 0x1644c720 [0xa050e1a0]>{contents = "Constant Bit Rate"}
)}
13 : <CFString 0x15037580 [0xa050e1a0]>{contents = "ExplicitValue"} =
<CFNumber 0x90df80 [0xa050e1a0]>{value = +0, type = kCFNumberSInt32Type}
14 : <CFString 0x15037620 [0xa050e1a0]>{contents = "limited values"}
= <CFArray 0x1648bc20 [0xa050e1a0]>{type = mutable-small, count = 4,
values = (
0 : <CFString 0x1644c740 [0xa050e1a0]>{contents = "Average Bit Rate"}
1 : <CFString 0x1644c760 [0xa050e1a0]>{contents = "Variable Bit Rate"}
2 : <CFString 0x1644c780 [0xa050e1a0]>{contents = "Variable Bit Rate
Constrained"}
3 : <CFString 0x1644c720 [0xa050e1a0]>{contents = "Constant Bit Rate"}
)}
)}
You can see that the currentValue passed in is 0 and then immediately
retrieved as 3. Here is the full in => out grid:
0 => 3
1 => 2
2 => 2
3 => 3
We can track that the currentValue/ExplicitValue figures correctly in
taking the ExplitValue(s) and correlating them with
kAudioCodecPropertyBitRateControlMode
All on Intel OSX 10.5.4 / QT 7.4.5 / CoreAudio 3.1.0.
The StdAudio Compression Dialog is based on this same stuff so it has
to work somehow. What are we missing in our understanding and
implementation?
And what is a "value type" of +22 anyway? All the docs and sample
code have a "value type" of 10.
-Stevo Brock
Head of Development
Monkey Tools, LLC
www.monkey-tools.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden