aboutsummaryrefslogtreecommitdiffstats
path: root/mediaplugin
diff options
context:
space:
mode:
Diffstat (limited to 'mediaplugin')
-rw-r--r--mediaplugin/src/media/UMediaPlugin.pas11
-rw-r--r--mediaplugin/src/media/UVideoDecoderPlugin.pas15
-rw-r--r--mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_video_decode.cpp21
-rw-r--r--mediaplugin/src/mediaplugins/include/core/plugin_core.h10
4 files changed, 35 insertions, 22 deletions
diff --git a/mediaplugin/src/media/UMediaPlugin.pas b/mediaplugin/src/media/UMediaPlugin.pas
index 8632b9df..cf25e033 100644
--- a/mediaplugin/src/media/UMediaPlugin.pas
+++ b/mediaplugin/src/media/UMediaPlugin.pas
@@ -119,6 +119,13 @@ type
getRatio: function(stream: PAudioConvertStream): double; cdecl;
end;
+ PVideoFrameInfo = ^TVideoFrameInfo;
+ TVideoFrameInfo = record
+ width: cint;
+ height: cint;
+ aspect: double;
+ end;
+
PVideoDecoderInfo = ^TVideoDecoderInfo;
TVideoDecoderInfo = record
priority: cint;
@@ -130,9 +137,7 @@ type
getLoop: function(stream: PVideoDecodeStream): cbool; cdecl;
setPosition: procedure(stream: PVideoDecodeStream; time: double); cdecl;
getPosition: function(stream: PVideoDecodeStream): double; cdecl;
- getFrameWidth: function(stream: PVideoDecodeStream): cint; cdecl;
- getFrameHeight: function(stream: PVideoDecodeStream): cint; cdecl;
- getFrameAspect: function(stream: PVideoDecodeStream): double; cdecl;
+ getFrameInfo: procedure(stream: PVideoDecodeStream; info: PVideoFrameInfo); cdecl;
getFrame: function (stream: PVideoDecodeStream; time: clongdouble): PCuint8; cdecl;
end;
diff --git a/mediaplugin/src/media/UVideoDecoderPlugin.pas b/mediaplugin/src/media/UVideoDecoderPlugin.pas
index 722928d8..ef411023 100644
--- a/mediaplugin/src/media/UVideoDecoderPlugin.pas
+++ b/mediaplugin/src/media/UVideoDecoderPlugin.pas
@@ -204,18 +204,27 @@ begin
end;
function TPluginVideoDecodeStream.GetFrameWidth(): integer;
+var
+ FrameInfo: TVideoFrameInfo;
begin
- Result := fVideoDecoderInfo.getFrameWidth(fStream);
+ fVideoDecoderInfo.getFrameInfo(fStream, @FrameInfo);
+ Result := FrameInfo.width;
end;
function TPluginVideoDecodeStream.GetFrameHeight(): integer;
+var
+ FrameInfo: TVideoFrameInfo;
begin
- Result := fVideoDecoderInfo.getFrameHeight(fStream);
+ fVideoDecoderInfo.getFrameInfo(fStream, @FrameInfo);
+ Result := FrameInfo.height;
end;
function TPluginVideoDecodeStream.GetFrameAspect(): real;
+var
+ FrameInfo: TVideoFrameInfo;
begin
- Result := fVideoDecoderInfo.getFrameAspect(fStream);
+ fVideoDecoderInfo.getFrameInfo(fStream, @FrameInfo);
+ Result := FrameInfo.aspect;
end;
end.
diff --git a/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_video_decode.cpp b/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_video_decode.cpp
index b3fc77b3..8107c1b2 100644
--- a/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_video_decode.cpp
+++ b/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_video_decode.cpp
@@ -625,16 +625,13 @@ static double PLUGIN_CALL ffmpegVideoDecoder_getPosition(videoDecodeStream_t *st
return VideoDecodeStreamObj(stream)->getPosition();
}
-static int PLUGIN_CALL ffmpegVideoDecoder_getFrameWidth(videoDecodeStream_t *stream) {
- return VideoDecodeStreamObj(stream)->getFrameWidth();
-}
-
-static int PLUGIN_CALL ffmpegVideoDecoder_getFrameHeight(videoDecodeStream_t *stream) {
- return VideoDecodeStreamObj(stream)->getFrameHeight();
-}
-
-static double PLUGIN_CALL ffmpegVideoDecoder_getFrameAspect(videoDecodeStream_t *stream) {
- return VideoDecodeStreamObj(stream)->getFrameAspect();
+static void PLUGIN_CALL ffmpegVideoDecoder_getFrameInfo(videoDecodeStream_t *stream,
+ videoFrameInfo_t *info)
+{
+ FFmpegVideoDecodeStream* s = VideoDecodeStreamObj(stream);
+ info->width = s->getFrameWidth();
+ info->height = s->getFrameHeight();
+ info->aspect = s->getFrameAspect();
}
static uint8_t* PLUGIN_CALL ffmpegVideoDecoder_getFrame(videoDecodeStream_t *stream, long double time) {
@@ -655,8 +652,6 @@ const videoDecoderInfo_t videoDecoderInfo = {
ffmpegVideoDecoder_getLoop,
ffmpegVideoDecoder_setPosition,
ffmpegVideoDecoder_getPosition,
- ffmpegVideoDecoder_getFrameWidth,
- ffmpegVideoDecoder_getFrameHeight,
- ffmpegVideoDecoder_getFrameAspect,
+ ffmpegVideoDecoder_getFrameInfo,
ffmpegVideoDecoder_getFrame
};
diff --git a/mediaplugin/src/mediaplugins/include/core/plugin_core.h b/mediaplugin/src/mediaplugins/include/core/plugin_core.h
index a4839909..acbe0f4a 100644
--- a/mediaplugin/src/mediaplugins/include/core/plugin_core.h
+++ b/mediaplugin/src/mediaplugins/include/core/plugin_core.h
@@ -203,6 +203,12 @@ typedef struct audioConverterInfo_t {
double PLUGIN_CALL (*getRatio)(audioConvertStream_t *stream);
} audioConverterInfo_t;
+typedef struct videoFrameInfo_t {
+ int width;
+ int height;
+ double aspect;
+} videoFrameInfo_t;
+
typedef struct videoDecoderInfo_t {
int priority;
BOOL PLUGIN_CALL (*init)();
@@ -213,9 +219,7 @@ typedef struct videoDecoderInfo_t {
BOOL PLUGIN_CALL (*getLoop)(videoDecodeStream_t *stream);
void PLUGIN_CALL (*setPosition)(videoDecodeStream_t *stream, double time);
double PLUGIN_CALL (*getPosition)(videoDecodeStream_t *stream);
- int PLUGIN_CALL (*getFrameWidth)(videoDecodeStream_t *stream);
- int PLUGIN_CALL (*getFrameHeight)(videoDecodeStream_t *stream);
- double PLUGIN_CALL (*getFrameAspect)(videoDecodeStream_t *stream);
+ void PLUGIN_CALL (*getFrameInfo)(videoDecodeStream_t *stream, videoFrameInfo_t *info);
uint8_t* PLUGIN_CALL (*getFrame)(videoDecodeStream_t *stream, long double time);
} videoDecoderInfo_t;