VLC  4.0.0-dev
Data Structures | Macros | Functions
fetcher.c File Reference
Include dependency graph for fetcher.c:

Data Structures

struct  input_fetcher_t
 
struct  fetcher_request
 
struct  fetcher_thread
 

Macros

#define DEF_STARTER(name, worker)
 

Functions

static char * CreateCacheKey (input_item_t *item)
 
static void FreeCacheEntry (void *data, void *obj)
 
static int ReadAlbumCache (input_fetcher_t *fetcher, input_item_t *item)
 
static void AddAlbumCache (input_fetcher_t *fetcher, input_item_t *item, bool overwrite)
 
static int InvokeModule (input_fetcher_t *fetcher, input_item_t *item, int scope, char const *type)
 
static int CheckMeta (input_item_t *item)
 
static int CheckArt (input_item_t *item)
 
static int SearchArt (input_fetcher_t *fetcher, input_item_t *item, int scope)
 
static int SearchByScope (input_fetcher_t *fetcher, struct fetcher_request *req, int scope)
 
static void NotifyArtFetchEnded (struct fetcher_request *req, bool fetched)
 
static void Downloader (input_fetcher_t *fetcher, struct fetcher_request *req)
 
static void SearchLocal (input_fetcher_t *fetcher, struct fetcher_request *req)
 
static void SearchNetwork (input_fetcher_t *fetcher, struct fetcher_request *req)
 
static void RequestRelease (void *req_)
 
static void RequestHold (void *req_)
 
static void * FetcherThread (void *handle)
 
static int StartWorker (input_fetcher_t *fetcher, void(*pf_worker)(input_fetcher_t *, struct fetcher_request *), struct background_worker *bg, struct fetcher_request *req, void **handle)
 
static int ProbeWorker (void *fetcher_, void *th_)
 
static void CloseWorker (void *fetcher_, void *th_)
 
static int StartSearchLocal (void *fetcher_, void *req_, void **out)
 
static int StartSearchNetwork (void *fetcher_, void *req_, void **out)
 
static int StartDownloader (void *fetcher_, void *req_, void **out)
 
static void WorkerInit (input_fetcher_t *fetcher, struct background_worker **worker, int(*starter)(void *, void *, void **))
 
input_fetcher_tinput_fetcher_New (vlc_object_t *owner)
 This function creates the fetcher object and thread. More...
 
int input_fetcher_Push (input_fetcher_t *fetcher, input_item_t *item, input_item_meta_request_option_t options, const input_fetcher_callbacks_t *cbs, void *cbs_userdata)
 This function enqueues the provided item to be art fetched. More...
 
void input_fetcher_Delete (input_fetcher_t *fetcher)
 This function destroys the fetcher object and thread. More...
 

Macro Definition Documentation

◆ DEF_STARTER

#define DEF_STARTER (   name,
  worker 
)
Value:
static int Start ## name( void* fetcher_, void* req_, void** out ) { \
input_fetcher_t* fetcher = fetcher_; \
return StartWorker( fetcher, name, worker, req_, out ); }
static int StartWorker(input_fetcher_t *fetcher, void(*pf_worker)(input_fetcher_t *, struct fetcher_request *), struct background_worker *bg, struct fetcher_request *req, void **handle)
Definition: fetcher.c:347
const char name[16]
Definition: httpd.c:1269

Function Documentation

◆ AddAlbumCache()

static void AddAlbumCache ( input_fetcher_t fetcher,
input_item_t item,
bool  overwrite 
)
static

◆ CheckArt()

static int CheckArt ( input_item_t item)
static

◆ CheckMeta()

static int CheckMeta ( input_item_t item)
static

◆ CloseWorker()

static void CloseWorker ( void *  fetcher_,
void *  th_ 
)
static

◆ CreateCacheKey()

static char* CreateCacheKey ( input_item_t item)
static

Simple concatenation of artist and album can lead to the same key for entities that should not have such. Imagine { dogs, tick } and { dog, stick }

References asprintf(), input_item_t::lock, input_item_t::p_meta, vlc_meta_Album, vlc_meta_Artist, vlc_meta_Date, vlc_meta_Get(), vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by AddAlbumCache(), and ReadAlbumCache().

◆ Downloader()

static void Downloader ( input_fetcher_t fetcher,
struct fetcher_request req 
)
static

◆ FetcherThread()

static void* FetcherThread ( void *  handle)
static

◆ FreeCacheEntry()

static void FreeCacheEntry ( void *  data,
void *  obj 
)
static

References VLC_UNUSED.

Referenced by input_fetcher_Delete().

◆ input_fetcher_Delete()

void input_fetcher_Delete ( input_fetcher_t )

This function destroys the fetcher object and thread.

All pending input items will be released.

References input_fetcher_t::album_cache, background_worker_Delete(), input_fetcher_t::downloader, FreeCacheEntry(), input_fetcher_t::local, input_fetcher_t::network, and vlc_dictionary_clear().

Referenced by input_preparser_Delete().

◆ input_fetcher_New()

input_fetcher_t* input_fetcher_New ( vlc_object_t owner)

◆ input_fetcher_Push()

int input_fetcher_Push ( input_fetcher_t ,
input_item_t ,
input_item_meta_request_option_t  ,
const input_fetcher_callbacks_t ,
void *   
)

◆ InvokeModule()

static int InvokeModule ( input_fetcher_t fetcher,
input_item_t item,
int  scope,
char const *  type 
)
static

◆ NotifyArtFetchEnded()

static void NotifyArtFetchEnded ( struct fetcher_request req,
bool  fetched 
)
static

◆ ProbeWorker()

static int ProbeWorker ( void *  fetcher_,
void *  th_ 
)
static

References fetcher_thread::active, and VLC_UNUSED.

Referenced by WorkerInit().

◆ ReadAlbumCache()

static int ReadAlbumCache ( input_fetcher_t fetcher,
input_item_t item 
)
static

◆ RequestHold()

static void RequestHold ( void *  req_)
static

References fetcher_request::rc, and vlc_atomic_rc_inc().

Referenced by WorkerInit().

◆ RequestRelease()

static void RequestRelease ( void *  req_)
static

◆ SearchArt()

static int SearchArt ( input_fetcher_t fetcher,
input_item_t item,
int  scope 
)
static

References CheckArt(), and InvokeModule().

Referenced by SearchByScope().

◆ SearchByScope()

static int SearchByScope ( input_fetcher_t fetcher,
struct fetcher_request req,
int  scope 
)
static

◆ SearchLocal()

static void SearchLocal ( input_fetcher_t fetcher,
struct fetcher_request req 
)
static

◆ SearchNetwork()

static void SearchNetwork ( input_fetcher_t fetcher,
struct fetcher_request req 
)
static

◆ StartDownloader()

static int StartDownloader ( void *  fetcher_,
void *  req_,
void **  out 
)
static

Referenced by input_fetcher_New().

◆ StartSearchLocal()

static int StartSearchLocal ( void *  fetcher_,
void *  req_,
void **  out 
)
static

Referenced by input_fetcher_New().

◆ StartSearchNetwork()

static int StartSearchNetwork ( void *  fetcher_,
void *  req_,
void **  out 
)
static

Referenced by input_fetcher_New().

◆ StartWorker()

static int StartWorker ( input_fetcher_t fetcher,
void(*)(input_fetcher_t *, struct fetcher_request *)  pf_worker,
struct background_worker bg,
struct fetcher_request req,
void **  handle 
)
static

◆ WorkerInit()

static void WorkerInit ( input_fetcher_t fetcher,
struct background_worker **  worker,
int(*)(void *, void *, void **)  starter 
)
static