[ 
https://issues.apache.org/jira/browse/ARIES-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14709985#comment-14709985
 ] 

Elliot Huntington commented on ARIES-780:
-----------------------------------------

@[~olze84] I am aware that JavaFX provides mp3 capability already, which might 
make this integration with the mp3spi and spi fly irrelevant in most 
situations. But my end goal is to actually port the plarpebu karaoke player to 
javafx on jdk 8 and to replace its outdated plugin system with osgi. So I think 
I still need to figure out how to get the mp3spi integrated in the osgi world 
for purposes of synchronizing the audio with the video. Thank you for your link 
to Soundbox on github. I'll review the version history to see if I can find the 
mp3spi wrapper that was apparently working for you sometime ago in Felix. Once 
I get this working, I'll update this ticket with a link to a working example.

> problem getting mp3spi working with dynamic/static weaving
> ----------------------------------------------------------
>
>                 Key: ARIES-780
>                 URL: https://issues.apache.org/jira/browse/ARIES-780
>             Project: Aries
>          Issue Type: Question
>          Components: Subsystem
>    Affects Versions: parent-0.4.0
>         Environment: win7 x64, apache felix 4.0.1 and equinox 3.7.1
>            Reporter: oliver  z
>            Assignee: David Bosschaert
>            Priority: Minor
>
> I'm trying to build a modular player for sites like jamendo. The problem is 
> that the streaming format is in mp3 (or ogg sometimes). The librarys 
> providing such support try to use the SPI mechanism of the JRE which is a 
> problem in OSGi environments.
> So i'm really happy that this is adressed with SPI Fly - but its somehow not 
> working for me.
> I tried the dynamic weaving:
> added the asm bundle and the spi fly dynamic weaving bundle in the "bundle" 
> dir of apache felix (works fine, lb shows me that both bundles are running)
>    ID|State      |Level|Name
>     0|Active     |    0|System Bundle (4.0.1)
>     1|Active     |    1|ASM all classes (3.2.0)
>     2|Active     |    1|json simple OSGi Bundle (1.0.0.SNAPSHOT)
>     3|Active     |    1|Mp3Wrapper OSGi Bundle (1.0.0.SNAPSHOT)
>     4|Active     |    1|Apache Aries SPI Fly Dynamic Weaving Bundle 
> (0.4.0.SNAPSHOT)
> the mp3wrapper contains the spi providers (mp3spi, tritounus share etc. for 
> playing mp3 files - they replace AudioInputStream and some others), so i 
> added in the MANIFEST.MF in mp3wrapper the following header:
> SPI-Provider: *
> the consumer is my playerengine bundle which contains the following line in 
> its manifest:
> SPI-Consumer: *
> when i start the OSGi container i get the following:
> [BROWSER]: Standard Gui (Browser) registered.
> @@@ 1: <init>#()V#null~null
> ### 183: java/lang/Object#<init>#()V
> @@@ 1: start#(Lorg/osgi/framework/BundleContext;)V#null~[java/lang/Exception]
> ### 183: 
> org/dyndns/soundi/soundboxplayerengine/DefaultPlayerEngine#<init>#(Lorg/osgi/framework/BundleContext;)V
> ### 182: 
> org/dyndns/soundi/portals/interfaces/CommunicationAction#toString#()Ljava/lang/String;
> ### 182: 
> org/dyndns/soundi/portals/interfaces/CommunicationAction#toString#()Ljava/lang/String;
> ### 183: java/util/Hashtable#<init>#()V
> ### 182: 
> java/util/Dictionary#put#(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
> ### 182: java/lang/Class#getName#()Ljava/lang/String;
> ### 182: java/lang/Class#getName#()Ljava/lang/String;
> ### 185: 
> org/osgi/framework/BundleContext#registerService#([Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)L
> org/osgi/framework/ServiceRegistration;
> ### 184: 
> org/dyndns/soundi/utils/Util#sendMessage#(Lorg/dyndns/soundi/utils/Util$Component;Ljava/lang/String;)V
> @@@ 1: stop#(Lorg/osgi/framework/BundleContext;)V#null~[java/lang/Exception]
> @@@ 0: <init>#(Lorg/osgi/framework/BundleContext;)V#null~null
> ### 183: java/lang/Object#<init>#()V
> @@@ 1: 
> play#(Ljava/io/InputStream;Lorg/dyndns/soundi/portals/interfaces/Song;)V#null~null
> ### 184: 
> javax/sound/sampled/AudioSystem#getAudioFileTypes#()[Ljavax/sound/sampled/AudioFileFormat$Type;
> ### 182: 
> javax/sound/sampled/AudioFileFormat$Type#getExtension#()Ljava/lang/String;
> ### 182: java/io/PrintStream#println#(Ljava/lang/String;)V
> ### 183: java/io/BufferedInputStream#<init>#(Ljava/io/InputStream;)V
> ### 184: 
> javax/sound/sampled/AudioSystem#getAudioInputStream#(Ljava/io/InputStream;)Ljavax/sound/sampled/AudioInputStrea
> m;
> ### 182: java/lang/Class#getName#()Ljava/lang/String;
> ### 184: 
> java/util/logging/Logger#getLogger#(Ljava/lang/String;)Ljava/util/logging/Logger;
> ### 182: 
> java/util/logging/Logger#log#(Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
> ### 182: java/lang/Class#getName#()Ljava/lang/String;
> ### 184: 
> java/util/logging/Logger#getLogger#(Ljava/lang/String;)Ljava/util/logging/Logger;
> ### 182: 
> java/util/logging/Logger#log#(Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
> ### 182: 
> javax/sound/sampled/AudioInputStream#getFormat#()Ljavax/sound/sampled/AudioFormat;
> ### 182: javax/sound/sampled/AudioFormat#getSampleRate#()F
> ### 182: javax/sound/sampled/AudioFormat#getChannels#()I
> ### 182: javax/sound/sampled/AudioFormat#getChannels#()I
> ### 182: javax/sound/sampled/AudioFormat#getSampleRate#()F
> ### 183: 
> javax/sound/sampled/AudioFormat#<init>#(Ljavax/sound/sampled/AudioFormat$Encoding;FIIIFZ)V
> ### 184: 
> javax/sound/sampled/AudioSystem#getAudioInputStream#(Ljavax/sound/sampled/AudioFormat;Ljavax/sound/sampled/Audi
> oInputStream;)Ljavax/sound/sampled/AudioInputStream;
> ### 183: 
> org/dyndns/soundi/soundboxplayerengine/DefaultPlayerEngine#rawplay#(Ljavax/sound/sampled/AudioFormat;Ljavax/sou
> nd/sampled/AudioInputStream;Lorg/dyndns/soundi/portals/interfaces/Song;)V
> @@@ 1: pause#()V#null~null
> @@@ 1: stop#()V#null~null
> @@@ 1: handleEvent#(Lorg/osgi/service/event/Event;)V#null~null
> @@@ 2: 
> rawplay#(Ljavax/sound/sampled/AudioFormat;Ljavax/sound/sampled/AudioInputStream;Lorg/dyndns/soundi/portals/interf
> aces/Song;)V#null~null
> ### 183: 
> org/dyndns/soundi/soundboxplayerengine/DefaultPlayerEngine#getLine#(Ljavax/sound/sampled/AudioFormat;)Ljavax/so
> und/sampled/SourceDataLine;
> ### 185: javax/sound/sampled/SourceDataLine#start#()V
> ### 185: javazoom/spi/PropertiesContainer#properties#()Ljava/util/Map;
> ### 185: java/util/Map#get#(Ljava/lang/Object;)Ljava/lang/Object;
> ### 182: java/lang/Long#longValue#()J
> ### 185: java/util/Map#get#(Ljava/lang/Object;)Ljava/lang/Object;
> ### 182: java/lang/Long#longValue#()J
> ### 182: javax/sound/sampled/AudioInputStream#read#([BII)I
> ### 185: javax/sound/sampled/SourceDataLine#write#([BII)I
> ### 185: javax/sound/sampled/SourceDataLine#drain#()V
> ### 185: javax/sound/sampled/SourceDataLine#stop#()V
> ### 185: javax/sound/sampled/SourceDataLine#close#()V
> ### 182: java/lang/Exception#printStackTrace#()V
> @@@ 2: 
> getLine#(Ljavax/sound/sampled/AudioFormat;)Ljavax/sound/sampled/SourceDataLine;#null~[javax/sound/sampled/LineUna
> vailableException]
> ### 183: 
> javax/sound/sampled/DataLine$Info#<init>#(Ljava/lang/Class;Ljavax/sound/sampled/AudioFormat;)V
> ### 184: 
> javax/sound/sampled/AudioSystem#getLine#(Ljavax/sound/sampled/Line$Info;)Ljavax/sound/sampled/Line;
> ### 185: 
> javax/sound/sampled/SourceDataLine#open#(Ljavax/sound/sampled/AudioFormat;)V
> [PLAYERENGINE]: Default player engine registered!
> so it does *something*, but it looks like errors. I got a reply that this is 
> just debugging output and the functionality should work.
> But it does not. I wrote a little test in my playerengine bundle:
> Type[] audioFileTypes = AudioSystem.getAudioFileTypes();
>         for(Type a : audioFileTypes)
>         {
>             System.out.println(a.getExtension()); 
>         }
> if it would work, there should be:
> wav (provided by JRE)
> au (provided by JRE)
> aif (provided by JRE)
> mp3 (provided by mp3spi)
> but the last one is missing, i cannot play mp3s, i get an exception:
> 13.11.2011 09:23:05 
> org.dyndns.soundi.soundboxplayerengine.DefaultPlayerEngine play
> SCHWERWIEGEND: null
> javax.sound.sampled.UnsupportedAudioFileException: could not get audio input 
> stream from input stream
>         at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
>         at 
> org.dyndns.soundi.soundboxplayerengine.DefaultPlayerEngine.play(DefaultPlayerEngine.java:47)
>         at 
> org.dyndns.soundi.soundbox.core.gui.PlayerFrame.play(PlayerFrame.java:217)
>         at 
> org.dyndns.soundi.soundbox.core.gui.PlayerFrame.handleEvent(PlayerFrame.java:194)
>         at 
> org.apache.felix.eventadmin.impl.tasks.HandlerTaskImpl.execute(HandlerTaskImpl.java:88)
> maybe this is a bug? i'm not familiar with bytecode so i can't help nor go 
> deeper and check whats going on :(
> the complete framework with my bundles and asm/dynamic weaving (running 
> example) can be downloaded here (2.3mb):
> http://download.origo.ethz.ch/soundbox/3349/felix-framework-4.0.1.7z
> thanks in advance
> edit:
> to run the application:
> 1) java -jar bin\felix.jar 
>     then 2 windows should open 
>     wait a little bit until "Jamendo plugin initialized" appears
> 2) now go the textfield where "Enter a keyword..." stands 
>     enter something like "dire" and click on the "go" button
>     there should appear a list of songs in the table
> 3) click one so that it is marked and hit the button "add to player"
>     "add to player" tries to start the playback - the dynamic weaving happens 
> and the exception will be thrown
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to