4 * Copyright (C) 2008 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
28 #include "channel.inc"
29 #include "devicempeginput.inc"
33 #include "picture.inc"
34 #include "videodevice.inc"
39 VDeviceBase(VideoDevice *device);
40 virtual ~VDeviceBase();
42 virtual int open_input() { return 1; };
43 virtual int close_all() { return 1; };
44 virtual int has_signal() { return 0; };
45 virtual int create_channeldb(ArrayList<Channel*> *channeldb) { return 1; };
46 virtual int read_buffer(VFrame *frame) { return 1; };
47 virtual int write_buffer(VFrame *output, EDL *edl) { return 1; };
48 virtual void new_output_buffer(VFrame **output, int colormodel) {};
49 virtual ArrayList<int>* get_render_strategies() { return 0; };
50 virtual int get_shared_data(unsigned char *data, long size) { return 0; };
51 virtual int stop_sharing() { return 0; };
52 virtual int interrupt_crash() { return 0; };
53 // Extra work must sometimes be done in here to set up the device.
54 virtual int get_best_colormodel(Asset *asset);
55 virtual int drop_frames(int frames) { return 1; };
56 virtual int set_channel(Channel *channel) { return 0; };
57 virtual int set_captioning(int mode) { return 0; };
58 virtual int set_picture(PictureConfig *picture) { return 0; };
59 virtual double device_timestamp() {
60 struct timeval tv; gettimeofday(&tv, 0);
61 return tv.tv_sec + tv.tv_usec / 1000000.0;
63 virtual int start_toc(const char *path, const char *toc_path) { return -1; }
64 virtual int start_record(int fd, int bsz=0) { return -1; }
65 virtual int stop_record() { return -1; }
66 virtual int pause_input_device(int v) { return -1; }
67 virtual int total_video_streams() { return 1; }
68 virtual DeviceMPEGInput *mpeg_device() { return 0; }
70 virtual int open_output() { return 1; };
71 virtual int output_visible() { return 0; };
72 virtual int start_playback() { return 1; };
73 virtual int stop_playback() { return 1; };
74 virtual BC_Bitmap* get_bitmap() { return 0; };
75 // Most Linux video drivers don't work.
76 // Called by KeepaliveThread when the device appears to be stuck.
77 // Should restart the device if that's what it takes to get it to work.
78 virtual void goose_input() {};
80 // Called by Record::run to fix compression for certain devices.
81 // Not saved as default asset.
82 virtual void fix_asset(Asset *asset) {};
84 virtual int get_video_pid(int track) { return -1; }
85 virtual int get_video_info(int track, int &pid, double &framerate,
86 int &width, int &height, char *title=0) { return -1; }
87 virtual int get_thumbnail(int stream, int64_t &position,
88 unsigned char *&thumbnail, int &ww, int &hh) { return -1; }
89 virtual int set_skimming(int track, int skim, skim_fn fn, void *vp) { return -1; }