<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I need some advice on integration.<br>
    <br>
    I'm experimenting with changing rezound (a destructive audio editor)
    to use libavcodec/libavformat instead of its current use of many
    other libraries (libsndfile, libaudiofile, lame, manual coding in
    some places, etc).  I did all of that work a LONG time ago.<br>
    <br>
    <b>Q1:</b><br>
    So, loading audio files that might have multiple streams is rather
    straight forward in concept.. I don't think users of rezound would
    normally load files with multiple streams (e.g. video files), but I
    can certainly enumerate the audio streams and present the user with
    a choice of which audio stream to load.  Let's call that chosen
    stream "stream X".<br>
    <br>
    So then if the user chooses the save the file after doing their
    editing, is it feasible (with libavformat) to replace stream X in
    the original file leaving all other streams intact?  I'm guessing
    this could be done (in concept) by opening a new temp file for
    write, and re-opening the original file for reading.  Then as I read
    the packets from the file, if the packet was for some other stream,
    then I just write it verbatim to the new file, but if the packet was
    for stream X, then I write the new encoded packet to the new file. 
    Then when it's all done, I move the tmp file back to the original
    file.    This would generally preserve the interlacing of packets
    within the file.  I assume it would be a bad idea to simply drop all
    the original file's packets for !stream X and then simply append
    stream X's new packets to the end of the file.<br>
    <br>
    So that, or is that kind of functionality already built into
    libavformat?  (i.e. functionality to <i>rewrite</i> one of the
    streams within a file)<br>
    <br>
    <br>
    <b>
      Q2:</b><br>
    It's daunting to consider the type and extent of UI  that needs to
    be in place if a user chooses to save a file in a chosen format with
    a chosen codec.  That is, just how many little options and their
    sensible defaults would need to be presented to the user for all the
    minutia of all the supported audio codecs.  Does ffmpeg provide any
    sort of programatic enumeration of the parameters (along with their
    name, data-type, defaults, etc) that need to be specified in the
    encode operation?  I don't immediately see something like a struct
    for each supported codec that describes all the options for that
    codec.  [Did I miss it?]<br>
    <br>
    Also, is there a way to know from the library what codecs are
    supported by a given muxer?  (just beginning to look at how
    -formats, -decodes, -encoders) work<br>
    <br>
    ---<br>
    <br>
    As you can tell, I'm just beginning to look at the idea of switching
    to ffmpeg.  I'm looking at the ffplay code (which only helps with
    understanding how to read).   I've found the doxygen code and the
    api-example.c (which only helps with libavcodec).   Are there other
    good resources for figuring this stuff out?<br>
    <br>
    Thanks.  Any suggestions, guidance, ideas, warnings, etc are
    appreciated.<br>
    <br>
    -- Davy<br>
  </body>
</html>