VLC  4.0.0-dev
vlc_fingerprinter.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_fingerprinter.h: Fingerprinter abstraction layer
3  *****************************************************************************
4  * Copyright (C) 2012 VLC authors and VideoLAN
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20 
21 #ifndef VLC_FINGERPRINTER_H
22 # define VLC_FINGERPRINTER_H
23 
24 #include <vlc_common.h>
25 #include <vlc_meta.h>
26 #include <vlc_input_item.h>
27 #include <vlc_arrays.h>
28 
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
32 
34 
36 {
38  unsigned int i_duration; /* track length hint in seconds, 0 if unknown */
39  struct
40  {
41  char *psz_fingerprint;
43  } results ;
44 };
46 
48 {
50  ( fingerprint_request_t * ) calloc( 1, sizeof( fingerprint_request_t ) );
51  if ( !p_r ) return NULL;
52  p_r->results.psz_fingerprint = NULL;
53  p_r->i_duration = 0;
54  input_item_Hold( p_item );
55  p_r->p_item = p_item;
56  vlc_array_init( & p_r->results.metas_array ); /* shouldn't be needed */
57  return p_r;
58 }
59 
60 static inline void fingerprint_request_Delete( fingerprint_request_t *p_f )
61 {
62  input_item_Release( p_f->p_item );
63  free( p_f->results.psz_fingerprint );
64  for( size_t i = 0; i < vlc_array_count( & p_f->results.metas_array ); i++ )
66  free( p_f );
67 }
68 
70 {
71  struct vlc_object_t obj;
72 
73  /* Specific interfaces */
74  fingerprinter_sys_t * p_sys;
75 
76  module_t * p_module;
77 
78  int ( *pf_enqueue ) ( struct fingerprinter_thread_t *f, fingerprint_request_t *r );
79  fingerprint_request_t * ( *pf_getresults ) ( struct fingerprinter_thread_t *f );
80  void ( *pf_apply ) ( fingerprint_request_t *, size_t i_resultid );
81 };
83 
86 
87 # ifdef __cplusplus
88 }
89 # endif
90 
91 #endif
struct fingerprint_request_t::@225 results
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:77
static void vlc_array_init(vlc_array_t *p_array)
Definition: vlc_arrays.h:264
static size_t vlc_array_count(vlc_array_t *p_array)
Definition: vlc_arrays.h:277
This file defines functions and structures for stream meta-data in vlc.
This file is a collection of common definitions and types.
Definition: vlc_fingerprinter.h:36
Internal module descriptor.
Definition: modules.h:75
Definition: vlc_arrays.h:258
unsigned int i_duration
Definition: vlc_fingerprinter.h:39
static fingerprint_request_t * fingerprint_request_New(input_item_t *p_item)
Definition: vlc_fingerprinter.h:48
vlc_array_t metas_array
Definition: vlc_fingerprinter.h:43
struct fingerprinter_sys_t fingerprinter_sys_t
Definition: vlc_fingerprinter.h:34
fingerprinter_thread_t * fingerprinter_Create(vlc_object_t *p_this)
Definition: fingerprinter.c:30
Definition: vlc_fingerprinter.h:70
void(* pf_apply)(fingerprint_request_t *, size_t i_resultid)
Definition: vlc_fingerprinter.h:81
static void fingerprint_request_Delete(fingerprint_request_t *p_f)
Definition: vlc_fingerprinter.h:61
#define VLC_API
Definition: fourcc_gen.c:31
Definition: meta.c:39
This file defines functions, structures and enums for input items in vlc.
void vlc_meta_Delete(vlc_meta_t *m)
Definition: meta.c:108
void input_item_Release(input_item_t *p_item)
Releases an input item, i.e.
Definition: item.c:476
input_item_t * p_item
Definition: vlc_fingerprinter.h:38
This file defines functions, structures and macros for handling arrays in vlc.
void fingerprinter_Destroy(fingerprinter_thread_t *p_fingerprint)
Definition: fingerprinter.c:54
VLC object common members.
Definition: vlc_objects.h:43
char * psz_fingerprint
Definition: vlc_fingerprinter.h:42
#define vlc_array_item_at_index(ar, idx)
Definition: vlc_arrays.h:283
input_item_t * input_item_Hold(input_item_t *p_item)
Holds an input item, i.e.
Definition: item.c:468