• J
    Implement encoder usage with outputs · 6da26a3a
    jp9000 提交于
     - Make it so that encoders can be assigned to outputs.  If an encoder
       is destroyed, it will automatically remove itself from that output.
       I specifically didn't want to do reference counting because it leaves
       too much potential for unchecked references and it just felt like it
       would be more trouble than it's worth.
    
     - Add a 'flags' value to the output definition structure.  This lets
       the output specify if it uses video/audio, and whether the output is
       meant to be used with OBS encoders or not.
    
     - Remove boilerplate code for outputs.  This makes it easier to program
       outputs.  The boilerplate code involved before was mostly just
       involving connecting to the audio/video data streams directly in each
       output plugin.
    
       Instead of doing that, simply add plugin callback functions for
       receiving video/audio (either encoded or non-encoded, whichever it's
       set to use), and then call obs_output_begin_data_capture and
       obs_output_end_data_capture to automatically handle setting up
       connections to raw or encoded video/audio streams for the plugin.
    
     - Remove 'active' function from output callbacks, as it's no longer
       really needed now that the libobs output context automatically knows
       when the output is active or not.
    
     - Make it so that an encoder cannot be destroyed until all data
       connections to the encoder have been removed.
    
     - Change the 'start' and 'stop' functions in the encoder interface to
       just an 'initialize' callback, which initializes the encoder.
    
     - Make it so that the encoder must be initialized first before the data
       stream can be started.  The reason why initialization was separated
       from starting the encoder stream was because we need to be able to
       check that the settings used with the encoder *can* be used first.
    
       This problem was especially annoying if you had both video/audio
       encoding.  Before, you'd have to check the return value from
       obs_encoder_start, and if that second encoder fails, then you
       basically had to stop the first encoder again, making for
       unnecessary boilerplate code whenever starting up two encoders.
    6da26a3a
obs-encoder.c 13.3 KB