00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef LIBMPEG3_PLUGIN_H
00021 #define LIBMPEG3_PLUGIN_H
00022
00023 #include <qstring.h>
00024 #include <qapplication.h>
00025 #include "libmpeg3.h"
00026 #include "mpeg3protos.h"
00027 #include <qpe/mediaplayerplugininterface.h>
00028
00029
00030
00031
00032
00033 class LibMpeg3Plugin : public MediaPlayerDecoder {
00034
00035 public:
00036 LibMpeg3Plugin() { file = NULL; }
00037 ~LibMpeg3Plugin() { close(); }
00038
00039 const char *pluginName() { return "LibMpeg3Plugin"; }
00040 const char *pluginComment() { return "This is the libmpeg3 library writen by ... which has been modified by trolltech to use fixed point maths"; }
00041 double pluginVersion() { return 1.0; }
00042
00043 bool isFileSupported( const QString& fileName ) { return mpeg3_check_sig( (char *)fileName.latin1() ) == 1; }
00044 bool open( const QString& fileName ) { file = mpeg3_open( (char *)fileName.latin1() ); return file != NULL; }
00045 bool close() { if ( file ) { int r = mpeg3_close( file ); file = NULL; return r == 1; } return FALSE; }
00046 bool isOpen() { return file != NULL; }
00047 const QString &fileInfo() { return strInfo = ""; }
00048
00049
00050 int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; }
00051 int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; }
00052 int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; }
00053
00054 int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; }
00055 bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; }
00056 long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; }
00057 #ifdef OLD_MEDIAPLAYER_API
00058 bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
00059 bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
00060 bool audioReadSamples( short *output, int channel, long samples, int stream );
00061 bool audioReReadSamples( short *output, int channel, long samples, int stream );
00062 #else
00063 bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream );
00064 #endif
00065
00066
00067 int videoStreams() { return file ? mpeg3_total_vstreams( file ) : 0; }
00068 int videoWidth( int stream ) { return file ? mpeg3_video_width( file, stream ) : 0; }
00069 int videoHeight( int stream ) { return file ? mpeg3_video_height( file, stream ) : 0; }
00070 double videoFrameRate( int stream ) { return file ? mpeg3_frame_rate( file, stream ) : 0.0; }
00071 int videoFrames( int stream )
00072 { return file ? mpeg3_video_frames( file, stream ) : 0; }
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 bool videoSetFrame( long frame, int stream ) { return file ? mpeg3_set_frame( file, frame, stream) == 1 : FALSE; }
00090 long videoGetFrame( int stream ) { return file ? mpeg3_get_frame( file, stream ) : 0; }
00091 bool videoReadFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, ColorFormat color_model, int stream );
00092 bool videoReadScaledFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, int out_w, int out_h, ColorFormat color_model, int stream );
00093 bool videoReadYUVFrame( char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h, int stream );
00094
00095
00096 double getTime() { return file ? mpeg3_get_time( file ) : 0.0; }
00097
00098
00099 bool setSMP( int cpus ) { return file ? mpeg3_set_cpus( file, cpus ) == 1 : FALSE; }
00100 bool setMMX( bool useMMX ) { return file ? mpeg3_set_mmx( file, useMMX ) == 1 : FALSE; }
00101
00102
00103 bool supportsAudio() { return TRUE; }
00104 bool supportsVideo() { return TRUE; }
00105 bool supportsYUV() { return TRUE; }
00106 bool supportsMMX() { return TRUE; }
00107 bool supportsSMP() { return TRUE; }
00108 bool supportsStereo() { return TRUE; }
00109 bool supportsScaling() { return TRUE; }
00110
00111 long getPlayTime() { return -1; }
00112
00113 private:
00114 mpeg3_t *file;
00115 QString strInfo;
00116
00117 };
00118
00119
00120 #endif
00121