<div>Tnx Robin</div><div>ffmpeg also works excellent as decoer.</div><div>With   ffmpeg -i /some/file -f u16le  -ar 44100 | myprog ...</div><div>i gotta horrable sound. Probably U mean  -f s16le !</div><div> </div><div>So, i have rewrited my olde 2-fork mpg123 mixer as 1-fork ffmpeg "frontend"</div><div>http://martini.pudele.com/radio/programming/audio/ffmpegdec02.c</div><div>fundamentally without any changes, except</div><div> #define PLAYER_BIN "/usr/bin/ffmpeg"</div><div>   execlp(PLAYER_BIN,PLAYER_BIN, "-i", mxk.trknamep, "-f", "s16le", "-ar","44100", "-v","0" ,"-", NULL);</div><div> </div><div>Any loud output messages i drain out simple with close(2); after fork();</div><div>So far everything is OK, if i decode whole files.</div><div> </div><div>It seems that ffmpeg during da decoding set terminal in canonical mode.</div><div>If i decode only part of file, and kill() em @ middle of decoding,</div><div>ffmpeg does not restore normal terminal mode , and i do not see commands which i type.</div><div>Then helps (blind typed) command "reset".</div><div>I tried send several signals with kill() SIGKILL 2 SIGTSTP SIGQUIT SIGINT 15 ..., </div><div>but none of em has handler for terminal restore.</div><div> </div><div>I fixed this behavior with </div><div>#include <termios.h></div><div>struct termios tsave;   /*  ! ! ! F-king ffmpeg ! ! ! */</div><div>/* sets canonical input mode */</div><div>/*----*/void save_terminal(void)</div><div>/*----*/{ struct termios tbuf;</div><div>/*----*/  tcgetattr(0,&tbuf);</div><div>/*----*/  tsave=tbuf;</div><div>/*----*/}</div><div> </div><div>/* restore the settings */</div><div>/*----*/void restore_terminal(void)</div><div>/*----*/{  tcsetattr(0,TCSANOW,&tsave);  }</div><div> </div><div>I have tried close(0); where 0=stdin , after fork(); but program has frozen.</div><div> </div><div>How do i decouple childs stdin from terminal or redirect em from /dev/null ?</div><div> </div><div> </div><div>Tnx in advance @ all</div> <div id="sig_upper"> </div><br />  <blockquote style="border-left: 1px solid #cccccc; margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex"><br /> That's probably why mplayer devs recommend using mkfifo (named pipe)<br /> instead of stdout.. 'mencoder' can do it.<br /> <br /> If you need to support a variety of unknown formats and codecs: ffmpeg<br /> is an alternative and gstreamer might be one.<br /> <br /> ffmpeg -i /some/file -f u16le -acodec pcm_s16le -ar 44100 - \<br /> | jack-stdin system:playback_1 system:playback_2<br /> <br /> on that note, `jack-stdout` can capture and pipe raw PCM data from any<br /> JACK-application including `mplayer -ao jack /some/file`. YMMV.<br /> <br /> HTH,<br /> robin</blockquote><br /> <br /> <div id="sig_lower"><br /> <br /> <br /> <br /> ----</div>