demux: ogg: rename field
[vlc.git] / include / vlc_fingerprinter.h
blobaba6d8e2b286e18632f2461be871d3711ab13ab8
1 /*****************************************************************************
2 * vlc_fingerprinter.h: Fingerprinter abstraction layer
3 *****************************************************************************
4 * Copyright (C) 2012 VLC authors and VideoLAN
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.
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.
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 *****************************************************************************/
21 #ifndef VLC_FINGERPRINTER_H
22 # define VLC_FINGERPRINTER_H
24 #include <vlc_common.h>
25 #include <vlc_meta.h>
26 #include <vlc_input_item.h>
27 #include <vlc_arrays.h>
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
33 typedef struct fingerprinter_sys_t fingerprinter_sys_t;
35 struct fingerprint_request_t
37 input_item_t *p_item;
38 unsigned int i_duration; /* track length hint in seconds, 0 if unknown */
39 struct
41 char *psz_fingerprint;
42 vlc_array_t metas_array;
43 } results ;
45 typedef struct fingerprint_request_t fingerprint_request_t;
47 static inline fingerprint_request_t *fingerprint_request_New( input_item_t *p_item )
49 fingerprint_request_t *p_r =
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;
60 static inline void fingerprint_request_Delete( fingerprint_request_t *p_f )
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++ )
65 vlc_meta_Delete( (vlc_meta_t *) vlc_array_item_at_index( & p_f->results.metas_array, i ) );
66 free( p_f );
69 struct fingerprinter_thread_t
71 struct vlc_common_members obj;
73 /* Specific interfaces */
74 fingerprinter_sys_t * p_sys;
76 module_t * p_module;
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 );
82 typedef struct fingerprinter_thread_t fingerprinter_thread_t;
84 VLC_API fingerprinter_thread_t *fingerprinter_Create( vlc_object_t *p_this );
85 VLC_API void fingerprinter_Destroy( fingerprinter_thread_t *p_fingerprint );
87 # ifdef __cplusplus
89 # endif
91 #endif