<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating the &#8220;Perfect&#8221; Media Player in Java &#8211; Part 2 (or 3)</title>
	<atom:link href="http://www.miginfocom.com/blog/?feed=rss2&#038;p=16" rel="self" type="application/rss+xml" />
	<link>http://www.miginfocom.com/blog/?p=16</link>
	<description>Creating Applications in Java</description>
	<lastBuildDate>Thu, 20 May 2010 08:08:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Manuel Kaess</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-33</link>
		<dc:creator>Manuel Kaess</dc:creator>
		<pubDate>Sun, 05 Oct 2008 18:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-33</guid>
		<description>@mats: Thank you for your explanation. I haven&#039;t done any C code-wrapping in Java yet, but sure will try it one day...yeah, one of these days ;-)

I&#039;ve heard of a program that uses the command line params to execute an external player like this before, so that was why I was assuming you were doing it that way.

I think I will stay with the javazoom library for the beginning. For tag editing I think I will go for the JAudiTagger library and use the javazoom mp3 spi package as a backup solution (again: thanks for the great idea!)

Also thanks for noting that it is not worth painting the buttons in pure Java2D. I will focus on images now :-)</description>
		<content:encoded><![CDATA[<p>@mats: Thank you for your explanation. I haven&#8217;t done any C code-wrapping in Java yet, but sure will try it one day&#8230;yeah, one of these days <img src='http://www.miginfocom.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>I&#8217;ve heard of a program that uses the command line params to execute an external player like this before, so that was why I was assuming you were doing it that way.</p>
<p>I think I will stay with the javazoom library for the beginning. For tag editing I think I will go for the JAudiTagger library and use the javazoom mp3 spi package as a backup solution (again: thanks for the great idea!)</p>
<p>Also thanks for noting that it is not worth painting the buttons in pure Java2D. I will focus on images now <img src='http://www.miginfocom.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mats</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-32</link>
		<dc:creator>mats</dc:creator>
		<pubDate>Fri, 03 Oct 2008 12:54:03 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-32</guid>
		<description>Just realized the explanation on how I am using FFMpeg was really confusing. 

To make it easier:
1. FFMpeg is a library created in the c programming language
2. Java Native Access (JNA) is a java library that makes it possible to call functions in c libraries such as FFMpeg using java
3. It is fairly easy to create Java code using JNA that calls a function in a c library

However, calling the FFMpeg functions directly from java using JNA is complicated because all structures you access that are defined by FFMpeg (typically c structs) must be mapped to java classes in a way that is defined by JNA. The real problem is that FFMpeg exposes some really HUGE structures which makes it very easy to make a mistake when you try to map them to a java class as defined by JNA. So to make this easier I created a my own c library that uses the FFMpeg libraries. My own library exposes only a few functions and some very small structures which are easy to define as classes in Java using JNA. 

Well, there are some other reasons for doing it this way as well, but  I hope you get the general idea :)</description>
		<content:encoded><![CDATA[<p>Just realized the explanation on how I am using FFMpeg was really confusing. </p>
<p>To make it easier:<br />
1. FFMpeg is a library created in the c programming language<br />
2. Java Native Access (JNA) is a java library that makes it possible to call functions in c libraries such as FFMpeg using java<br />
3. It is fairly easy to create Java code using JNA that calls a function in a c library</p>
<p>However, calling the FFMpeg functions directly from java using JNA is complicated because all structures you access that are defined by FFMpeg (typically c structs) must be mapped to java classes in a way that is defined by JNA. The real problem is that FFMpeg exposes some really HUGE structures which makes it very easy to make a mistake when you try to map them to a java class as defined by JNA. So to make this easier I created a my own c library that uses the FFMpeg libraries. My own library exposes only a few functions and some very small structures which are easy to define as classes in Java using JNA. </p>
<p>Well, there are some other reasons for doing it this way as well, but  I hope you get the general idea <img src='http://www.miginfocom.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mats</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-31</link>
		<dc:creator>mats</dc:creator>
		<pubDate>Fri, 03 Oct 2008 12:37:02 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-31</guid>
		<description>Hi Manuel

I did not call FFMpeg using the command line. I compiled my own binaries (dlls for windows) from the FFMpeg source using MingW. Then I created my own simple c wrapper around functions I needed to make it easier to create a Java wrapper using Java Native Access (JNA). And finally I created the necessary Java code using JNA to call the c wrapper functions. Believe me... it was not as easy as it sounds :p

I can now just add more functions to my c wrapper and update the java JNA wrapper to enable me to use more functions inside FFMpeg... like converting audio. 

I have a project homepage on sourceforge (just search for High Fidelity). However, it is veeery outdated and probably won&#039;t be updated in a while. This is mainly because some friends and I have setup our own build server and like to have full control over everything. 

The buttons are just images. Don&#039;t waste your time trying to make such complex GUI items in Java2d. It is not worth it. It would just take ages to make and would also be 1000x slower. (Yes, you gain flexibility, but like I said, in such cases its not worth it)</description>
		<content:encoded><![CDATA[<p>Hi Manuel</p>
<p>I did not call FFMpeg using the command line. I compiled my own binaries (dlls for windows) from the FFMpeg source using MingW. Then I created my own simple c wrapper around functions I needed to make it easier to create a Java wrapper using Java Native Access (JNA). And finally I created the necessary Java code using JNA to call the c wrapper functions. Believe me&#8230; it was not as easy as it sounds :p</p>
<p>I can now just add more functions to my c wrapper and update the java JNA wrapper to enable me to use more functions inside FFMpeg&#8230; like converting audio. </p>
<p>I have a project homepage on sourceforge (just search for High Fidelity). However, it is veeery outdated and probably won&#8217;t be updated in a while. This is mainly because some friends and I have setup our own build server and like to have full control over everything. </p>
<p>The buttons are just images. Don&#8217;t waste your time trying to make such complex GUI items in Java2d. It is not worth it. It would just take ages to make and would also be 1000x slower. (Yes, you gain flexibility, but like I said, in such cases its not worth it)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manuel Kaess</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-30</link>
		<dc:creator>Manuel Kaess</dc:creator>
		<pubDate>Fri, 03 Oct 2008 08:50:18 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-30</guid>
		<description>Very intersting comments... 
I am also working on a media player right now. Currently, I am using the javazoom mp3 library since I do not want to call an external program... as far as I understood FFMpeg has to be called using the command line? So it has to be started with something like Runtime.getRuntime().exec(...);? Hmmm... I don&#039;t really like that approach. Or is there another way of calling the FFMpeg library?

@Mats: is there a project home page for your player? How did you create the buttons (play, pause, etc) since I found it hard to create them using Java2d. Or did you use images instead?</description>
		<content:encoded><![CDATA[<p>Very intersting comments&#8230;<br />
I am also working on a media player right now. Currently, I am using the javazoom mp3 library since I do not want to call an external program&#8230; as far as I understood FFMpeg has to be called using the command line? So it has to be started with something like Runtime.getRuntime().exec(&#8230;);? Hmmm&#8230; I don&#8217;t really like that approach. Or is there another way of calling the FFMpeg library?</p>
<p>@Mats: is there a project home page for your player? How did you create the buttons (play, pause, etc) since I found it hard to create them using Java2d. Or did you use images instead?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikael Grev</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-29</link>
		<dc:creator>Mikael Grev</dc:creator>
		<pubDate>Thu, 02 Oct 2008 10:57:36 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-29</guid>
		<description>Thank you for your comments Mats, they will save me a lot of time when it comes to the impl. I will probably wait as long as possible to make the decision though since I want JavaFX to be as mature as possible when I evaluate it.</description>
		<content:encoded><![CDATA[<p>Thank you for your comments Mats, they will save me a lot of time when it comes to the impl. I will probably wait as long as possible to make the decision though since I want JavaFX to be as mature as possible when I evaluate it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mats</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-28</link>
		<dc:creator>mats</dc:creator>
		<pubDate>Thu, 02 Oct 2008 10:40:08 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-28</guid>
		<description>Well, I also had the goal of staying away from native code, but there are some very good reasons I chose to use it.

I use FFMpeg to decode my audio data because:

1. FFMpeg supports pretty much every audio/video format in existence
2. FFMpeg is super fast (even with the overhead of calling it from java) and much quicker than using for instance the JavaZoom mp3 decoder.
3. The only decoders I found in pure java was for Mp3 (javazoom, very good impl btw), Ogg Vorbis (Decent, but not as good as FFMpeg) and Flac (A fairly buggy impl). This means you cannot support AAC for instance...
4. As far as I know there does not exist any way to convert between these formats in pure java. (but with FFMpeg you can)

Maybe you could actually playback most of these formats natively with the new Media Components framework which I believe is part of JavaFX, but if you do it that way you will not have access to the decoded audio data. That would make it pretty much impossible to create things like audio visualization (for instance the bars in the screenshot of my application) or an audio equalizer (which my application also has). 

You can get away with a java only implementation to read/write the audio tags. I recommend the JAudioTagger library, which is really good. I decided in the end to use the Taglib native library. The reason is mainly that it is a lot faster AND that it identifies more files correctly. Actually, if the Taglib library cannot identify the tags of a song I try to use the JAudioTagger library as a backup solution.

I would rather have a Java only implementation of everything, but I have come to accept that it is just not possible or practical.

As a final tip, do not try to use the Jave Media Framework (JMF). It is just a horrible piece of software. I tried to use it because there exists projects that give you access to FFMpeg through JMF. However, with my own wrapper I can use FFMpeg through JavaSound which works 10x better :)</description>
		<content:encoded><![CDATA[<p>Well, I also had the goal of staying away from native code, but there are some very good reasons I chose to use it.</p>
<p>I use FFMpeg to decode my audio data because:</p>
<p>1. FFMpeg supports pretty much every audio/video format in existence<br />
2. FFMpeg is super fast (even with the overhead of calling it from java) and much quicker than using for instance the JavaZoom mp3 decoder.<br />
3. The only decoders I found in pure java was for Mp3 (javazoom, very good impl btw), Ogg Vorbis (Decent, but not as good as FFMpeg) and Flac (A fairly buggy impl). This means you cannot support AAC for instance&#8230;<br />
4. As far as I know there does not exist any way to convert between these formats in pure java. (but with FFMpeg you can)</p>
<p>Maybe you could actually playback most of these formats natively with the new Media Components framework which I believe is part of JavaFX, but if you do it that way you will not have access to the decoded audio data. That would make it pretty much impossible to create things like audio visualization (for instance the bars in the screenshot of my application) or an audio equalizer (which my application also has). </p>
<p>You can get away with a java only implementation to read/write the audio tags. I recommend the JAudioTagger library, which is really good. I decided in the end to use the Taglib native library. The reason is mainly that it is a lot faster AND that it identifies more files correctly. Actually, if the Taglib library cannot identify the tags of a song I try to use the JAudioTagger library as a backup solution.</p>
<p>I would rather have a Java only implementation of everything, but I have come to accept that it is just not possible or practical.</p>
<p>As a final tip, do not try to use the Jave Media Framework (JMF). It is just a horrible piece of software. I tried to use it because there exists projects that give you access to FFMpeg through JMF. However, with my own wrapper I can use FFMpeg through JavaSound which works 10x better <img src='http://www.miginfocom.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikael Grev</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-27</link>
		<dc:creator>Mikael Grev</dc:creator>
		<pubDate>Wed, 01 Oct 2008 19:32:41 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-27</guid>
		<description>Mats,

I will try to stay away from native code if at all possible. With Update 10 and JavaFX it might be...

Lets just say I have a very bad case on the &quot;Not Invented Here Syndrome&quot; ;)</description>
		<content:encoded><![CDATA[<p>Mats,</p>
<p>I will try to stay away from native code if at all possible. With Update 10 and JavaFX it might be&#8230;</p>
<p>Lets just say I have a very bad case on the &#8220;Not Invented Here Syndrome&#8221; <img src='http://www.miginfocom.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mats</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-26</link>
		<dc:creator>Mats</dc:creator>
		<pubDate>Wed, 01 Oct 2008 19:24:31 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-26</guid>
		<description>I have been working on a similar project for some time now. However, it is a bit different since I chose a very Itunes like interface and my application is audio only. I also intend to release it as open source when it is finished. 

My player is  based on Java, but uses native cross platform c libraries for audio playback (FFMpeg) and tag reading/writing (Taglib). It uses the Java Plugin Framework (JPF) to provide a modular architecture. 

You can have a look at a screenshot here:
http://static.zooomr.com/images/5992883_55927cdd54_b.jpg
(This shows the application in action. It is not just UI)

I find it a bit strange that you do not want &quot;outside help&quot;. Do you have any idea how effort you have to put into a project like this if you plan to actually release something useful? Have a look at SongBird&#039;s code base to get an idea... (www.getsongbird.com)</description>
		<content:encoded><![CDATA[<p>I have been working on a similar project for some time now. However, it is a bit different since I chose a very Itunes like interface and my application is audio only. I also intend to release it as open source when it is finished. </p>
<p>My player is  based on Java, but uses native cross platform c libraries for audio playback (FFMpeg) and tag reading/writing (Taglib). It uses the Java Plugin Framework (JPF) to provide a modular architecture. </p>
<p>You can have a look at a screenshot here:<br />
<a href="http://static.zooomr.com/images/5992883_55927cdd54_b.jpg" rel="nofollow">http://static.zooomr.com/images/5992883_55927cdd54_b.jpg</a><br />
(This shows the application in action. It is not just UI)</p>
<p>I find it a bit strange that you do not want &#8220;outside help&#8221;. Do you have any idea how effort you have to put into a project like this if you plan to actually release something useful? Have a look at SongBird&#8217;s code base to get an idea&#8230; (www.getsongbird.com)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikael Grev</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-25</link>
		<dc:creator>Mikael Grev</dc:creator>
		<pubDate>Wed, 01 Oct 2008 08:57:27 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-25</guid>
		<description>Thanks Saeed,

Actually I have no need for outside help so there is no incentive for me to make it open source.</description>
		<content:encoded><![CDATA[<p>Thanks Saeed,</p>
<p>Actually I have no need for outside help so there is no incentive for me to make it open source.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saeed</title>
		<link>http://www.miginfocom.com/blog/?p=16&#038;cpage=1#comment-24</link>
		<dc:creator>saeed</dc:creator>
		<pubDate>Wed, 01 Oct 2008 07:51:07 +0000</pubDate>
		<guid isPermaLink="false">http://miginfocom.com/blog/?p=16#comment-24</guid>
		<description>Great work mikael ,

I think it&#039;s better that you make your project open source . so 
we will have an open source and fully java implemented media player.</description>
		<content:encoded><![CDATA[<p>Great work mikael ,</p>
<p>I think it&#8217;s better that you make your project open source . so<br />
we will have an open source and fully java implemented media player.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
