1. 24 4月, 2014 1 次提交
    • J
      obs-studio UI: Implement stream settings UI · 8830c410
      jp9000 提交于
       - Updated the services API so that it links up with an output and
         the output gets data from that service rather than via settings.
         This allows the service context to have control over how an output is
         used, and makes it so that the URL/key/etc isn't necessarily some
         static setting.
      
         Also, if the service is attached to an output, it will stick around
         until the output is destroyed.
      
       - The settings interface has been updated so that it can allow the
         usage of service plugins.  What this means is that now you can create
         a service plugin that can control aspects of the stream, and it
         allows each service to create their own user interface if they create
         a service plugin module.
      
       - Testing out saving of current service information.  Saves/loads from
         JSON in to obs_data_t, seems to be working quite nicely, and the
         service object information is saved/preserved on exit, and loaded
         again on startup.
      
       - I agonized over the settings user interface for days, and eventually
         I just decided that the only way that users weren't going to be
         fumbling over options was to split up the settings in to simple/basic
         output, pre-configured, and then advanced for advanced use (such as
         multiple outputs or services, which I'll implement later).
      
         This was particularly painful to really design right, I wanted more
         features and wanted to include everything in one interface but
         ultimately just realized from experience that users are just not
         technically knowledgable about it and will end up fumbling with the
         settings rather than getting things done.
      
         Basically, what this means is that casual users only have to enter in
         about 3 things to configure their stream:  Stream key, audio bitrate,
         and video bitrate.  I am really happy with this interface for those
         types of users, but it definitely won't be sufficient for advanced
         usage or for custom outputs, so that stuff will have to be separated.
      
       - Improved the JSON usage for the 'common streaming services' context,
         I realized that JSON arrays are there to ensure sorting, while
         forgetting that general items are optimized for hashing.  So
         basically I'm just using arrays now to sort items in it.
      8830c410
  2. 20 4月, 2014 1 次提交
    • J
      libobs: Add services API, reduce repeated code · 4a6d19f2
      jp9000 提交于
      Add API for streaming services.  The services API simplifies the
      creation of custom service features and user interface.
      
      Custom streaming services later on will be able to do things such as:
      
       - Be able to use service-specific APIs via modules, allowing a more
         direct means of communicating with the service and requesting or
         setting service-specific information
      
       - Get URL/stream key via other means of authentication such as OAuth,
         or be able to build custom URLs for services that require that sort
         of thing.
      
       - Query information (such as viewer count, chat, follower
         notifications, and other information)
      
       - Set channel information (such as current game, current channel title,
         activating commercials)
      
      Also, I reduce some repeated code that was used for all libobs objects.
      This includes the name of the object, the private data, settings, as
      well as the signal and procedure handlers.
      
      I also switched to using linked lists for the global object lists,
      rather than using an array of pointers (you could say it was..
      pointless.)  ..Anyway, the linked list info is also stored in the shared
      context data structure.
      4a6d19f2
  3. 14 4月, 2014 1 次提交
  4. 11 4月, 2014 1 次提交
    • J
      Fix issue when using multiple video encoders · 519c4f41
      jp9000 提交于
       - Fix an issue that could occur when using more than one video encoder.
         Audio/video would not sync up correctly because they were expected to
         be paired with a particular encoder.  This simply adds a little
         helper variable to encoder packets that specifies the system time in
         microseconds.  We then use that system time to sync
      
       - Fix an issue with x264 with fractional FPS rates (29.97 and 59.94
         particularly) where it would create ridiculously large stream
         outputs.  The problem was that you shouldn't set the timebase_*
         variables in the x264 params manually, let x264 handle the default
         values for it and leave them at 0.
      
       - Make x264 use CFR output, because there's no reason to ever use VFR
         in this case.
      519c4f41
  5. 08 4月, 2014 1 次提交
    • J
      Implement RTMP module (still needs drop code) · 92522d18
      jp9000 提交于
       - Implement the RTMP output module.  This time around, we just use a
         simple FLV muxer, then just write to the stream with RTMP_Write.
         Easy and effective.
      
       - Fix the FLV muxer, the muxer now outputs proper FLV packets.
      
       - Output API:
         * When using encoders, automatically interleave encoded packets
           before sending it to the output.
      
         * Pair encoders and have them automatically wait for the other to
           start to ensure sync.
      
         * Change 'obs_output_signal_start_fail' to 'obs_output_signal_stop'
           because it was a bit confusing, and doing this makes a lot more
           sense for outputs that need to stop suddenly (disconnections/etc).
      
       - Encoder API:
         * Remove some unnecessary encoder functions from the actual API and
           make them internal.  Most of the encoder functions are handled
           automatically by outputs anyway, so there's no real need to expose
           them and end up inadvertently confusing plugin writers.
      
         * Have audio encoders wait for the video encoder to get a frame, then
           start at the exact data point that the first video frame starts to
           ensure the most accrate sync of video/audio possible.
      
         * Add a required 'frame_size' callback for audio encoders that
           returns the expected number of frames desired to encode with.  This
           way, the libobs encoder API can handle the circular buffering
           internally automatically for the encoder modules, so encoder
           writers don't have to do it themselves.
      
       - Fix a few bugs in the serializer interface.  It was passing the wrong
         variable for the data in a few cases.
      
       - If a source has video, make obs_source_update defer the actual update
         callback until the tick function is called to prevent threading
         issues.
      92522d18
  6. 05 4月, 2014 1 次提交
    • J
      Add packet interleaving and improve encoder API · 8c74db9f
      jp9000 提交于
       - Add interleaving of video/audio packets for outputs that are encoded
         and expect both video and audio data, sorting the packets and sending
         them to the output when both video and audio is received.
      
       - Combine create and initialize callbacks for the encoder API callback
         interface.
      8c74db9f
  7. 04 4月, 2014 1 次提交
    • J
      Improve properties API · 1bca7e0a
      jp9000 提交于
      Improve the properties API so that it can actually respond somewhat to
      user input.  Maybe later this might be further improved or replaced with
      something script-based.
      
      When creating a property, you can now add a callback to that property
      that notifies when the property has been changed in the user interface.
      Return true if you want the properties to be refreshed, or false if not.
      Though now that I think about it I doubt there would ever be a case
      where you would have this callback and *not* refresh the properties.
      
      Regardless, this allows functions to change the values of properties or
      settings, or enable/disable/hide other property controls from view
      dynamically.
      1bca7e0a
  8. 02 4月, 2014 2 次提交
    • J
      obs-output module: Fill out more functions · 4a652ec8
      jp9000 提交于
       - Add start/stop code to obs-output module
      
       - Use a circular buffer for the buffered encoder packets instead of a
         dynamic array
      
       - Add pthreads.lib as a dependency to obs-output module on windows in
         visual studio project files
      
       - Fix an windows export bug for avc parsing functions on windows.
         Also, rename those functions to be more consistent with each other.
      
       - Make outputs use a single function for encoded data rather than
         multiple functions
      
       - Add the ability to make 'text' properties be passworded
      4a652ec8
    • J
      Add preliminary FLV/RTMP output (incomplete) · 0cf9e0cf
      jp9000 提交于
       - obs-outputs module:  Add preliminary code to send out data, and add
         an FLV muxer.  This time we don't really need to build the packets
         ourselves, we can just use the FLV muxer and send it directly to
         RTMP_Write and it should automatically parse the entire stream for us
         without us having to do much manual code at all.  We'll see how it
         goes.
      
       - libobs:  Add AVC NAL packet parsing code
      
       - libobs/media-io:  Add quick helper functions for audio/video to get
         the width/height/fps/samplerate/etc rather than having to query the
         info structures each time.
      
       - libobs (obs-output.c):  Change 'connect' signal to 'start' and 'stop'
         signals.  'start' now specifies an error code rather than whether it
         simply failed, that way the client can actually know *why* a failure
         occurred.  Added those error codes to obs-defs.h.
      
       - libobs:  Add a few functions to duplicate/free encoder packets
      0cf9e0cf
  9. 28 3月, 2014 1 次提交
    • 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
  10. 23 3月, 2014 1 次提交
    • J
      Add source properties window (very preliminary) · d9251f9e
      jp9000 提交于
       - Add a properties window for sources so that you can now actually edit
         the settings for sources.  Also, display the source by itself in the
         window (Note: not working on mac, and possibly not working on linux).
      
         When changing the settings for a source, it will call
         obs_source_update on that source when you have modified any values
         automatically.
      
       - Add a properties 'widget', eventually I want to turn this in to a
         regular nice properties view like you'd see in the designer, but
         right now it just uses a form layout in a QScrollArea with regular
         controls to display the properties.  It's clunky but works for the
         time being.
      
       - Make it so that swap chains and the main graphics subsystem will
         automatically use at least one backbuffer if none was specified
      
       - Fix bug where displays weren't added to the main display array
      
       - Make it so that you can get the properties of a source via the actual
         pointer of a source/encoder/output in addition to being able to look
         up properties via identifier.
      
       - When registering source types, check for required functions (wasn't
         doing it before).  getheight/getwidth should not be optional if it's
         a video source as well.
      
       - Add an RAII OBSObj wrapper to obs.hpp for non-reference-counted
         libobs pointers
      
       - Add an RAII OBSSignal wrapper to obs.hpp for libobs signals to
         automatically disconnect them on destruction
      
       - Move the "scale and center" calculation in window-basic-main.cpp to
         its own function and in its own source file
      
       - Add an 'update' callback to WASAPI audio sources
      d9251f9e
  11. 17 3月, 2014 2 次提交
    • J
      Set defaults automatically · 3ed647b8
      jp9000 提交于
      Automatically query defaults for sources/outputs/encoders and set them
      before calling create
      3ed647b8
    • J
      Implement encoder interface (still preliminary) · fd37d9e9
      jp9000 提交于
       - Implement OBS encoder interface.  It was previously incomplete, but
         now is reaching some level of completion, though probably should
         still be considered preliminary.
      
         I had originally implemented it so that encoders only have a 'reset'
         function to reset their parameters, but I felt that having both a
         'start' and 'stop' function would be useful.
      
         Encoders are now assigned to a specific video/audio media output each
         rather than implicitely assigned to the main obs video/audio
         contexts.  This allows separate encoder contexts that aren't
         necessarily assigned to the main video/audio context (which is useful
         for things such as recording specific sources).  Will probably have
         to do this for regular obs outputs as well.
      
         When creating an encoder, you must now explicitely state whether that
         encoder is an audio or video encoder.
      
         Audio and video can optionally be automatically converted depending
         on what the encoder specifies.
      
         When something 'attaches' to an encoder, the first attachment starts
         the encoder, and the encoder automatically attaches to the media
         output context associated with it.  Subsequent attachments won't have
         the same effect, they will just start receiving the same encoder data
         when the next keyframe plays (along with SEI if any).  When detaching
         from the encoder, the last detachment will fully stop the encoder and
         detach the encoder from the media output context associated with the
         encoder.
      
         SEI must actually be exported separately; because new encoder
         attachments may not always be at the beginning of the stream, the
         first keyframe they get must have that SEI data in it.  If the
         encoder has SEI data, it needs only add one small function to simply
         query that SEI data, and then that data will be handled automatically
         by libobs for all subsequent encoder attachments.
      
       - Implement x264 encoder plugin, move x264 files to separate plugin to
         separate necessary dependencies.
      
       - Change video/audio frame output structures to not use const
         qualifiers to prevent issues with non-const function usage elsewhere.
         This was an issue when writing the x264 encoder, as the x264 encoder
         expects non-const frame data.
      
         Change stagesurf_map to return a non-const data type to prevent this
         as well.
      
       - Change full range parameter of video scaler to be an enum rather than
         boolean
      fd37d9e9
  12. 11 3月, 2014 1 次提交
    • J
      Add preliminary streaming code for testing · 02a07ea0
      jp9000 提交于
       - Add some temporary streaming code using FFmpeg.  FFmpeg itself is not
         very ideal for streaming; lack of direct control of the sockets and
         no framedrop handling means that FFmpeg is definitely not something
         you want to use without wrapper code.  I'd prefer writing my own
         network framework in this particular case just because you give away
         so much control of the network interface.  Wasted an entire day
         trying to go through FFmpeg issues.
      
         There's just no way FFmpeg should be used for real streaming (at
         least without being patched or submitting some sort of patch, but I'm
         sort of feeling "meh" on that idea)
      
         I had to end up writing multiple threads just to handle both
         connecting and writing, because av_interleaved_write_frame blocks
         every call, stalling the main encoder thread, and thus also stalling
         draw signals.
      
       - Add some temporary user interface for streaming settings.  This is
         just temporary for the time being.  It's in the outputs section of
         the basic-mode settings
      
       - Make it so that dynamic arrays do not free all their data when the
         size just happens to be reduced to 0.  This prevents constant
         reallocation when an array keeps going from 1 item to 0 items.  Also,
         it was bad to become dependent upon that functionality.  You must now
         always explicitly call "free" on it to ensure the data is free, and
         that's how it should be.  Implicit functionality can lead to
         confusion and maintainability issues.
      02a07ea0
  13. 07 3月, 2014 1 次提交
    • J
      Add a way to get default settings · 7d48dbb1
      jp9000 提交于
       - Implement a means of obtaining default settings for an
         input/output/encoder.  obs_source_defaults for example will return
         the default settings for a particular source type.
      
       - Because C++ doesn't have designated initializers, use functions in
         the WASAPI plugin to register the sources instead.
      7d48dbb1
  14. 01 3月, 2014 1 次提交
    • J
      Be more consistent about log levels · 771eac60
      jp9000 提交于
      LOG_ERROR should be used in places where though recoverable (or at least
      something that can be handled safely), was unexpected, and may affect
      the user/application.
      
      LOG_WARNING should be used in places where it's not entirely unexpected,
      is recoverable, and doesn't really affect the user/application.
      771eac60
  15. 24 2月, 2014 1 次提交
  16. 22 2月, 2014 1 次提交
    • J
      For *_update, apply settings instead of replacing · 7fcec773
      jp9000 提交于
      Make it so obs_data settings input in to *_update are applied to the
      existing settings rather than fully replace the existing settings.  That
      way you can update with only certain specific settings, leaving other
      settings untouched.  Of course if you're already using the original
      settings pointer in the first place then you've already done that, so
      it'll just ignore it because you've already applied them.
      7fcec773
  17. 12 2月, 2014 1 次提交
    • J
      Revamp API and start using doxygen · 8e81d8be
      jp9000 提交于
      The API used to be designed in such a way to where it would expect
      exports for each individual source/output/encoder/etc.  You would export
      functions for each and it would automatically load those functions based
      on a specific naming scheme from the module.
      
      The idea behind this was that I wanted to limit the usage of structures
      in the API so only functions could be used.  It was an interesting idea
      in theory, but this idea turned out to be flawed in a number of ways:
      
       1.) Requiring exports to create sources/outputs/encoders/etc meant that
           you could not create them by any other means, which meant that
           things like faruton's .net plugin would become difficult.
      
       2.) Export function declarations could not be checked, therefore if you
           created a function with the wrong parameters and parameter types,
           the compiler wouldn't know how to check for that.
      
       3.) Required overly complex load functions in libobs just to handle it.
           It makes much more sense to just have a load function that you call
           manually.  Complexity is the bane of all good programs.
      
       4.) It required that you have functions of specific names, which looked
           and felt somewhat unsightly.
      
      So, to fix these issues, I replaced it with a more commonly used API
      scheme, seen commonly in places like kernels and typical C libraries
      with abstraction.  You simply create a structure that contains the
      callback definitions, and you pass it to a function to register that
      definition (such as obs_register_source), which you call in the
      obs_module_load of the module.
      
      It will also automatically check the structure size and ensure that it
      only loads the required values if the structure happened to add new
      values in an API change.
      
      The "main" source file for each module must include obs-module.h, and
      must use OBS_DECLARE_MODULE() within that source file.
      
      Also, started writing some doxygen documentation in to the main library
      headers.  Will add more detailed documentation as I go.
      8e81d8be
  18. 11 2月, 2014 1 次提交
  19. 07 2月, 2014 1 次提交
    • J
      Add planar audio support, improve test output · 3d6d4322
      jp9000 提交于
      - Add planar audio support.  FFmpeg and libav use planar audio for many
        encoders, so it was somewhat necessary to add support in libobs
        itself.
      
      - Improve/adjust FFmpeg test output plugin.  The exports were somewhat
        messed up (making me rethink how exports should be done).  Not yet
        functional; it handles video properly, but it still does not handle
        audio properly.
      
      - Improve planar video code.  The planar video code was not properly
        accounting for row sizes for each plane.  Specifying row sizes for
        each plane has now been added.  This will also make it more compatible
        with FFmpeg/libav.
      
      - Fixed a bug where callbacks wouldn't create properly in audio-io and
        video-io code.
      
      - Implement 'blogva' function to allow for va_list usage with libobs
        logging.
      3d6d4322
  20. 02 2月, 2014 1 次提交
    • J
      Add property list callbacks · 458325fc
      jp9000 提交于
      - Add property list callbacks to sources/outputs/encoders so that if
        necessary user interface can be automatically generated or perhaps a
        property list widget can be used for them.
      
      - Change some of the property API names.  obs_property_list_t felt a bit
        awkward when actually using it, so I just renamed it to
        obs_properties_t.
      
      - Removed the getdata/setdata nad getparam/setparam functions from
        sources/services, they will be superseded by the dynamic procedure
        call API.
      458325fc
  21. 29 1月, 2014 2 次提交
    • J
      Improve safety for settings usage · 9116be8d
      jp9000 提交于
      - Add 'set_default' functions to obs-data.*.  These functions ensure
        that a paramter exists and that the parameter is of a specific type.
        If not, it will create or overwrite the value with the default setting
        instead.
      
        These functions are meant to be explicitly called before using any of
        the 'get' functions.  The reason why it was designed this way is to
        encourage defaults to be set in a single place/function.
      
        For example, ideal usage is to create one function for your data,
        "set_my_defaults(obs_data_t data)", set all the default values within
        that function, and then call that function on create/update, that way
        all defaults are centralized to a single place.
      
      - Ensure that data passed to sources/encoders/outputs/etc is always
        valid, and not a null value.
      
      - While I'm remembering, fix a few defaults of the main program config
        file data.
      9116be8d
    • J
      Add a couple more setting data safety measures · c6300d09
      jp9000 提交于
      Prevent null dereferencing if data is null, instead just make the
      functions return and ignore the get/set requests.
      c6300d09
  22. 28 1月, 2014 1 次提交
    • J
      Implement settings interface for plugins · 6c442916
      jp9000 提交于
      Add a fairly easy to use settings interface that can be passed to
      plugins, and replaced the old character string system that was being
      used before.  The new data interface allows for an easier method of
      getting/altering settings for plugins, and is built to be serializable
      to/from JSON.
      
      Also, removed another wxFormBuilder file that was no longer in use.
      6c442916
  23. 27 1月, 2014 1 次提交
  24. 17 1月, 2014 3 次提交
    • J
      Use macros to improve safety loading callbacks · 8d63845d
      jp9000 提交于
      Just a minor fix mostly because I noticed that I kept accidentally
      forgetting to add checks to the code properly.  This is one of those
      cases where macros come in useful, as macros can automate the process
      and help prevent these mistakes from happening by accident.
      8d63845d
    • J
      Updated comments for outputs/encoders · ff1afac5
      jp9000 提交于
      Changed the comments to properly reflect the new callbacks, as I had
      forgotten to update the comments for them both.
      
      Also, changed "setbitrate" and "request_keyframe" return values to be
      boolean.
      ff1afac5
    • J
      Add preliminary output/encoder interface · 29b7d362
      jp9000 提交于
      - First, I redid the output interface for libobs.  I feel like it's
        going in a pretty good direction in terms of design.
      
        Right now, the design is so that outputs and encoders are separate.
        One or more outputs can connect to a specific encoder to receive its
        data, or the output can connect directly to raw data from libobs
        output itself, if the output doesn't want to use a designated encoder.
        Data is received via callbacks set when you connect to the encoder or
        raw output.  Multiple outputs can receive the data from a single
        encoder context if need be (such as for streaming to multiple channels
        at once, and/or recording with the same data).
      
        When an encoder is first connected to, it will connect to raw output,
        and start encoding.  Additional connections will receive that same
        data being encoded as well after that.  When the last encoder has
        disconnected, it will stop encoding.  If for some reason the encoder
        needs to stop, it will use the callback with NULL to signal that
        encoding has stopped.  Some of these things may be subject to change
        in the future, though it feels pretty good with this design so far.
        Will have to see how well it works out in practice versus theory.
      
      - Second, Started adding preliminary RTMP/x264 output plugin code.
      
        To speed things up, I might just make a direct raw->FFmpeg output to
        create a quick output plugin that we can start using for testing all
        the subsystems.
      29b7d362
  25. 30 12月, 2013 1 次提交
  26. 21 12月, 2013 1 次提交
  27. 03 12月, 2013 1 次提交
  28. 13 11月, 2013 1 次提交
  29. 15 10月, 2013 1 次提交
  30. 01 10月, 2013 1 次提交