Commit graph

715 commits

Author SHA1 Message Date
jp9000 92522d1886 Implement RTMP module (still needs drop code)
- 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.
2014-04-07 22:00:10 -07:00
jp9000 7eec72245d Fix graphics device export header
Caused D3D11 library to fail on load.  Don't know how I didn't see this
sooner.
2014-04-07 01:31:13 -07:00
jp9000 59969844a1 Add comments to config-file.h
Someone got rather confused over what the "default" functions did, so
hopefully this clears it up a bit.
2014-04-07 01:29:56 -07:00
jp9000 fd24d0de2f Use atomics for allocation counter
I was getting cases where the CPU cache was causing issues with the
allocation counter, for the longest time I thought I was doing something
wrong, but when the allocation counter went below 0, I realized it was
because I didn't use atomics for incrementing/decrementing the
allocation counter variable.  The allocation counter now always should
have the correct value.
2014-04-07 01:25:38 -07:00
jp9000 906535022f Add window capture
Now that we have the priorties window in we can finally be able to
select windows for capture source such as window capture.  Only took
about an hour or two to write.

Also, fixed some depednency issues on winmm.lib with obs-outputs
2014-04-07 01:20:36 -07:00
Jim e78dc5aa51 Merge pull request #57 from jp9000/new-gl-loader
More extensions, less bugs
2014-04-06 19:55:00 -07:00
Zachary Lund 92f253d65f More extensions, less bugs 2014-04-06 16:21:19 -05:00
Jim 11c949f22c Merge pull request #56 from jp9000/new-gl-loader
Added GLX_NV_copy_image extension, updated tools
2014-04-05 17:36:27 -07:00
Zachary Lund 1dd3917745 Added GLX_NV_copy_image extension, updated tools 2014-04-05 13:49:19 -05:00
Jim 4250f6aec6 Merge pull request #55 from BtbN/ffmpeg
Add compatiblity for some older ffmpeg versions
2014-04-05 10:58:28 -07:00
Timo R 55d99b3731 Define DEBUG and _DEBUG on debug build 2014-04-05 16:32:48 +02:00
Timo R 15639d928c Add compatiblity for some older ffmpeg versions 2014-04-05 16:12:32 +02:00
jp9000 22aec1c391 Well, that was embarassing. (Remove size macro)
...I think I need sleep.  That last commit before this one shows it
quite clearly.
2014-04-05 01:49:21 -07:00
jp9000 ac43d9bb89 And fix another bug that I just made
Accidentally removed a function from the main module declaration macro.
2014-04-05 01:47:08 -07:00
jp9000 bd331c8ffe Remove the weird size stuff from OBS_DECLARE_MODULE
Instead of doing this, just use macros to handle this situation.

Also, fix a minor bug in AAC encoder
2014-04-05 01:45:53 -07:00
jp9000 7bfe15e4a9 AAC: Use obs_data_set_default_int function 2014-04-05 01:17:32 -07:00
jp9000 cabe98cb4e Add FFmpeg's AAC enoder
This just adds FFmpeg's default AAC encoder as an audio encoder.  Going
to try to start getting things going with the RTMP output library next.
2014-04-05 01:13:11 -07:00
jp9000 8c74db9ffc Add packet interleaving and improve encoder API
- 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.
2014-04-04 23:21:19 -07:00
Palana 42be968759 Make OBS basic and obs-ffmpeg-output use NV12 by default 2014-04-04 20:55:38 +02:00
Palana 4edadcc0a6 Add NV12 conversion shader 2014-04-04 20:55:38 +02:00
jp9000 1bca7e0a3e Improve properties API
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.
2014-04-04 00:30:37 -07:00
Zachary Lund baa57d4c39 Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-04-03 20:12:26 -05:00
Zachary Lund e5b90accb9 Removed no longer valid comment 2014-04-03 19:24:03 -05:00
Zachary Lund b4d2146861 This commit contains more than I intended. Read below for more info.
1) Fixed the preview window. It now correctly displays the source.
2) The GLX backend now correctly uses the devices current swap.
3) We now set device->cur_swap to a default so we don't have to check it in every function.
4) Minor syntactical cleanups and perhaps some messiness added.
2014-04-03 19:21:24 -05:00
Palana c2abb80c9a Use bzalloc instead of bmalloc+memset 2014-04-04 02:00:10 +02:00
Palana 61cf2faad3 Delete per window GL context for Cocoa and just swap the view instead
This unfortunately re-introduces undesirable rendering behaviour for
slow renderers (e.g. first gen Intel HD graphics/Apple software
renderer) when the property window is open, but fixes property window
preview rendering for sufficiently fast renderers
2014-04-04 02:00:08 +02:00
Zachary Lund ee9ff9cfb9 Use Qt provided display with GLX functions for consistency.
Remove unneeded assignment from previous code.
2014-04-03 17:36:01 -05:00
Jim 7b0feecfb7 Merge pull request #53 from BtbN/fixes
Fix gswindow display with Qt
2014-04-03 14:55:46 -07:00
BtbN a31e938c2b Fix getting the X11 display with the Qt ui 2014-04-03 23:41:22 +02:00
BtbN 23c3dfc6be Fix log_level check 2014-04-03 23:41:07 +02:00
jp9000 c25f10595d Fix bug where outputs wouldn't start up properly 2014-04-02 19:06:33 -07:00
jp9000 4a652ec82d obs-output module: Fill out more functions
- 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
2014-04-02 00:42:12 -07:00
Jim fd9d395509 Merge pull request #52 from BtbN/pfix
Several CMake fixes and enhancements
2014-04-01 13:56:14 -07:00
BtbN 293fa069f0 Remove hard dependency on PulseAudio 2014-04-01 22:19:57 +02:00
BtbN 044680f0b8 Add config.h generation and wrapper header, currently only for OBS_VERSION 2014-04-01 22:11:44 +02:00
BtbN 04dfcb2dea Disable strict-aliasing to avoid a bunch of possible problems 2014-04-01 21:37:50 +02:00
BtbN 221a69298b Add a new install function to install targets into the datadir structure
This is mainly intended to be used for preloaded/injected DLLs, which
don't belong into the libdir or plugindir.
2014-04-01 21:33:07 +02:00
BtbN acab80cbef Fixup libobs-opengl CMakeLists 2014-04-01 21:30:52 +02:00
BtbN b6983da045 Error on implicit declaration 2014-04-01 21:23:51 +02:00
BtbN 84bfb6e80b Add missing project directives 2014-04-01 21:19:31 +02:00
jp9000 c751d080e9 obs-outputs module: Use the correct deps variable 2014-04-01 12:06:17 -07:00
jp9000 0cf9e0cfdd Add preliminary FLV/RTMP output (incomplete)
- 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
2014-04-01 11:55:18 -07:00
jp9000 ed6fc7b122 Add librtmp to obs-outputs
Note that this is a somewhat heavily modified custom version of librtmp.
I modified all the platform specific code that we were using for the
OBS1 to make it platform-independent.

I don't really like the code in this library, but it works well enough,
so I can't really fault anyone for it.  It's just very..  unclean.  Even
for a C library, quite unclean.  Some parts are also a little less safe
than I'd prefer as well.
2014-04-01 11:48:28 -07:00
jp9000 d42ff7f0dd Improve serializer and add array serializer
The serializer code is meant to be used as a means of reading/writing
data from any arbitrary type of input/output.

The array output serializer makes it so we can stream data to a dynamic
array on the fly.
2014-04-01 11:27:27 -07:00
jp9000 263f940806 Fix CMakeLists.txt for each project (my fault) 2014-03-29 17:29:02 -07:00
jp9000 b2885480fa Minor fix to GL texture cleanup
Don't clear any data if it's a dummy texture.
2014-03-29 17:23:31 -07:00
jp9000 0a86e8fb3f Add dummy GL texture flag & direct object access
- Add dummy GL texture support to allow libobs texture references to be
   created for GL without

 - Add a texture_getobj function to allow the retrieval of the
   context-specific object, such as the D3D texture pointer, or the
   OpenGL texture object handle.

 - Also cleaned up the export stuff.  I realized it was all totally
   superfluous.  Kind of a dumb moment, but nice to clean it up
   regardless.
2014-03-29 17:19:31 -07:00
jp9000 6da26a3a1c Implement encoder usage with outputs
- 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.
2014-03-27 21:50:15 -07:00
Palana a439177a58 Release IOSurface only after it is no longer in use (e.g. by a texture) 2014-03-26 01:24:54 +01:00
Palana f8b90a5c8f Add per window GL context for Cocoa libobs-opengl implementation
This fixes some problems with multiple swap chains (e.g. flickering
between the render views)
2014-03-24 17:42:45 +01:00