home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / video / xmovie-1.5.3.tar.gz / xmovie-1.5.3.tar / xmovie-1.5.3 / xmovie / file.h < prev    next >
C/C++ Source or Header  |  2000-11-29  |  2KB  |  95 lines

  1. #ifndef FILE_H
  2. #define FILE_H
  3.  
  4. #include <stdio.h>
  5.  
  6.  
  7. #include "asset.inc"
  8. #include "file.inc"
  9. #include "filebase.inc"
  10. #include "mainwindow.inc"
  11. #include "sema.h"
  12.  
  13.  
  14. // ======================================= include file types here
  15.  
  16. // generic file opened by user
  17. class File
  18. {
  19. public:
  20.     File(MainWindow *mwindow);
  21.     ~File();
  22.  
  23.  
  24. // ===================================== start here
  25.     int set_processors(int cpus);
  26.     int set_mmx(int use_mmx);
  27.     int set_prebuffer(long size);
  28.  
  29. // return 0 if success/found format
  30. // return 1 if failure/file not found
  31. // return 2 if need format
  32. // return 3 if project
  33. // format may be preset by set_format
  34.     int open_file(Asset *asset);
  35.  
  36. // close file
  37.     int close_file();
  38.  
  39. // get length of file
  40.     long get_audio_length();
  41.     long get_video_length();
  42.  
  43. // get positions
  44.     int get_position(double &percentage, double &seconds);
  45.     long get_audio_position();
  46.     long get_video_position();
  47.     int end_of_audio();
  48.     int end_of_video();
  49.  
  50. // set positions
  51.     int set_audio_position(long x);
  52.     int set_video_position(long x);
  53. // set position in percentage
  54.     int set_position(double percentage);
  55. // Skip a certain number of frames forward.
  56.     int drop_frames(int frames);
  57. // Step back a frame
  58.     int frame_back();
  59.  
  60. // Set layer
  61.     int set_audio_stream(int stream);
  62.     int set_video_stream(int stream);
  63.  
  64. // read the number of samples of raw data for all audio channels
  65. // advances file pointer
  66. // return 1 if failed
  67.     int read_audio(char *buffer, long len);
  68.  
  69. // Rendering strategies
  70. // Can read directly into the frame buffer.
  71.     int frame_buffer_copy_possible(int color_model);
  72. // Can read YUV directly into frame buffer.
  73.     int yuv_copy_possible();
  74.  
  75.     int read_yuv_buffer(char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h);
  76.     int read_frame_buffer(unsigned char **frame_buffer, int w, int h, int bitmap_color_model);
  77. // read the frame at the current video position into a raw buffer of rows and columns
  78.     int read_frame(unsigned char *frame);
  79.  
  80.     int lock_read();
  81.     int unlock_read();
  82.  
  83.     Asset *asset;
  84.     FileBase *file; // virtual class for file type
  85.     MainWindow *mwindow;
  86.     Sema read_lock, write_lock;
  87.     int cpus;
  88.     int use_mmx;
  89.     long prebuffer_size;
  90.     long total_frames;
  91.     long total_samples;
  92. };
  93.  
  94. #endif
  95.