r632: Boost up the requirement for mjpegtools to 1.6.3
[cinelerra_cv/mob.git] / cinelerra / channel.C
blobd47b4ea6279521b007766921a4d7d28f6030767c
1 #include "channel.h"
2 #include "filexml.h"
3 #include <string.h>
5 // Channel table entry for the TV tuner
7 Channel::Channel()
9         reset();
12 Channel::Channel(Channel *channel)
14         reset();
15         printf("Channel::Channel(Channel *channel) not supported\n");
18 Channel::~Channel()
23 void Channel::reset()
25 // GUI options
26         use_frequency = 0;
27         use_fine = 0;
28         use_norm = 0;
29         use_input = 0;
31         title[0] = 0;
32         device_name[0] = 0;
33         entry = 0;
34         freqtable = 0;
35         fine_tune = 0;
36         input = 0;
37         norm = 0;
38         device_index = 0;
39         tuner = 0;
43 Channel& Channel::operator=(Channel &channel)
45         printf("Channel::operator= not supported.\n");
46         return *this;
49 void Channel::copy_settings(Channel *channel)
51         strcpy(this->title, channel->title);
52         this->entry = channel->entry;
53         this->freqtable = channel->freqtable;
54         this->fine_tune = channel->fine_tune;
55         this->input = channel->input;
56         this->norm = channel->norm;
57         this->device_index = channel->device_index;
58         this->tuner = channel->tuner;
61 void Channel::copy_usage(Channel *channel)
63         this->use_frequency = channel->use_frequency;
64         this->use_fine = channel->use_fine;
65         this->use_norm = channel->use_norm;
66         this->use_input = channel->use_input;
69 int Channel::load(FileXML *file)
71         int done = 0;
72         char *text;
75         while(!done)
76         {
77                 done = file->read_tag();
78                 if(!done)
79                 {
80                         if(file->tag.title_is("CHANNEL"))
81                         {
82                                 entry = file->tag.get_property("ENTRY", entry);
83                                 freqtable = file->tag.get_property("FREQTABLE", freqtable);
84                                 fine_tune = file->tag.get_property("FINE_TUNE", fine_tune);
85                                 input = file->tag.get_property("INPUT", input);
86                                 norm = file->tag.get_property("NORM", norm);
87                                 device_index = file->tag.get_property("DEVICE_INDEX", device_index);
88                                 tuner = file->tag.get_property("TUNER", tuner);
89                                 text = file->read_text();
90                                 strcpy(title, text);
91                         }
92                         else
93                         if(file->tag.title_is("/CHANNEL"))
94                                 return 0;
95                 }
96         }
97         return done;
100 int Channel::save(FileXML *file)
102         file->tag.set_title("CHANNEL");
103         file->tag.set_property("ENTRY", entry);
104         file->tag.set_property("FREQTABLE", freqtable);
105         file->tag.set_property("FINE_TUNE", fine_tune);
106         file->tag.set_property("INPUT", input);
107         file->tag.set_property("NORM", norm);
108         file->tag.set_property("DEVICE_INDEX", device_index);
109         file->tag.set_property("TUNER", tuner);
110         file->append_tag();
111         file->append_text(title);
112         file->tag.set_title("/CHANNEL");
113         file->append_tag();
114         file->append_newline();