4 * Copyright (C) 2009 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #include "bcsignals.h"
24 #include "indexable.h"
26 #include "localsession.h"
30 Indexable::Indexable(int is_asset) : Garbage(is_asset ? "Asset" : "EDL")
32 index_state = new IndexState;
33 this->is_asset = is_asset;
34 this->folder_no = AW_MEDIA_FOLDER;
38 Indexable::~Indexable()
40 index_state->remove_user();
43 int Indexable::get_audio_channels()
48 int Indexable::get_sample_rate()
53 int64_t Indexable::get_audio_samples()
58 void Indexable::update_path(const char *new_path)
60 strcpy(path, new_path);
63 void Indexable::update_index(Indexable *src)
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();
74 void Indexable::copy_indexable(Indexable *src)
76 if( this == src ) return;
77 folder_no = src->folder_no;
78 update_path(src->path);
82 int Indexable::have_audio()
87 int Indexable::get_w()
92 int Indexable::get_h()
97 double Indexable::get_frame_rate()
102 int Indexable::have_video()
107 int Indexable::get_video_layers()
112 int64_t Indexable::get_video_frames()
117 const char *Indexable::get_title()
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;