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

357 Commits

Author SHA1 Message Date
Richard Stanway
935223be34 obs-outputs: Port windows socket loop from OBS Classic 2017-02-25 06:16:18 -08:00
jp9000
d1b78edbf3 obs-outputs: Increase default drop threshold
500ms is a bit unnecessarily low.
2017-01-24 15:54:25 -08:00
jp9000
5c27ab8d87 obs-output: Add ability to get congestion to rtmp output 2017-01-24 15:52:22 -08:00
Iblis Lin
7a15f670e1 obs-outputs: fix build error on freebsd
There is a build error on freebsd:
    error: invalid application of 'sizeof' to an incomplete type
    'struct sockaddr_in'

Include proper header file to solve this.

Ref:
https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html
2017-01-04 16:31:50 +08:00
jp9000
afe37773bc obs-outputs: Free encoder packet data manually
These aren't referenced encoder packets, so they must be freed manually.
2016-12-24 03:01:52 -08:00
Gol-D-Ace
69f0bc244a Update translations from Crowdin 2016-12-23 20:46:47 +01:00
jp9000
7d6e6eee79 libobs: Use reference counting for encoder packets
Prevents reallocation of encoded packet data.

Deprecates:
obs_duplicate_encoder_packet
obs_free_encoder_packet

Replaces those functions with:
obs_encoder_packet_ref
obs_encoder_packet_release
2016-12-08 03:27:39 -08:00
Richard Stanway
7df46d4a8e
obs-outputs: Fix librtmp IP bind / resolve behavior
Fixes a case where OBS would prefer trying to connect
to an IPv4 address even though you had bound it to an
IPv6 interface for example.
2016-11-30 22:11:17 +01:00
Gol-D-Ace
90e805ad9b Update translations from CrowdIn 2016-11-16 00:32:47 +01:00
jp9000
c5706d726b obs-outputs: Use correct variable for drop priority
There are two variables used for 'priority', the general marked frame
priority, and the drop priority.  They can sometimes be different
because some encoders don't always use the correct frame priority.
2016-11-13 16:29:23 -08:00
jp9000
ed85b22534 Update translations from CrowdIn 2016-11-03 13:32:52 -07:00
Warren Turkal
40a5436549 obs-ffmpeg: Fix a couple printf compiler warnings. 2016-10-30 19:56:08 -07:00
Gol-D-Ace
aadc7263c0 Update translations from Crowdin 2016-09-28 01:17:24 +02:00
Richard Stanway
4d23e84837
librtmp: Remove reconnect on close behavior
For some reason librtmp treats a close message as a request to reconnect.
It does this syncronously, and uses the same event processing so that
another close request will continue the cycle until the stack is exhausted
and the application crashes.

Fixes https://obsproject.com/mantis/view.php?id=634
2016-09-27 00:37:59 +02:00
jp9000
108a4aa40e obs-outputs: Add max shutdown timeout (30 seconds)
The maximum shutdown timeout value was added as a setting, but never
actually fully implemented.  This implements it properly, and sets its
default timeout value to 30 seconds.
2016-09-21 21:51:22 -07:00
jp9000
50d7cc8ae6 obs-outputs: Allow forced stop even when stopping 2016-09-09 17:39:20 -07:00
Richard Stanway
eca0ca8424
obs-outputs: Prefer IPv4 addresses for RTMP connections 2016-08-15 17:58:01 +02:00
jp9000
34590b4b6a obs-outputs: Allow p-frames to be dropped
Previously, for an unknown reason p-frames were marked as highest
priority along with i-frames (keyframes), which means they could not be
dropped.  This would cause a problem where if for whatever reason
there's too much congestion, data would continually buffer.  This fixes
the issue by dropping p-frames at a separate (higher) threshold than
b-frames.
2016-08-13 16:35:05 -07:00
jp9000
630207d590 obs-outputs: Improve frame drop testing
Measures packet data rate and sleeps to prevent data from going above
the set data rate.  Uncomment the TEST_FRAMEDROPS macro, then set
DROPTEST_MAX_KBPS to the desired kb/s (for example 3000 for 3000
kilobits per second), and then it will limit the data rate to that
specified amount, forcing the thread to sleep to ensure it can only
output the desired data rate.
2016-08-13 01:24:32 -07:00
jp9000
27ac2cf940 obs-outputs: Remove custom version from FMLE string
Causes issues with certain servers that don't parse it properly and only
expect a specific string.

Use the RTMP onMetaData to get the OBS version instead when possible.
2016-08-12 15:47:57 -07:00
Gol-D-Ace
cb036b2713 Update translations from Crowdin 2016-08-08 16:21:48 +02:00
jp9000
4f3fc21a20 obs-outputs: Fix author for net-if.* files
These files were heavily modified but originally written by:
B. Lee <bl4@postpile.net>
2016-07-31 05:45:36 -07:00
jp9000
289ccee447 obs-outputs: Add ability to bind to an IP address for RTMP 2016-07-29 15:47:30 -07:00
jp9000
9ebe5349fa obs-outputs: Add Bind-To-IP wrapper functions
Allows enumerating IP addresses so you can select the adapter/IP from
which to stream from.
2016-07-29 15:47:28 -07:00
Gol-D-Ace
81adb13f59 Update translations from Crowdin 2016-07-06 01:18:27 +02:00
jp9000
d7db0b8b01 (API Change) libobs: Fix output data cutoff on stop
(Note: This commit also modifies obs-ffmpeg and obs-outputs)

API Changed:
obs_output_info::void (*stop)(void *data);

To:
obs_output_info::void (*stop)(void *data, uint64_t ts);

This fixes the long-time design flaw where obs_output_stop and the
output 'stop' callback would just shut down the output without
considering the timing of when obs_output_stop was used, discarding any
possible buffering and causing the output to get cut off at an
unexpected timing.

The 'stop' callback of obs_output_info now takes a timestamp with the
expectation that the output will use that timestamp to stop output data
in accordance to that timing.  obs_output_stop now records the timestamp
at the time that the function is called and calls the 'stop' callback
with that timestamp.  If needed, obs_output_force_stop will still stop
the output immediately without buffering.
2016-06-22 14:10:39 -07:00
jp9000
605590606f obs-outputs: Remove send_remaining_packets
Because output stop timing has been fixed, there is no need to send the
remaining packets in the queue because it now just waits for the stop
timing anyway.
2016-06-20 02:56:33 -07:00
jp9000
e77e87007c obs-outputs: Remove unused variable 2016-05-26 09:10:21 -07:00
Gol-D-Ace
fe56a12867 Update translations from Crowdin 2016-05-14 00:27:59 +02:00
jp9000
b16557371c obs-outputs: Improve error handling when sending headers
There was no error checking when sending headers/metadata, so what would
happen is that if a header/metadata send failed (meaning the socket was
disconnected), it would continue to act as if it was still connected,
and it would block and lock up on the next send/recv call.
2016-04-26 20:14:31 -07:00
Gol-D-Ace
5ed7081213 Update translations from Crowdin 2016-04-23 10:29:21 +02:00
Richard Stanway
c42f666b02
obs-outputs: Fix assign instead of compare on socket address type
Detected by Coverity Scan (CID 92187, 92170)
2016-04-13 02:23:23 +02:00
jp9000
2f2cb138bb obs-outputs: Remove trailing/leading whitespace from key/url 2016-03-24 13:42:54 -07:00
jp9000
69da1151e0 Update translations from Crowdin 2016-03-19 12:08:48 -07:00
yogpstop
4b4ddbb33e obs-outputs: Add USE_SSL option (disabled by default)
Closes jp9000/obs-studio#487
2016-02-07 15:47:18 -08:00
jp9000
77c538bd33 obs-outputs: Disabled OpenSSL deprecated warnings on apple
Apple wants to get people to move over to their own crypto APIs instead
of using OpenSSL, so disable the warning in the files where OpenSSL is
used for the time being.
2016-02-07 15:33:10 -08:00
jp9000
867c58472e obs-outputs: Fix a few warnings in librtmp 2016-02-07 15:33:10 -08:00
dodgepong
ea9db8249b Add latest translations from CrowdIn 2016-01-31 18:28:35 -05:00
jp9000
d510b629c9 obs-outputs: Fix "sometimes uninitialized" warning
Fixes warning (clang):

variable 'added_packet' is used uninitialized whenever 'if' condition is
false [-Wsometimes-uninitialized]
2015-11-18 14:12:54 -08:00
jp9000
f0cf699c50 obs-outputs: Remove stop thread (unnecessary)
Since the RTMP_Close was moved to the send thread (where it should have
been) the stop thread now has no real purpose.
2015-11-18 14:00:28 -08:00
jp9000
f05f0592e0 obs-outputs: Don't allow new data if disconnected 2015-11-18 12:42:14 -08:00
jp9000
6a27da9bd7 obs-outputs: Use atomic load functions 2015-11-18 12:42:14 -08:00
jp9000
ba7b53f330 obs-outputs: Close stream in send thread 2015-11-18 07:49:51 -08:00
jp9000
ee55dafe24 obs-outputs: Atomically update 'active' variable 2015-11-18 07:48:27 -08:00
jp9000
07254d0390 obs-outputs: Call free_packets in init_connect
This may end up being a bit redundant, but it's just to ensure that the
packet buffer is free before connecting.
2015-11-17 07:51:46 -08:00
jp9000
d4df6c191f obs-outputs: Only log packets remaining if above 0 2015-11-17 07:49:05 -08:00
jp9000
226337a6ca obs-outputs: Check for recv error 2015-11-16 13:57:06 -08:00
Gol-D-Ace
2ee1d82860 Add latest translations from Crowdin 2015-11-16 21:04:55 +01:00
jp9000
ea69f9cf61 obs-outputs: Call recv when data received
Not calling recv when data is received will accumulate data in the
internal recveive buffer until it's full, in which case is will stop
acknowledging.  This can lead to unjustified disconnections.
2015-11-11 17:45:02 -08:00
jp9000
a6b69a0704 obs-outputs: Log network interface information (win32) 2015-11-11 16:52:48 -08:00
jp9000
b7f64c7482 obs-outputs: Use atomic bool functions 2015-11-03 15:03:40 -08:00
jp9000
40250a62f0 obs-outputs: Remove unnecessary variable
The 'stopping' variable is superfluous due to the fact that 'stop_event'
accomplishes essentially the same exact thing.
2015-11-02 18:36:09 -08:00
jp9000
730132853a obs-outputs: Join with correct thread on destroy
If there was an attempt to destroy the rtmp-stream output while it was
already connecting and stopping at the same time, it would try to join
with the stop thread rather than with the connect thread.  The connect
thread would then continue past destruction.
2015-11-02 15:53:12 -08:00
jp9000
3dab1ebb0a obs-outputs: Send stop signal if no service assigned
The code assumed that the service was valid when that may not be the
case by the time it gets to the code.
2015-11-02 15:52:05 -08:00
jp9000
247c6526cf obs-outputs: Assign names to RTMP threads 2015-11-02 14:52:43 -08:00
jp9000
e350eb5a4c obs-outputs: Stop in thread to prevent locking UI
Sometimes stopping a connection can lock up due to data that still
remains to be sent, and this would lock up the thread requesting the
stop (typically the UI thread).  So instead of locking up the calling
thread, spawn a new thread specifically for stopping so the calling
thread can continue uninterrupted.  If the user attempts to reconnect,
it will wait for the stop thread to complete in the connect thread
before attempting to connect.
2015-11-02 14:50:34 -08:00
jp9000
a0e112ffd9 obs-outputs: Remove unused thread return variable 2015-11-02 14:02:27 -08:00
jp9000
a2a372c141 obs-outputs: Log remaining packets 2015-11-02 13:55:52 -08:00
jp9000
8756115f67 obs-outputs: Have a timeout for backed up packets
If packets get backed up for too long of a time, just disconnect instead
of trying to output them all.
2015-11-01 15:13:37 -08:00
jp9000
071222029b obs-outputs: Stop packet input if disconnected 2015-11-01 14:57:55 -08:00
jp9000
3b48817a7b obs-outputs: Fix race condition
It's possible that packets would still be coming in while the packets
were being freed.
2015-11-01 14:52:49 -08:00
jp9000
c107181b9f obs-outputs: Stop output after joining send thread
The encoders were stopping before processing was completed, which could
cause the output to access data that's potentially invalidated.
2015-09-17 14:17:41 -07:00
jp9000
6285a47726 (API Change) libobs: Pass type data to get_name callbacks
API changed from:
obs_source_info::get_name(void)
obs_output_info::get_name(void)
obs_encoder_info::get_name(void)
obs_service_info::get_name(void)

API changed to:
obs_source_info::get_name(void *type_data)
obs_output_info::get_name(void *type_data)
obs_encoder_info::get_name(void *type_data)
obs_service_info::get_name(void *type_data)

This allows the type data to be used when getting the name of the
object (useful for plugin wrappers primarily).

NOTE: Though a parameter was added, this is backward-compatible with
older plugins due to calling convention.  The new parameter will simply
be ignored by older plugins, and the stack (if used) will be cleaned up
by the caller.
2015-09-16 09:21:12 -07:00
jp9000
1ca065b0f2 obs-outputs: Use name and version for encoder
My fault; should have realized that this would be better to do.  Uses
"obs-studio" as the name, and includes the version (same format as the
others)
2015-08-14 17:49:21 -07:00
Marc Chambers
db6d9bb042 obs-outputs: Include encoder name in RTMP flashVer
This will help ensure the receiving end knows that OBS is being used.

Closes jp9000/obs-studio#464
2015-08-14 15:58:55 -07:00
Jess Mayo
f1a6b37e8e obs-outputs: Add bounds checking to b64enc
This fixes "warning: unused parameter 'maxsize' [-Wunused-parameter]"
introduced when authentication was turned on.
2015-07-12 12:34:47 +09:00
Jess Mayo
cec88d2897 obs-outputs: Fix stuck "Connecting" with no key
With no stream key, no streams were actually being created.
This is a crazy configuration anyway, but it resulted in OBS getting
stuck in the "Connecting" state with no way to cancel.
We now just use the blank key and hope for the best.
2015-07-11 14:01:11 +09:00
Jess Mayo
1682d77df3 obs-outputs: Fix rtmp authentication
Reinstate flag checks in RTMP_Close that were erroneously removed.

Clear out the Link state before we establish a new connection. There is
too much state carried around during authentication that has no good
place to clear it in librtmp, which assumes a clean structure when the
connection is initially established.
2015-07-11 13:53:07 +09:00
jp9000
ad3d448f19 obs-ffmpeg: Use actual audio encoder sample rate
Uses the sample rate the audio encoder is running at for ffmpeg muxing
(in case the audio sample rate had to be changed by the encoder)
2015-07-09 10:44:24 -07:00
Jess Mayo
9f0abd69d1 obs-outputs: Fix crash with quit while connecting
We need to stop the stream even if it hasn't finished opening yet,
to make sure threads are cleaned up properly.
2015-07-08 13:12:47 +09:00
Jess Mayo
132e58fb31 obs-outputs: Enable rtmp authentication
Authentication code has been updated as per the changes to support
multiple streams.

Authentication is now also enabled by default, and should be a no-op
if the server does not request authentication or username and password
details are not provided.
2015-07-07 19:55:35 -07:00
jp9000
63b3cfb5b2 obs-outputs: Reset frame drop variables on start
These variables should be reset when a stream is restarted.
2015-04-18 00:47:00 -07:00
jp9000
0e2a5d2de2 obs-outputs: Do not drop I-frames
When frames were dropped, it would also drop I-frames, which can mess
with the keyframe calculation of certain services that depend on
I-frames in their output protocol (such as HLS).
2015-04-10 07:27:27 -07:00
dodgepong
a04548070c UI: Add latest translations from CrowdIn 2015-03-25 20:51:25 -04:00
jp9000
56f4dd5359 obs-outputs: Fix bug (headers not always sent)
If a disconnection occurs, the sent_headers would still be set to true,
and when a reconnect occurs, it would not send the headers again.
2015-03-07 10:11:18 -08:00
jp9000
c69b70b847 obs-outputs: Fix bug (RTMP only working once)
This was caused to do the new RTMP code that added support for multiple
streams; the stream index needs to be reset on RTMP_Close otherwise it
will keep using the wrong stream information.
2015-02-17 20:38:23 -08:00
jp9000
d3c8f81cc2 obs-outputs: Fix potential RTMP auth issue 2015-02-17 17:23:32 -08:00
Palana
8a3dd2ef8a librtmp: Try to parse IPv6 addresses
This should (hopefully) allow URLs of the form rtmp://[abcd::1]/app
2015-02-11 17:52:56 +01:00
Palana
ce25cf86b6 librtmp: Remember addrlen from getaddrinfo
OS X doesn't like sizeof(struct sockaddr_storage) as last parameter
for connect
2015-02-11 17:52:56 +01:00
Palana
b7375fd1be Revert "Revert "obs-outputs: Update to latest librtmp version""
This reverts commit ac72e0392d.
2015-02-11 17:40:14 +01:00
jp9000
ac72e0392d Revert "obs-outputs: Update to latest librtmp version"
This reverts commit 36666c6712.
2015-02-09 19:30:11 -08:00
dodgepong
eb918d01b4 Add latest translations from CrowdIn 2015-02-09 19:26:17 -05:00
jp9000
6b38fa35b0 Use _MSC_VER for MSVC-specific pragmas
These aren't used on mingw so they need to be surrounded by #ifdef
_MSC_VER
2015-02-09 03:49:18 -08:00
jp9000
73d3be9311 obs-outputs: Use INVALID_SOCKET instead of -1
On windows, for whatever reason sockets use the SOCKET type which is not
a signed integer.  Still, even though it's not a signed integer, -1 is
used to indicate an invalid socket, but the way you use it is via
microsoft's fabulously dumb little INVALID_SOCKET define, so we have to
make librtmp use that instead.
2015-02-09 03:49:17 -08:00
jp9000
5dfecab15c Fix windows printf format warnings (from mingw) 2015-02-09 03:49:14 -08:00
martell
d161f92105 obs-output: avoid w32-pthreads for mingw-w64
mingw-w64 provides its own pthreads library.

Also, change link libs as mingw-w64 libraries are not postfixed .lib
2015-02-09 03:41:52 -08:00
jp9000
e1acd93002 obs-outputs: Remove trailing whitespace 2015-02-04 16:51:56 -08:00
jp9000
7c5034d58f obs-outputs: Add support for multi-track RTMP
Certain RTMP services will support multi audio tracks via RTMP.  This
updates librtmp with custom code that enables multiple streams per
connection to be used; each subsequent stream typically containing extra
audio tracks.  The audio encoder names are used to indicate the names of
tracks, and the name of the tracks are used for the stream keys for
those subsequent tracks.
2015-02-04 16:51:56 -08:00
jp9000
36666c6712 obs-outputs: Update to latest librtmp version
Should be all the fixes and updates made by R1CH, mostly bug fixes as
well as IPv6 support
2015-02-04 16:51:55 -08:00
jp9000
84e1f47ced (API Change) Add support for multiple audio mixers
API changed:
--------------------------

void obs_output_set_audio_encoder(
		obs_output_t *output,
		obs_encoder_t *encoder);

obs_encoder_t *obs_output_get_audio_encoder(
		const obs_output_t *output);

obs_encoder_t *obs_audio_encoder_create(
		const char *id,
		const char *name,
		obs_data_t *settings);

Changed to:
--------------------------

/* 'idx' specifies the track index of the output */
void obs_output_set_audio_encoder(
		obs_output_t *output,
		obs_encoder_t *encoder,
		size_t idx);

/* 'idx' specifies the track index of the output */
obs_encoder_t *obs_output_get_audio_encoder(
		const obs_output_t *output,
		size_t idx);

/* 'mixer_idx' specifies the mixer index to capture audio from */
obs_encoder_t *obs_audio_encoder_create(
		const char *id,
		const char *name,
		obs_data_t *settings,
		size_t mixer_idx);

Overview
--------------------------
This feature allows multiple audio mixers to be used at a time.  This
capability was able to be added with surprisingly very little extra
overhead.  Audio will not be mixed unless it's assigned to a specific
mixer, and mixers will not mix unless they have an active mix
connection.

Mostly this will be useful for being able to separate out specific audio
for recording versus streaming, but will also be useful for certain
streaming services that support multiple audio streams via RTMP.

I didn't want to use a variable amount of mixers due to the desire to
reduce heap allocations, so currently I set the limit to 4 simultaneous
mixers; this number can be increased later if needed, but honestly I
feel like it's just the right number to use.

Sources:

Sources can now specify which audio mixers their audio is mixed to; this
can be a single mixer or multiple mixers at a time.  The
obs_source_set_audio_mixers function sets the audio mixer which an audio
source applies to.  For example, 0xF would mean that the source applies
to all four mixers.

Audio Encoders:

Audio encoders now must specify which specific audio mixer they use when
they encode audio data.

Outputs:

Outputs that use encoders can now support multiple audio tracks at once
if they have the OBS_OUTPUT_MULTI_TRACK capability flag set.  This is
mostly only useful for certain types of RTMP transmissions, though may
be useful for file formats that support multiple audio tracks as well
later on.
2015-02-04 16:51:29 -08:00
Akagi201
471d87c940 obs-outputs: Add #pragma once to rtmp-helpers.h 2015-01-16 00:19:17 -08:00
jp9000
a7d2450d8e obs-outputs: Fix FLV corruption bug
The 'sent_headers' member variable of the FLV output would not be reset
when the output was restarted, causing important data to not be written,
thus creating an invalid FLV file.
2014-12-31 04:03:46 -08:00
jp9000
3412a0e190 obs-outputs: Wait for packet before header output
Waiting for the first packet to arrive before sending the headers helps
prevent issues with certain types of encoders that may not get their
header/SEI until the first packet has been received.
2014-12-21 10:14:23 -08:00
Lexsus
9c34be8af1 obs-outputs: Allow blank RTMP stream key usage
Allows a blank stream key to be used for RTMP streams.
2014-11-18 03:45:49 -08:00
dodgepong
17804ec12f Add latest translations from CrowdIn 2014-10-31 21:02:47 -04:00
Ben Torell
958b5c12de Latest translations from Crowdin 2014-10-11 18:47:35 -04:00
Palana
94a93abb2b (API Change) Pass data to get_properties when possible 2014-10-01 15:39:57 +02:00
jp9000
c9df41c1e2 (API Change) Remove pointers from all typedefs
Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
2014-09-25 21:48:11 -07:00
dodgepong
a221fee3d2 Add latest translations from CrowdIn 2014-08-25 14:41:52 -07:00
BtbN
02725acdd4 Fix double invocation of install_obs_plugin in every single plugin 2014-08-19 14:24:59 +02:00
jp9000
38d2cf591d Use the correct logging name for FLV outputs 2014-08-12 01:08:23 -07:00
jp9000
6680d3230a Improve FLV output logging
Log when the FLV file output has started and when it has finished.
2014-08-12 01:00:12 -07:00
jp9000
f75a1ebf63 Plugins: Use new encoder/output size functions 2014-08-10 17:10:20 -07:00
jp9000
42a0925ce1 (API Change) media-io: Improve naming consistency
Renamed:                        To:
-----------------------------------------------------------
audio_output_blocksize          audio_output_get_block_size
audio_output_planes             audio_output_get_planes
audio_output_channels           audio_output_get_channels
audio_output_samplerate         audio_output_get_sample_rate
audio_output_getinfo            audio_output_get_info
audio_output_createline         audio_output_create_line
video_output_getinfo            video_output_get_info
video_gettime                   video_output_get_time
video_getframetime              video_output_get_frame_time
video_output_width              video_output_get_width
video_output_height             video_output_get_height
video_output_framerate          video_output_get_frame_rate
video_output_num_skipped_frames video_output_get_skipped_frames
video_output_total_frames       video_output_get_total_frames
2014-08-09 11:57:37 -07:00
jp9000
9d300685ca (API Change) Unsquish libobs/util
Changed:                      To:
-----------------------------------------------------------
dstr_isempty                  dstr_is_empty
cf_lexer_gettokens            cf_lexer_get_tokens
cf_preprocessor_gettokens     cf_preprocessor_get_tokens
2014-08-09 11:57:37 -07:00
jp9000
04712b5fe9 (API Change) Unsquish obs_data_* names
Changed:                 To:
-----------------------------------------------
obs_data_getjson         obs_data_get_json
obs_data_getstring       obs_data_get_string
obs_data_getint          obs_data_get_int
obs_data_getdouble       obs_data_get_double
obs_data_getbool         obs_data_get_bool
obs_data_getobj          obs_data_get_obj
obs_data_getarray        obs_data_get_array
obs_data_setstring       obs_data_set_string
obs_data_setint          obs_data_set_int
obs_data_setdouble       obs_data_set_double
obs_data_setbool         obs_data_set_bool
obs_data_setobj          obs_data_set_obj
obs_data_setarray        obs_data_set_array
obs_data_item_getstring  obs_data_item_get_string
obs_data_item_getint     obs_data_item_get_int
obs_data_item_getdouble  obs_data_item_get_double
obs_data_item_getbool    obs_data_item_get_bool
obs_data_item_getobj     obs_data_item_get_obj
obs_data_item_getarray   obs_data_item_get_array
obs_data_item_setstring  obs_data_item_set_string
obs_data_item_setint     obs_data_item_set_int
obs_data_item_setdouble  obs_data_item_set_double
obs_data_item_setbool    obs_data_item_set_bool
obs_data_item_setobj     obs_data_item_set_obj
obs_data_item_setarray   obs_data_item_set_array
2014-08-09 11:57:36 -07:00
jp9000
2d606dd8d8 (API Change) Use 'get' convention: API callbacks
Renamed:                       To:
-------------------------------------------------------
obs_source_info::defaults       obs_source_info::get_defaults
obs_source_info::properties     obs_source_info::get_properties
obs_output_info::defaults       obs_output_info::get_defaults
obs_output_info::properties     obs_output_info::get_properties
obs_output_info::total_bytes    obs_output_info::get_total_bytes
obs_output_info::dropped_frames obs_output_info::get_dropped_frames
obs_encoder_info::defaults      obs_encoder_info::get_defaults
obs_encoder_info::properties    obs_encoder_info::get_properties
obs_encoder_info::extra_data    obs_encoder_info::get_extra_data
obs_encoder_info::sei_data      obs_encoder_info::get_sei_data
obs_encoder_info::audio_info    obs_encoder_info::get_audio_info
obs_encoder_info::video_info    obs_encoder_info::get_video_fino
obs_service_info::defaults      obs_service_info::get_defaults
obs_service_info::properties    obs_service_info::get_properties
2014-08-09 11:57:30 -07:00
jp9000
c83d05117f (API Change) Unsquish libobs API callback names
Renamed:                    To:
-------------------------------------------------------
obs_source_info::getname    obs_source_info::get_name
obs_source_info::getwidth   obs_source_info::get_width
obs_source_info::getheight  obs_source_info::get_height
obs_output_info::getname    obs_output_info::get_name
obs_encoder_info::getname   obs_encoder_info::get_name
obs_service_info::getname   obs_service_info::get_name
2014-08-08 11:04:46 -07:00
jp9000
73baaa59e9 (API Change) Unsquish libobs (base) names
Previous names:             New names:
-----------------------------------------------------------
obs_view_setsource          obs_view_set_source
obs_view_getsource          obs_view_get_source
obs_source_getdisplayname   obs_source_get_display_name
obs_source_getwidth         obs_source_get_width
obs_source_getheight        obs_source_get_height
obs_filter_getparent        obs_filter_get_parent
obs_filter_gettarget        obs_filter_get_target
obs_source_filter_setorder  obs_source_filter_set_order
obs_source_getsettings      obs_source_get_settings
obs_source_getname          obs_source_get_name
obs_source_setname          obs_source_set_name
obs_source_setvolume        obs_source_set_volume
obs_source_getvolume        obs_source_get_volume
obs_scene_getsource         obs_scene_get_source
obs_scene_fromsource        obs_scene_from_source
obs_scene_findsource        obs_scene_find_source
obs_output_getdisplayname   obs_output_get_display_name
obs_output_getname          obs_output_get_name
obs_encoder_getname         obs_encoder_get_name
obs_service_getdisplayname  obs_service_get_display_name
obs_service_getname         obs_service_get_name
2014-08-08 11:04:46 -07:00
jp9000
892fdea83e Remove macro to free locale
This functionality can now be handled automatically because locale can
now be freed seaparately from obs_module_unload with
obs_module_free_locale, which is called automatically when the module is
being freed.
2014-07-27 17:29:10 -07:00
jp9000
f0ac19abba Remove version parameter from obs_module_load
Replaced by obs_get_version() API
2014-07-27 17:29:10 -07:00
BtbN
38c2fc87aa Move all data into the subdir it belongs to
Completely removes the build dir in favor of cmake based build layouting
2014-07-19 01:38:41 +02:00
jp9000
4c539a427d Use OBS_CONFIG as version string for the FLV mux 2014-07-14 09:52:36 -07:00
jp9000
1188ad7561 Fix unreachable code warning 2014-07-12 12:00:12 -07:00
jp9000
482791c5b6 Add locale for modules 2014-07-11 17:29:00 -07:00
jp9000
0364672cbb rtmp-stream: Add statistics callbacks
Add callbacks for total bytes sent and number of dropped frames
2014-07-06 17:36:45 -07:00
jp9000
be2b0d1398 rtmp-stream: Change TEST_FRAMEDROPS to just sleep
Instead of making the send buffer size super small, just do a sleep when
sending data to simulate the inability to send out as much data as
desired.
2014-07-06 17:35:26 -07:00
jp9000
0b398cfad9 rtmp-stream: Log when user stops the stream 2014-07-02 00:24:55 -07:00
jp9000
697acbb4d5 rtmp-stream: Use helper log macros
Use warn/info/debug helper macro functions to output
warnings/information/debug log data that's preformatted to include the
module and the current output name.
2014-07-02 00:20:50 -07:00
jp9000
de478d3295 Change drop threshold to macro, use milliseconds
Like with other plugins, a macro is ideal for preventing typos and
misspellings of the setting.  Also, add a property for drop threshold.
2014-07-01 15:08:01 -07:00
jp9000
a527f30b94 rtmp-output: Remove unused properties 2014-07-01 15:05:15 -07:00
jp9000
058f3ca7b0 Remove FILE_TEST macro from rtmp-stream.c 2014-07-01 13:41:55 -07:00
jp9000
5c5f63e8b8 Output version/commit to RTMP stream metadata
Might come in useful for debugging issues later on.
2014-07-01 13:41:32 -07:00
jp9000
0b4a259e56 Remove 'locale' parameter from all callbacks
The locale parameter was a mistake, because it puts extra needless
burden upon the module developer to have to handle this variable for
each and every single callback function.  The parameter is being removed
in favor of a single centralized module callback function that
specifically updates locale information for a module only when needed.
2014-06-25 12:36:26 -07:00
jp9000
74b4743bce Remove 'locale' from properties
Having the value stored here is somewhat pointless, so this is one step
in fixing the locale handling.  Locale should be handled by the modules
themselves with their own loaded locale lookup information.
2014-06-25 12:36:26 -07:00
BtbN
862840b3a0 Hide librtmp symbols so they don't collide with system libraries 2014-05-24 14:13:44 +02:00
jp9000
1d2e5d50a4 Add FLV file output code
This doesn't add FLV file output to the user interface yet, but we'll
get around to that eventually.  This just adds an FLV output type.

Also, removed ftello/fseeko because off_t is a really annoying data
type, and I'd rather have a firm int64_t for large sizes, so I named it
to os_fseeki64 and os_ftelli64 instead, and changed the file size
function to return an int64_t.
2014-05-16 00:18:23 -07:00
jp9000
03ca5919ce UI: Add popup warnings for connection failure
Also, check for null stream path/key in the RTMP output module.
2014-05-12 15:34:46 -07:00
BtbN
b3adef6c8d Fix all warnings in rtmp output 2014-05-10 03:40:23 +02:00
BtbN
ce542525fc Fix dependency on win32-pthreads 2014-05-08 14:43:16 +02:00
fryshorts
48391beacd Close rtmp connection when stream is stopped.
This will close the connection to the server when the stream
is stopped.
2014-04-26 02:04:37 +02:00
jp9000
89e02ca73c obs-outputs: Log connections/disconnections 2014-04-24 21:11:46 -07:00
Palana
07ab8271b6 Remove setsockopt for SIGPIPE; disable SIGPIPE via signal() on non-WIN32 2014-04-24 23:50:40 +02:00
Palana
138bf4cc1e Disable SIGPIPE for RTMP socket in librtmp 2014-04-24 23:28:12 +02:00
jp9000
8830c4102f obs-studio UI: Implement stream settings UI
- 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.
2014-04-24 02:19:03 -07:00
jp9000
a4a52d1c87 Fix bug where packets weren't interleaving
Packets were not interleaving, thus new data was being sent out with
potentially non-monotonically increasing timestamps
2014-04-14 02:02:59 -07:00
jp9000
b427397aa9 RTMP output: Implement frame drop code
A little bit of history about frame dropping:

I did a large number of experiments with frame dropping in old versions
of OBS1, and it's not an easy thing to deal with.  I tried just about
everything from standard i-frame delay, to large buffers, to dumping
packets, to super-unnecessarily-complex things that just ended up
causing more problems than they was worth.

When I did my experiments, I found that the most ideal frame drop system
(in terms of reducing the amount of total data that needed to be
dropped) was in the 0.4xx days where I had a 3 second frame-drop buffer
where I could calculate the actual buffer size in bytes, and then
intellgently choose packets in that buffer to trim it down to a specific
size while minimizing the number of p-frames and i-frames dropped, and
preventing the actual impact of dropped frames on the stream.  The
downside of it was that it required too much extra latency, and far too
many people complained about it, so it was removed in favor of the
current system.

The current system I just refer to just as 'packet dumping', which when
combined with low keyframe intervals (like most services use these
days), is the next-best method from my experience.  Just dump the buffer
when you reach a threshold of buffering (which I prefer to measure with
time rather than in size), then wait for a new i-frame.  Simple,
effective, and reduces the risk of consecutive buffering, while still
having fairly low impact on the stream output due to the low keyframe
interval of services.

By the way, audio will not (and should not ever) be dropped, lest you
end up with syncing issues (among other nasty things) specific to server
implementation.
2014-04-12 04:34:15 -07:00
jp9000
f98c006711 Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-04-10 12:03:59 -07:00
jp9000
519c4f4118 Fix issue when using multiple video encoders
- 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.
2014-04-10 11:59:42 -07:00
Palana
d0e3f0d6a3 Fix (debug build) warnings in librtmp 2014-04-08 15:57:21 +02:00
Palana
d45248d6ad Add preprocessor flag for librtmp network dumps
Fixes debug compilation on non-WIN32 targets due to undefined
netstackdump(_read) symbols
2014-04-08 15:41:12 +02:00
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
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
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
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
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
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
BtbN
074f9627b7 Fixup OSX Rpath for imported external libraries on install 2014-01-28 23:07:49 +01:00
jp9000
6c44291693 Implement settings interface for plugins
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.
2014-01-27 23:14:58 -07:00
BtbN
45ec80fb7d Full rewrite of all CMakeLists
CMake now works on all platforms
2014-01-24 18:56:32 +01:00
jp9000
fc8851e9f4 Add preliminary ffmpeg plugin (still testing)
- Added some code for FFmpeg output that I'm still playing around with.
  Right now I'm just trying to get it to output to file and try to
  understand the FFmpeg/libav APIs.  Hopefully in the future this plugin
  can be used for any sort of output to FFmpeg.

- Fixed a cast warning in audio-io.c with size_t -> uint32_t

- Renamed the 'video_info' and 'audio_info' structures to
  'video_conver_info' and 'audio_convert_info' to better represent their
  actual purpose, and to avoid confusion with 'audio_output_info' and
  'video_output_info' structures.

- Removed a few macros from obs-def.h that were at one point going to be
  used but no longer going to be used (at least for now)
2014-01-19 03:16:41 -07:00
jp9000
29b7d3621c Add preliminary output/encoder interface
- 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.
2014-01-16 22:34:51 -07:00
jp9000
62c2b1d74e Simplify media i/o interfaces
Completely revamped the entire media i/o data and handlers.  The
original idea was to have a system that would have connecting media
inputs and outputs, but at a certain point I realized that this was an
unnecessary complexity for what we wanted to do.  (Also, it reminded me
of directshow filters, and I HATE directshow with a passion, and
wouldn't wish it upon my greatest enemy)

Now, audio/video outputs are connected to directly, with better callback
handlers, and will eventually have the ability to automatically handle
conversions such as 4:4:4 to 4:2:0 when connecting to an input that uses
them.  Doing this will allow the video/audio i/o handlers to also
prevent duplicate conversion, as well as make it easier/simple to use.

My true goal for this is to make output and encoder plugins as simple to
create as possible.  I want to be able to be able to create an output
plugin with almost no real hassle of having to worry about image
conversions, media inputs/outputs, etc.  A plugin developer shouldn't
have to handle that sort of stuff when he/she doesn't really need to.

Plugins will be able to simply create a callback via obs_video() and/or
obs_audio(), and they will automatically receive the audio/video data in
the formats requested via a simple callback, without needing to do
almost anything else at all.
2014-01-14 01:58:47 -07:00
jp9000
409b011a8e cleaned up main internal data structure design, changed to reference counting for sources to ensure safe destruction of source objects from all parts of the system, added some service-related stuff for testing 2013-11-20 15:00:16 -07:00
jp9000
146e9a7dbd added support for jansson, added new output files, made some adjustments to the API, fixed a UI subclass issue 2013-11-13 06:24:20 -07:00