Hot folder implementation. More...
#include "skinkit.h"
#include "skinmon.h"
#include "hqmemcpy.h"
#include "swdevice.h"
#include "mem.h"
#include "file.h"
#include "hotfolderprv.h"
#include "hotfolder.h"
#include "pnotify.h"
#include "inputsapi.h"
#include "inputq.h"
#include "threadapi.h"
#include "timerapi.h"
#include "eventapi.h"
#include "swevents.h"
#include "timelineapi.h"
#include "swtimelines.h"
#include "inputserrors.h"
#include <string.h>
Data Structures | |
struct | hotfolder_entry_t |
struct | hotfolder_t |
Enumerations | |
enum | |
Functions | |
static void | merge_new_entries (hotfolder_t *folder) |
static hotfolder_result | hotfolder_destroy (hotfolder_t *folder) |
static void | hotfolder_file_stable (void *data) |
static void | hotfolder_stabilise (hqn_timer_t *timer, void *data) |
static void | hotfolder_new_file (void *data, const char *leafname, HqBool stable) |
static void | hotfolder_rescan (hqn_timer_t *timer, void *data) |
hotfolder_result | hotfolder_monitor (const uint8 *directory, const uint8 *setupname, const uint8 *overrideps, uint32 rescan_ms, uint32 stabilise_ms, HqBool append, sw_inputq_mkcontext_fn *mkcontext, void *mkdata) |
Add a hot folder for monitoring, along with a configuration that will be used to submit jobs to the input queue. More... | |
hotfolder_result | hotfolder_unmonitor (const uint8 *directory) |
Remove a hot folder from monitoring. More... | |
HqBool | hotfolder_start (void) |
void | hotfolder_end (void) |
Variables | |
static pthread_mutex_t | hotfolder_mutex = PTHREAD_MUTEX_INITIALIZER |
static hotfolder_t * | hotfolders = ((void*)0) |
static enum { ... } | hotfolder_state = K_HOTFOLDER_INIT |
Hot folder implementation.
anonymous enum |
The state of the SDK hotfolder system.
|
static |
Destroy a hotfolder, ensuring that all timers are cleaned up safely.
void hotfolder_end | ( | void | ) |
Finalise and stop the hot folder system.
|
static |
Indicate that a file is now stable, and submit it to the input queue. The entry pointer is passed through as a void pointer, because this function can be called by platform change notification API callbacks.
|
static |
Add an entry for a new file, that hasn't been seen before. It doesn't matter if the memory allocation fails, we'll pick it up on another rescan later. The folder pointer is passed through as a void pointer, because this function can be called by platform change notification API callbacks.
|
static |
Function to scan a hotfolder. The rescan function concerns itself with scanning the directory for added or removed files. It hands responsibility for ensuring files are stable and then submitting them to the RIP to the stabilisation timer. This split of responsibility is designed to enable the use of platform-specific change notification methods to reduce hotfolder latency.
|
static |
Function to scan just the unstable files in a hotfolder. This function is called from the stabilisation timer. If there are no remaining files to stabilise, then the timer deletes itself and removes the timer reference from the folder. This split of responsibility between adding/removing entries and stabilising entries is designed to enable the use of platform-specific change notification methods to reduce hotfolder latency.
HqBool hotfolder_start | ( | void | ) |
Initialise the Skinkit SDK hot folder system. This must be started after RDR, Events, Timer, and Input queue APIs.
|
static |
Merge the new entries list into the directory entries list safely. This is done when rescanning a hotfolder and when destroying a hotfolder. The caller is responsible for locking around this function if necessary.
|
static |
A single global lock for some hotfolder operations. We could use per-hotfolder and per-file entry locks or atomic operations, but the frequency of change is likely to be so low compared to processor speed that it's just not worth it.
enum { ... } hotfolder_state |
The state of the SDK hotfolder system.
|
static |
A global list of all hotfolders that are being monitored.