summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
new file mode 100644
index 0000000..0a06264
--- a/dev/null
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h
@@ -0,0 +1,113 @@
1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef LIBMPEG3_PLUGIN_H
21#define LIBMPEG3_PLUGIN_H
22
23
24#include <qstring.h>
25#include <qapplication.h>
26#include "libmpeg3.h"
27#include "mpeg3protos.h"
28#include "mediaplayerplugininterface.h"
29
30
31class LibMpeg3Plugin : public MediaPlayerDecoder {
32
33public:
34 LibMpeg3Plugin() { file = NULL; }
35 ~LibMpeg3Plugin() { close(); }
36
37 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"; }
39 double pluginVersion() { return 1.0; }
40
41 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; }
43 bool close() { if ( file ) { int r = mpeg3_close( file ); file = NULL; return r == 1; } return FALSE; }
44 bool isOpen() { return file != NULL; }
45 const QString &fileInfo() { return strInfo = QString( "" ); }
46
47 // If decoder doesn't support audio then return 0 here
48 int audioStreams() { return file ? mpeg3_total_astreams( file ) : 0; }
49 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; }
51 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; }
53 long audioGetSample( int stream ) { return file ? mpeg3_get_sample( file, stream ) : 0; }
54// bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
55// bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
56 bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream );
57// bool audioReadSamples( short *output, int channel, long samples, int stream );
58// bool audioReReadSamples( short *output, int channel, long samples, int stream );
59
60 // If decoder doesn't support video then return 0 here
61 int videoStreams() { return file ? mpeg3_total_vstreams( file ) : 0; }
62 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; }
64 double videoFrameRate( int stream ) { return file ? mpeg3_frame_rate( file, stream ) : 0.0; }
65 int videoFrames( int stream )
66{ return file ? mpeg3_video_frames( file, stream ) : 0; }
67/*
68{
69 if ( file ) {
70 int frames = mpeg3_video_frames( file, stream );
71 if ( frames == 1 ) {
72 int res = mpeg3_seek_percentage( file, 0.99 );
73 printf("res: %i\n", res );
74 mpeg3video_seek( file->vtrack[stream]->video );
75 frames = mpeg3_get_frame( file, stream );
76 mpeg3_seek_percentage( file, 0.0 );
77 }
78 return frames;
79 }
80 return 0;
81}
82*/
83 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; }
85 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 );
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 );
88
89 // Profiling
90 double getTime() { return file ? mpeg3_get_time( file ) : 0.0; }
91
92 // Ignore if these aren't supported
93 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; }
95
96 // Capabilities
97 bool supportsAudio() { return TRUE; }
98 bool supportsVideo() { return TRUE; }
99 bool supportsYUV() { return TRUE; }
100 bool supportsMMX() { return TRUE; }
101 bool supportsSMP() { return TRUE; }
102 bool supportsStereo() { return TRUE; }
103 bool supportsScaling() { return TRUE; }
104
105private:
106 mpeg3_t *file;
107 QString strInfo;
108
109};
110
111
112#endif
113