QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vlc_fingerprinter.h
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 
33 typedef struct fingerprinter_sys_t fingerprinter_sys_t;
34 
36 {
37  input_item_t *p_item;
38  unsigned int i_duration; /* track length hint in seconds, 0 if unkown */
39  struct
40  {
41  char *psz_fingerprint;
42  vlc_array_t metas_array;
43  } results ;
44 };
46 
47 static inline fingerprint_request_t *fingerprint_request_New( input_item_t *p_item )
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  vlc_gc_incref( 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  vlc_gc_decref( p_f->p_item );
63  free( p_f->results.psz_fingerprint );
64  for ( int i=0; i< vlc_array_count( & p_f->results.metas_array ) ; i++ )
65  vlc_meta_Delete( (vlc_meta_t *) vlc_array_item_at_index( & p_f->results.metas_array, i ) );
66  free( p_f );
67 }
68 
70 {
71  VLC_COMMON_MEMBERS
72 
73  /* Specific interfaces */
74  fingerprinter_sys_t * p_sys;
75 
76  module_t * p_module;
77  void ( *pf_run ) ( struct fingerprinter_thread_t * );
78 
79  void ( *pf_enqueue ) ( struct fingerprinter_thread_t *f, fingerprint_request_t *r );
80  fingerprint_request_t * ( *pf_getresults ) ( struct fingerprinter_thread_t *f );
81  void ( *pf_apply ) ( fingerprint_request_t *, int i_resultid );
82 };
84 
85 VLC_API fingerprinter_thread_t *fingerprinter_Create( vlc_object_t *p_this );
86 VLC_API void fingerprinter_Destroy( fingerprinter_thread_t *p_fingerprint );
87 
88 # ifdef __cplusplus
89 }
90 # endif
91 
92 #endif
Definition: vlc_input_item.h:55
Definition: vlc_fingerprinter.h:35
Definition: vlc_arrays.h:278
Definition: vlc_fingerprinter.h:69
Definition: vlc_objects.h:42