<br><br><div class="gmail_quote">On Dec 16, 2007 3:22 PM, Ulrich von Zadow &lt;<a href="mailto:uzadow@libavg.de">uzadow@libavg.de</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Lots of comments inline...<br><br>(Very technical &amp; sometimes critical comments. Don&#39;t take this to mean I<br>don&#39;t value your work. On the contrary!)<br><br>Nick Hebner wrote:<br>&gt; Index: /home/nick/workspace/libavg/configure.in
<br>&gt; ===================================================================<br>&gt; --- /home/nick/workspace/libavg/configure.in &nbsp;(revision 2460)<br>&gt; +++ /home/nick/workspace/libavg/configure.in &nbsp;(working copy)<br>&gt; Index: /home/nick/workspace/libavg/src/avgconfig.h.in
<br>[...]<br>&gt; ===================================================================<br>&gt; --- /home/nick/workspace/libavg/src/avgconfig.h.in &nbsp; &nbsp;(revision 2460)<br>&gt; +++ /home/nick/workspace/libavg/src/avgconfig.h.in &nbsp; &nbsp;(working copy)
<br>[...]<br>Just a nitpick, but these aren&#39;t real changes, right? Then they<br>shouldn&#39;t be in the patch.<br></blockquote><div><br>Yeah, this patch isn&#39;t as clean as it could be.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>&gt; Index: /home/nick/workspace/libavg/src/player/AudioEngine.cpp<br>&gt; ===================================================================<br>&gt; --- /home/nick/workspace/libavg/src/player/AudioEngine.cpp &nbsp; &nbsp;(revision 0)
<br>&gt; +++ /home/nick/workspace/libavg/src/player/AudioEngine.cpp &nbsp; &nbsp;(revision 0)<br>&gt; @@ -0,0 +1,59 @@<br>&gt; +//<br>&gt; +// &nbsp;libavg - Media Playback Engine.<br>&gt; +// &nbsp;Copyright (C) 2007 Nick Hebner<br><br>To avoid legal issues, I have to ask you to assign the copyright to me:
<br><br>// &nbsp;Copyright (C) 2007 Ulrich von Zadow<br><br>If the copyrights are owned by lots of different people, even a<br>technical license change (such as updating to LGPL 3.0) becomes a major<br>hassle because I have to ask everyone who contributed. Of course, I can
<br>never change the license of the current version, so there is really<br>nothing to fear. (I&#39;m also pretty committed to open source, but you are<br>under no obligation to believe me ;-).)<br><br>You can add a line at the bottom of the copyright blurb if you want, though:
<br><br>// &nbsp;Original author of this file is Nick Hebner (<a href="mailto:hebern@gmail.com">hebern@gmail.com</a>).<br></blockquote><div><br>Hmm, ok. I am honestly not all that interested in the legal mumbo jumbo involved in licensing, I would just like to have my work attributed to me. If this is the easiest way to do that, then that is absolutely fine with me.
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>[...]<br><br>&gt; Index: /home/nick/workspace/libavg/src/player/avgdtd.cpp<br>
&gt; ===================================================================<br>&gt; --- /home/nick/workspace/libavg/src/player/avgdtd.cpp (revision 2460)<br>&gt; +++ /home/nick/workspace/libavg/src/player/avgdtd.cpp (working copy)
<br>&gt; @@ -56,6 +56,8 @@<br>&gt; &nbsp;&quot; &nbsp; onkeydown CDATA #IMPLIED\n&quot;<br>&gt; &nbsp;&quot; &nbsp; onkeyup CDATA #IMPLIED\n&quot;<br>&gt; &nbsp;&quot; &nbsp; enablecrop CDATA #IMPLIED\n&quot;<br>&gt; +&quot; &nbsp; samplerate CDATA #IMPLIED\n&quot;
<br>&gt; +&quot; &nbsp; channels CDATA #IMPLIED\n&quot;<br><br>I&#39;m not sure, but shouldn&#39;t samplerate and channels be in avgrc instead?<br></blockquote><div><br>Can you explain how avgrc is used? A quick look at it seems to indicate that these parameters should go there too, but I would like to know how these integrated. Looks to me like this just defines variables that remain fairly static.
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>[...]<br><br>&gt; +// TODO: do we want these to be dynamically changable?<br>&gt; +//void Player::setAudioFrequency(int freq)
<br>&gt; +//{<br>&gt; +// &nbsp; &nbsp;m_AP.m_SampleRate = freq;<br>&gt; +//}<br>&gt; +//<br>&gt; +//void Player::setAudioChannels(int channels)<br>&gt; +//{<br>&gt; +// &nbsp; &nbsp;m_AP.m_Channels = channels;<br>&gt; +//}<br><br>Nice to have so tests can run with different frequency/channel setups
<br></blockquote><div><br>Sure, but making them dynamic would require a restart of the audio system. This would mean that we would need to add any locking to make that happen, and support dynamic resampling context changes in the video decoder. That may or may not be that big of a deal, but I cannot envisage these being used for any reason besides testing. As mentioned earlier since these are pretty static, they belong in avgrc.
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>&gt; &nbsp;void Player::initConfig() {<br>&gt; &nbsp; &nbsp; &nbsp;// Get data from config files.<br>
&gt; &nbsp; &nbsp; &nbsp;ConfigMgr* pMgr = ConfigMgr::get();<br>&gt; @@ -726,9 +743,34 @@<br>&gt; &nbsp; &nbsp; &nbsp;m_pDisplayEngine-&gt;init(m_DP);<br>&gt; &nbsp;}<br>&gt;<br>&gt; +void Player::initAudio()<br>&gt; +{<br>&gt; + &nbsp; &nbsp;m_pAudioEngine = new SDLAudioEngine();
<br>&gt; + &nbsp; &nbsp;m_pAudioEngine-&gt;init(m_AP);<br>&gt; +<br>&gt; + &nbsp; &nbsp;registerAudioSource(m_pRootNode);<br>&gt; +<br>&gt; + &nbsp; &nbsp;m_pAudioEngine-&gt;play();<br>&gt; +}<br>&gt; +<br>&gt; +void Player::registerAudioSource(NodePtr pNode)
<br>&gt; +{<br>&gt; + &nbsp; &nbsp;AudioSourcePtr pAudioSource =<br>boost::dynamic_pointer_cast&lt;AudioSource&gt;(pNode);<br>&gt; + &nbsp; &nbsp;if (pAudioSource) {<br>&gt; + &nbsp; &nbsp; &nbsp; &nbsp;m_pAudioEngine-&gt;addSource(pAudioSource);<br>&gt; + &nbsp; &nbsp;}
<br>&gt; +<br>&gt; + &nbsp; &nbsp;DivNodePtr pDivNode = boost::dynamic_pointer_cast&lt;DivNode&gt;(pNode);<br>&gt; + &nbsp; &nbsp;if (pDivNode) {<br>&gt; + &nbsp; &nbsp; &nbsp; &nbsp;for (int i=0; i&lt;pDivNode-&gt;getNumChildren(); i++) {<br>&gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;registerAudioSource(pDivNode-&gt;getChild(i));
<br>&gt; + &nbsp; &nbsp; &nbsp; &nbsp;}<br>&gt; + &nbsp; &nbsp;}<br>&gt; +}<br><br>Can&#39;t m_pAudioEngine-&gt;addSource be called from inside the Node? In<br>Video::setDisplayEngine() perhaps? Would probably be a lot less code and<br>get rid of the dynamic casts.
<br></blockquote><div><br>Would we want to add a Node::setAudioEngine() that is overridden by video and audio nodes? Seems to make more sense semantically then adding this to setDisplayEngine(). Alternatively, we could make setDisplayEngine a more general setRenderingEngines(DisplayEngine, AudioEngine) or something like that.
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Which reminds me: This stuff needs to be tested with nodes that are<br>dynamically added and removed from the scene, too...
<br><br>[...]<br>&gt; +//void Player::unregisterNode(NodePtr pNode)<br>&gt; +//{<br>&gt; +// &nbsp; &nbsp;removeNodeID(pNode);<br>&gt; +//<br>&gt; +// &nbsp; &nbsp;AudioSourcePtr pAudioSource =<br>boost::dynamic_pointer_cast&lt;AudioSource&gt;(pNode);
<br>&gt; +// &nbsp; &nbsp;if (pAudioSource) {<br>&gt; +// &nbsp; &nbsp; &nbsp; &nbsp;m_pAudioEngine-&gt;removeSource(pAudioSource);<br>&gt; +// &nbsp; &nbsp;}<br>&gt; +//<br>&gt; +// &nbsp; &nbsp;DivNodePtr pDivNode = boost::dynamic_pointer_cast&lt;DivNode&gt;(pNode);<br>
&gt; +// &nbsp; &nbsp;if (pDivNode) {<br>&gt; +// &nbsp; &nbsp; &nbsp; &nbsp;for (int i=0; i&lt;pDivNode-&gt;getNumChildren(); i++) {<br>&gt; +// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unregisterNode(pDivNode-&gt;getChild(i));<br>&gt; +// &nbsp; &nbsp; &nbsp; &nbsp;}<br>&gt; +// &nbsp; &nbsp;}<br>&gt; +//}<br>
<br>Possibly implement this in Video::disconnect()?<br></blockquote><div><br>That makes sense. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>[...]<br>&gt; Index: /home/nick/workspace/libavg/src/player/SDLAudioEngine.h<br>&gt; ===================================================================<br>&gt; --- /home/nick/workspace/libavg/src/player/SDLAudioEngine.h &nbsp; (revision 0)
<br>&gt; +++ /home/nick/workspace/libavg/src/player/SDLAudioEngine.h &nbsp; (revision 0)<br>[...]<br>&gt; +#define SDL_AUDIO_BUFFER_SIZE 4096<br><br>In the long run, we probably want this to be configurable, since<br>different setups will have different minimal buffer sizes and hence
<br>latencies.<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>[...]<br>&gt; Index: /home/nick/workspace/libavg/src/video/AsyncVideoDecoder.cpp
<br>&gt; ===================================================================<br>&gt; --- /home/nick/workspace/libavg/src/video/AsyncVideoDecoder.cpp<br>(revision 2460)<br>&gt; +++ /home/nick/workspace/libavg/src/video/AsyncVideoDecoder.cpp
<br>(working copy)<br>&gt; @@ -175,6 +175,11 @@<br>&gt; &nbsp; &nbsp; &nbsp;return m_bEOF;<br>&gt; &nbsp;}<br>&gt;<br>&gt; +void AsyncVideoDecoder::fillAudioFrame(unsigned char* audioBuffer,<br>int audioBufferSize, int channels, int rate)<br>
&gt; +{<br>&gt; + &nbsp; &nbsp;m_pSyncDecoder-&gt;fillAudioFrame(audioBuffer, audioBufferSize,<br>channels, rate);<br>&gt; +}<br>&gt; +<br><br>Will this work? The rest of m_pSyncDecoder is running in a different<br>thread and I don&#39;t see any locks, so this will probably cause
<br>intermittent crashes.<br></blockquote><div><br>It probably will not. I have only tested with the synchronous decoder yet, so it is very likely that the async one does not work. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>The cleanest way I know to make this thread-safe is to add a queue<br>between decoder thread and main thread. Have a look at how the video<br>frames get passed from the decoder to the main thread to see what I mean...
<br><div><div></div><div class="Wj3C7c"></div></div></blockquote><div><br>I&#39;ll take a look.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div class="Wj3C7c"><br>Cheers,<br><br> &nbsp;Uli<br><br>--<br><br>Ulrich von Zadow | +49-172-7872715<br>Jabber: <a href="mailto:cocacoder@jabber.berlin.ccc.de">cocacoder@jabber.berlin.ccc.de</a><br>Skype: uzadow<br><br>_______________________________________________
<br>libavg-devel mailing list<br><a href="mailto:libavg-devel@datenhain.de">libavg-devel@datenhain.de</a><br><a href="https://mail.datenhain.de/mailman/listinfo/libavg-devel" target="_blank">https://mail.datenhain.de/mailman/listinfo/libavg-devel
</a><br></div></div></blockquote></div><br>