00001 #ifndef FILEDV_H
00002 #define FILEDV_H
00003
00004 #include "../config.h"
00005 #include "filebase.h"
00006 #include "file.inc"
00007
00008 #ifdef DV_USE_FFMPEG
00009 #include <ffmpeg/avcodec.h>
00010 #endif
00011
00012 #include <libdv/dv.h>
00013
00014
00015
00016 class FileDV : public FileBase
00017 {
00018 public:
00019 FileDV(Asset *asset, File *file);
00020 ~FileDV();
00021
00022 static void get_parameters(BC_WindowBase *parent_window,
00023 Asset *asset,
00024 BC_WindowBase* &format_window,
00025 int audio_options,
00026 int video_options);
00027
00028 int reset_parameters_derived();
00029 int open_file(int rd, int wr);
00030 static int check_sig(Asset *asset);
00031 int close_file();
00032 int close_file_derived();
00033 int64_t get_video_position();
00034 int64_t get_audio_position();
00035 int set_video_position(int64_t x);
00036 int set_audio_position(int64_t x);
00037 int write_samples(double **buffer, int64_t len);
00038 int write_frames(VFrame ***frames, int len);
00039 int read_compressed_frame(VFrame *buffer);
00040 int write_compressed_frame(VFrame *buffers);
00041 int64_t compressed_frame_size();
00042 int read_samples(double *buffer, int64_t len);
00043 int read_frame(VFrame *frame);
00044 int colormodel_supported(int colormodel);
00045 int can_copy_from(Edit *edit, int64_t position);
00046 static int get_best_colormodel(Asset *asset, int driver);
00047 int calculate_samples(int frame_count);
00048
00049 private:
00050 FILE *stream;
00051 #ifdef DV_USE_FFMPEG
00052 AVCodec *codec;
00053 AVCodecContext *context;
00054 AVFrame *picture;
00055 #endif // DV_USE_FFMPEG
00056 dv_decoder_t *decoder;
00057 dv_encoder_t *encoder;
00058 int64_t audio_position;
00059 int64_t video_position;
00060 unsigned char *output;
00061 unsigned char *input;
00062 int output_size;
00063 int64_t audio_offset;
00064 int64_t video_offset;
00065 int samples_offset[4];
00066 int frames_written;
00067 int16_t **audio_buffer;
00068 int samples_in_buffer;
00069 int isPAL;
00070 int current_frame;
00071 };
00072
00073
00074 class DVConfigAudio: public BC_Window
00075 {
00076 public:
00077 DVConfigAudio(BC_WindowBase *parent_window, Asset *asset);
00078 ~DVConfigAudio();
00079
00080 int create_objects();
00081 int close_event();
00082
00083 private:
00084 Asset *asset;
00085 BC_WindowBase *parent_window;
00086 };
00087
00088
00089
00090 class DVConfigVideo: public BC_Window
00091 {
00092 public:
00093 DVConfigVideo(BC_WindowBase *parent_window, Asset *asset);
00094 ~DVConfigVideo();
00095
00096 int create_objects();
00097 int close_event();
00098
00099 private:
00100 Asset *asset;
00101 BC_WindowBase *parent_window;
00102 };
00103
00104
00105 #endif