Implement output, improve video/audio subsystems
- Fill in the rest of the FFmpeg test output code for testing so it actually properly outputs data. - Improve the main video subsystem to be a bit more optimal and automatically output I420 or NV12 if needed. - Fix audio subsystem insertation and byte calculation. Now it will seamlessly insert new audio data in to the audio stream based upon its timestamp value. (Be extremely cautious when using floating point calculations for important things like this, and always round your values and check your values) - Use 32 byte alignment in case of future optimizations and export a function to get the current alignment. - Make os_sleepto_ns return true if slept, false if the time has already been passed before the call. - Fix sinewave output so that it actually properly calculates a middle C sinewave. - Change the use of row_bytes to linesize (also makes it a bit more consistent with FFmpeg's naming as well)
This commit is contained in:
44
libobs/obs.h
44
libobs/obs.h
@@ -116,7 +116,7 @@ struct source_audio {
|
||||
|
||||
struct source_frame {
|
||||
uint8_t *data[MAX_VIDEO_PLANES];
|
||||
uint32_t row_bytes[MAX_VIDEO_PLANES];
|
||||
uint32_t linesize[MAX_VIDEO_PLANES];
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint64_t timestamp;
|
||||
@@ -126,15 +126,6 @@ struct source_frame {
|
||||
bool flip;
|
||||
};
|
||||
|
||||
EXPORT struct source_frame *source_frame_alloc(enum video_format format,
|
||||
uint32_t width, uint32_t height);
|
||||
|
||||
static inline void source_frame_destroy(struct source_frame *frame)
|
||||
{
|
||||
bfree(frame->data[0]);
|
||||
bfree(frame);
|
||||
}
|
||||
|
||||
enum packet_priority {
|
||||
PACKET_PRIORITY_DISPOSABLE,
|
||||
PACKET_PRIORITY_LOW,
|
||||
@@ -597,6 +588,39 @@ EXPORT obs_service_t obs_service_create(const char *service,
|
||||
EXPORT void obs_service_destroy(obs_service_t service);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Source frame allocation functions */
|
||||
EXPORT void source_frame_init(struct source_frame *frame,
|
||||
enum video_format format, uint32_t width, uint32_t height);
|
||||
|
||||
static inline void source_frame_free(struct source_frame *frame)
|
||||
{
|
||||
if (frame) {
|
||||
bfree(frame->data[0]);
|
||||
memset(frame, 0, sizeof(struct source_frame));
|
||||
}
|
||||
}
|
||||
|
||||
static inline struct source_frame *source_frame_create(
|
||||
enum video_format format, uint32_t width, uint32_t height)
|
||||
{
|
||||
struct source_frame *frame;
|
||||
|
||||
frame = (struct source_frame*)bmalloc(sizeof(struct source_frame));
|
||||
memset(frame, 0, sizeof(struct source_frame));
|
||||
source_frame_init(frame, format, width, height);
|
||||
return frame;
|
||||
}
|
||||
|
||||
static inline void source_frame_destroy(struct source_frame *frame)
|
||||
{
|
||||
if (frame) {
|
||||
bfree(frame->data[0]);
|
||||
bfree(frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user