Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4925767
Votes 0
Synopsis RFE: Add Properties to AudioFormat
Category java:classes_sound
Reported Against tiger
Release Fixed 1.5(tiger-b26)
State 10-Fix Delivered, request for enhancement
Priority: 3-Medium
Related Bugs 4666845 , 4938824
Submit Date 20-SEP-2003
Description
RFE: Add Properties to AudioFormat


This RFE is a follow-up to 4666845: Add Properties to AudioFileFormat and MidiFileFormat

The following methods should be added to AudioFormat:

public AudioFormat(Encoding encoding, float sampleRate,
                   int sampleSizeInBits, int channels,
                   int frameSize, float frameRate,
                   boolean bigEndian, Map<String, Object> properties);
Map<String,Object> AudioFormat.properties()
Object AudioFormat.getProperty(String key)

The current AudioFormat class makes it impossible to account for non-trivial formats, like MPEG-I layer 3 (mp3), which has more format qualifiers than the ones provided by AudioFormat. So, as an example, an mp3 file might include these properties:
key="quality", value=Integer(5)
key="bitrate", value=Integer(128)
key="VBR", value=Boolean(false)
etc.
It is up to the implementor to properly document the keys and their values.


======================================================================
Work Around
N/A
Evaluation
 xxxxx@xxxxx  2003-09-20
	Important to allow flexible format qualifiers in Audio Format. This will stop the various work-arounds implemented by Tritonus (System Properties, passing of parameters in the URL, and back by ASCII data in the AudioInputStream) and other plug-in publishers.

CCC's evaluation:
  - Properties are not statically typechecked.

  - Properties are not as flexible as you might think.  The set of properties
    honored by javax.sound must be clearly specified and cannot change between
    J2SE feature releases.

  - There is no central specification of the semantics of the properties.  Each
    plugin will define its own set of properties and its own interpretation of
    those properties.  User code that examines or sets AudioFormat properties
    will thus be no less plugin-specific than user code that manipulates system
    properties or uses plugin-specific format classes.

  - Future additions to the AudioFormat class will have to contend with
    existing interpretations of the properties.  If in 1.6, e.g., you add
    {get,set}BitRate methods to AudioFormat you'll have to figure out how that
    interacts with an existing "bitrate" property used by (some) plugins.

A better way to add format-specific information to AudioFormat would be to
either (a) Define format-specific subclasses (MP3AudioFormat?), or (b) Add
get/set methods for optional format-specific information.  For (b) you could,
e.g., define {get,set}BitRate methods which would use the existing constant
AudioSystem.NOT_SPECIFIED for formats that don't have a concept of bit rate.
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang