Diffstat (limited to 'core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h index 0a06264..54f259b 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h | |||
@@ -4,110 +4,120 @@ | |||
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef LIBMPEG3_PLUGIN_H | 20 | #ifndef LIBMPEG3_PLUGIN_H |
21 | #define LIBMPEG3_PLUGIN_H | 21 | #define LIBMPEG3_PLUGIN_H |
22 | 22 | ||
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | #include "libmpeg3.h" | 26 | #include "libmpeg3.h" |
27 | #include "mpeg3protos.h" | 27 | #include "mpeg3protos.h" |
28 | #include "mediaplayerplugininterface.h" | 28 | //#include <qpe/mediaplayerplugininterface.h> |
29 | #include "../mediaplayerplugininterface.h" | ||
30 | |||
31 | |||
32 | // #define OLD_MEDIAPLAYER_API | ||
29 | 33 | ||
30 | 34 | ||
31 | class LibMpeg3Plugin : public MediaPlayerDecoder { | 35 | class LibMpeg3Plugin : public MediaPlayerDecoder { |
32 | 36 | ||
33 | public: | 37 | public: |
34 | LibMpeg3Plugin() { file = NULL; } | 38 | LibMpeg3Plugin() { file = NULL; } |
35 | ~LibMpeg3Plugin() { close(); } | 39 | ~LibMpeg3Plugin() { close(); } |
36 | 40 | ||
37 | const char *pluginName() { return "LibMpeg3Plugin"; } | 41 | const char *pluginName() { return "LibMpeg3Plugin"; } |
38 | const char *pluginComment() { return "This is the libmpeg3 library writen by ... which has been modified by trolltech to use fixed point maths"; } | 42 | const char *pluginComment() { return "This is the libmpeg3 library writen by ... which has been modified by trolltech to use fixed point maths"; } |
39 | double pluginVersion() { return 1.0; } | 43 | double pluginVersion() { return 1.0; } |
40 | 44 | ||
41 | bool isFileSupported( const QString& fileName ) { return mpeg3_check_sig( (char *)fileName.latin1() ) == 1; } | 45 | bool isFileSupported( const QString& fileName ) { return mpeg3_check_sig( (char *)fileName.latin1() ) == 1; } |
42 | bool open( const QString& fileName ) { file = mpeg3_open( (char *)fileName.latin1() ); return file != NULL; } | 46 | bool open( const QString& fileName ) { file = mpeg3_open( (char *)fileName.latin1() ); return file != NULL; } |
43 | bool close() { if ( file ) { int r = mpeg3_close( file ); file = NULL; return r == 1; } return FALSE; } | 47 | bool close() { if ( file ) { int r = mpeg3_close( file ); file = NULL; return r == 1; } return FALSE; } |
44 | bool isOpen() { return file != NULL; } | 48 | bool isOpen() { return file != NULL; } |
45 | const QString &fileInfo() { return strInfo = QString( "" ); } | 49 | const QString &fileInfo() { return strInfo = ""; } |
46 | 50 | ||
47 | // If decoder doesn't support audio then return 0 here | 51 | // If decoder doesn't support audio then return 0 here |
48 | int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; } | 52 | int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; } |
49 | int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; } | 53 | int audioChannels( int stream ) { return file ? mpeg3_audio_channels( file, stream ) : 0; } |
50 | int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } | 54 | int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } |
55 | int audioBitsPerSample(int) { return 0;} | ||
51 | int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } | 56 | int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } |
52 | bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; } | 57 | bool audioSetSample( long sample, int stream ) { return file ? mpeg3_set_sample( file, sample, stream) == 1 : FALSE; } |
53 | long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; } | 58 | long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; } |
54 | // bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 59 | #ifdef OLD_MEDIAPLAYER_API |
55 | // bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | 60 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
61 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | ||
62 | bool audioReadSamples( short *output, int channel, long samples, int stream ); | ||
63 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
64 | #else | ||
56 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); | 65 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); |
57 | // bool audioReadSamples( short *output, int channel, long samples, int stream ); | 66 | #endif |
58 | // bool audioReReadSamples( short *output, int channel, long samples, int stream ); | ||
59 | 67 | ||
60 | // If decoder doesn't support video then return 0 here | 68 | // If decoder doesn't support video then return 0 here |
61 | int videoStreams() { return file ? mpeg3_total_vstreams( file ) : 0; } | 69 | int videoStreams() { return file ? mpeg3_total_vstreams( file ) : 0; } |
62 | int videoWidth( int stream ) { return file ? mpeg3_video_width( file, stream ) : 0; } | 70 | int videoWidth( int stream ) { return file ? mpeg3_video_width( file, stream ) : 0; } |
63 | int videoHeight( int stream ) { return file ? mpeg3_video_height( file, stream ) : 0; } | 71 | int videoHeight( int stream ) { return file ? mpeg3_video_height( file, stream ) : 0; } |
64 | double videoFrameRate( int stream ) { return file ? mpeg3_frame_rate( file, stream ) : 0.0; } | 72 | double videoFrameRate( int stream ) { return file ? mpeg3_frame_rate( file, stream ) : 0.0; } |
65 | int videoFrames( int stream ) | 73 | int videoFrames( int stream ) |
66 | { return file ? mpeg3_video_frames( file, stream ) : 0; } | 74 | { return file ? mpeg3_video_frames( file, stream ) : 0; } |
67 | /* | 75 | /* |
68 | { | 76 | { |
69 | if ( file ) { | 77 | if ( file ) { |
70 | int frames = mpeg3_video_frames( file, stream ); | 78 | int frames = mpeg3_video_frames( file, stream ); |
71 | if ( frames == 1 ) { | 79 | if ( frames == 1 ) { |
72 | int res = mpeg3_seek_percentage( file, 0.99 ); | 80 | int res = mpeg3_seek_percentage( file, 0.99 ); |
73 | printf("res: %i\n", res ); | 81 | printf("res: %i\n", res ); |
74 | mpeg3video_seek( file->vtrack[stream]->video ); | 82 | mpeg3video_seek( file->vtrack[stream]->video ); |
75 | frames = mpeg3_get_frame( file, stream ); | 83 | frames = mpeg3_get_frame( file, stream ); |
76 | mpeg3_seek_percentage( file, 0.0 ); | 84 | mpeg3_seek_percentage( file, 0.0 ); |
77 | } | 85 | } |
78 | return frames; | 86 | return frames; |
79 | } | 87 | } |
80 | return 0; | 88 | return 0; |
81 | } | 89 | } |
82 | */ | 90 | */ |
83 | bool videoSetFrame( long frame, int stream ) { return file ? mpeg3_set_frame( file, frame, stream) == 1 : FALSE; } | 91 | bool videoSetFrame( long frame, int stream ) { return file ? mpeg3_set_frame( file, frame, stream) == 1 : FALSE; } |
84 | long videoGetFrame( int stream ) { return file ? mpeg3_get_frame( file, stream ) : 0; } | 92 | long videoGetFrame( int stream ) { return file ? mpeg3_get_frame( file, stream ) : 0; } |
85 | bool videoReadFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, ColorFormat color_model, int stream ); | 93 | bool videoReadFrame( unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, ColorFormat color_model, int stream ); |
86 | 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 ); | 94 | 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 ); |
87 | 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 ); | 95 | 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 ); |
88 | 96 | ||
89 | // Profiling | 97 | // Profiling |
90 | double getTime() { return file ? mpeg3_get_time( file ) : 0.0; } | 98 | double getTime() { return file ? mpeg3_get_time( file ) : 0.0; } |
91 | 99 | ||
92 | // Ignore if these aren't supported | 100 | // Ignore if these aren't supported |
93 | bool setSMP( int cpus ) { return file ? mpeg3_set_cpus( file, cpus ) == 1 : FALSE; } | 101 | bool setSMP( int cpus ) { return file ? mpeg3_set_cpus( file, cpus ) == 1 : FALSE; } |
94 | bool setMMX( bool useMMX ) { return file ? mpeg3_set_mmx( file, useMMX ) == 1 : FALSE; } | 102 | bool setMMX( bool useMMX ) { return file ? mpeg3_set_mmx( file, useMMX ) == 1 : FALSE; } |
95 | 103 | ||
96 | // Capabilities | 104 | // Capabilities |
97 | bool supportsAudio() { return TRUE; } | 105 | bool supportsAudio() { return TRUE; } |
98 | bool supportsVideo() { return TRUE; } | 106 | bool supportsVideo() { return TRUE; } |
99 | bool supportsYUV() { return TRUE; } | 107 | bool supportsYUV() { return TRUE; } |
100 | bool supportsMMX() { return TRUE; } | 108 | bool supportsMMX() { return TRUE; } |
101 | bool supportsSMP() { return TRUE; } | 109 | bool supportsSMP() { return TRUE; } |
102 | bool supportsStereo() { return TRUE; } | 110 | bool supportsStereo() { return TRUE; } |
103 | bool supportsScaling() { return TRUE; } | 111 | bool supportsScaling() { return TRUE; } |
104 | 112 | ||
113 | long getPlayTime() { return -1; } | ||
114 | |||
105 | private: | 115 | private: |
106 | mpeg3_t *file; | 116 | mpeg3_t *file; |
107 | QString strInfo; | 117 | QString strInfo; |
108 | 118 | ||
109 | }; | 119 | }; |
110 | 120 | ||
111 | 121 | ||
112 | #endif | 122 | #endif |
113 | 123 | ||