0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
Commit Graph

674 Commits

Author SHA1 Message Date
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
Palana
7707773f7c Add properties to osx display capture
Also add support for capturing displays that are not the main display as
preparation for moving the code from test-plugins into a proper plugin
in the future
2014-03-23 21:06:24 +01:00
jp9000
35d7d4ffb5 Initialize properties with current settings
I neglected to make it initialize the actual control values with the
current settings
2014-03-23 06:41:54 -07:00
jp9000
d9251f9e87 Add source properties window (very preliminary)
- 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
2014-03-23 01:07:54 -07:00
jp9000
6c904650b3 Fix GNU atomic builtins
The ones that were being used returned the previous value rather than
the new value
2014-03-17 14:16:05 -07:00
jp9000
950f780b81 Make sure ot use the right enum name
Microsoft's garbage compiler just doesn't even..  read the names of
enums.  It sees an enum and goes "durr, that's an int" without even
properly evaluating it.  Just total garbage, as per usual.
2014-03-16 20:44:27 -07:00
jp9000
291d9961cd obs-data: Internally store as int or double
If integers are used, then store as integers.  If doubles are used, then
store as doubles.  This way precision issues are prevented.
2014-03-16 20:38:13 -07:00
jp9000
2b4e381c3b Change a reference variable to be volatile long
Removed some warnings associated with it, was the wrong variable type.
2014-03-16 20:08:12 -07:00
jp9000
4444ca55f9 Fix Qt5 with debian-based builds (for real)
You have to use qt5_use_modules otherwise it just won't always work.  I
don't know how it was working before with cmake, but apparently this
does the trick to ensure that all the necessary libraries and includes
are added.  ..Might require cmake 3.8.9 though.  ..I do hope that
doesn't end up being a problem.
2014-03-16 20:06:00 -07:00
jp9000
154e0c59e1 Use atomic functions where appropriate
Also, rename atomic functions to be consistent with the rest of the
platform/threading functions, and move atomic functions to threading*
files rather than platform* files
2014-03-16 18:26:46 -07:00
jp9000
3ed647b8a0 Set defaults automatically
Automatically query defaults for sources/outputs/encoders and set them
before calling create
2014-03-16 17:42:37 -07:00
jp9000
3f771cf631 Add Qt5 to includes (caused issues with debian) *
* Not entirely sure if this will fix it, johnnypatterson claimed it
  would, but this checked out on my mac so at the very least I don't
  think it should hurt anything
2014-03-16 16:32:41 -07:00
jp9000
2920369daf Call send_packet instead of.. doing nothing
GCC warned of this, but strangely not clang.
2014-03-16 16:28:21 -07:00
jp9000
bb92d582bf Add atomic increment/decrement platform funcs 2014-03-16 16:23:11 -07:00
jp9000
fd37d9e9a8 Implement encoder interface (still preliminary)
- 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
2014-03-16 16:21:34 -07:00
jp9000
04d07831cc CoreAudio: If null device id, just set to default 2014-03-11 19:45:02 -07:00
jp9000
ae1fffef7a CoreAudio: Set default audio settings on creation
device_id would end up being null, which would mess with the functions.
2014-03-11 19:42:04 -07:00
jp9000
74a3dfcf69 Fix potential uninitialized variable
if (data->output->flags & AVFMT_RAWPICTURE)

If this was true, the 'ret' variable would be used without
initialization.
2014-03-11 16:07:22 -07:00
jp9000
6578c8b03e FFmpeg plugin: Fix null pointer reference 2014-03-11 14:46:34 -07:00
jp9000
2d6a7c89ca Remove trailing whitespaces from linux plugins 2014-03-11 10:12:54 -07:00
Jim
88e4e7f1be Merge pull request #49 from fryshorts/linux-input
linux input plugins for desktop and audio capture
2014-03-11 10:07:09 -07:00
jp9000
afc798f712 Also make sure the mutex unlocks
Otherwise deadlock
2014-03-11 09:16:16 -07:00
jp9000
c09a2efc3c FFmpeg plugin: Add a few checks to be safe
Make sure it locks the write mutex before freeing the packets, and put
the detach code in the main thread loop rather than off in a separate
function for clarity
2014-03-11 09:14:21 -07:00
fryshorts
32c8cd00c5 Fixed usage of event functions
The event functions got renamed in obs.
2014-03-11 14:16:03 +01:00
fryshorts
c0ab8fadda moved and split up the linux xshm and pulseaudio capture plugins 2014-03-11 14:06:10 +01:00
fryshorts
f28912101e Use default pulse audio frame format for recording
We use the default format to avoid any resampling by pulse audio,
since obs will probably resample anyways if necessary.
2014-03-11 14:01:10 +01:00
fryshorts
ce9db65695 changed to kernel formatting and added some more documentation 2014-03-11 14:01:10 +01:00
fryshorts
63d441e182 added functions to translate obs settings to pulse 2014-03-11 14:01:10 +01:00
fryshorts
f13ae77e00 disable blending for desktop capture 2014-03-11 14:01:10 +01:00
fryshorts
47a6f54910 use pa_mainloop_iterate instead of own implementation
pulse audio provides it's own convenience function to
iterate the mainloop, no need to use a custom one.
pulseaudio provides timing information for the stream, we use
that instead of system time.
2014-03-11 14:01:10 +01:00
fryshorts
9095ad0a00 reformatted source to kernel style 2014-03-11 14:01:10 +01:00
fryshorts
09a75c5394 fixed warnings 2014-03-11 14:01:10 +01:00
fryshorts
c558a7b6fa Removed unnecessary buffer
Instead of copying the data from pulse to a local buffer and
then push it to obs, the pointer from pulse is now used and
pa_stream_drop() called afterwards.
2014-03-11 14:01:10 +01:00
Ziemas
e67d7607e4 In the API update the diffuse effect got renamed to image. 2014-03-11 14:01:10 +01:00
fryshorts
42bc5eddbb added initial pulse audio input plugin
- first try at implementing a pulse audio input plugin,
  it is currently completely untested.

- added license headers to source files
2014-03-11 14:01:10 +01:00
fryshorts
c00d9e3b4e Moved screen grabber code to _tick function
Moved the screen grabbing and texture generation to the
_tick function in order to keep _render fast.
Migrated xshm video source to the new plugin api.
2014-03-11 14:01:09 +01:00
fryshorts
820de55ae2 Added initial Mouse pointer lib
Added library to get the mouse pointer with the XFixes
extension and draw it via a sprite.
2014-03-11 14:01:09 +01:00
fryshorts
12e1855ebc added linux test module with first implementation of a screengrabber using the xshm extension for x11 2014-03-11 14:01:09 +01:00
jp9000
3aedfdfb73 Fix wrong linux function
Used the mac function instead by accident
2014-03-10 19:27:59 -07:00
jp9000
5e1cac68f4 Fix semaphore mac code and mac plugin
Didn't convert the event names and didn't have the right mac includes
2014-03-10 19:24:09 -07:00
jp9000
c023ef69ea Fix non-windows event code
And remember to compile on non-windows systems before committing
2014-03-10 19:08:42 -07:00
jp9000
585fd8f969 Fix audio streaming and mac semaphores
...The reason why audio didn't work was because I overwrote the bitrate
values.

As for semaphores, mac doesn't support unnamed semaphores without using
mach semaphores.  So, I just implemented a semaphore wrapper for each
OS.
2014-03-10 19:04:00 -07:00