inter-view map media popup tweaks, new vicon mode/size prefs
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / indexable.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2009 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 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 General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "bcsignals.h"
23 #include "edl.h"
24 #include "indexable.h"
25 #include "language.h"
26 #include "localsession.h"
27
28 #include <string.h>
29
30 Indexable::Indexable(int is_asset) : Garbage(is_asset ? "Asset" : "EDL")
31 {
32         index_state = new IndexState;
33         this->is_asset = is_asset;
34         this->folder_no = AW_MEDIA_FOLDER;
35 }
36
37
38 Indexable::~Indexable()
39 {
40         index_state->remove_user();
41 }
42
43 int Indexable::get_audio_channels()
44 {
45         return 0;
46 }
47
48 int Indexable::get_sample_rate()
49 {
50         return 1;
51 }
52
53 int64_t Indexable::get_audio_samples()
54 {
55         return 0;
56 }
57
58 void Indexable::update_path(const char *new_path)
59 {
60         strcpy(path, new_path);
61 }
62
63 void Indexable::update_index(Indexable *src)
64 {
65         if( index_state == src->index_state ) return;
66         if( index_state ) index_state->remove_user();
67         index_state = src->index_state;
68         if( index_state ) index_state->add_user();
69 }
70
71
72
73
74 void Indexable::copy_indexable(Indexable *src)
75 {
76         if( this == src ) return;
77         folder_no = src->folder_no;
78         update_path(src->path);
79         update_index(src);
80 }
81
82 int Indexable::have_audio()
83 {
84         return 0;
85 }
86
87 int Indexable::get_w()
88 {
89         return 0;
90 }
91
92 int Indexable::get_h()
93 {
94         return 0;
95 }
96
97 double Indexable::get_frame_rate()
98 {
99         return 0;
100 }
101
102 int Indexable::have_video()
103 {
104         return 0;
105 }
106
107 int Indexable::get_video_layers()
108 {
109         return 0;
110 }
111
112 int64_t Indexable::get_video_frames()
113 {
114         return 0;
115 }
116
117 const char *Indexable::get_title()
118 {
119         if( is_asset ) return path;
120         EDL *edl = (EDL*)this;
121         if( !edl->parent_edl || folder_no == AW_PROXY_FOLDER ) return path;
122         return edl->local_session->clip_title;
123 }
124