gecko-dev/media/liboggplay/aspect_ratio.patch

73 строки
2.2 KiB
Diff

diff --git a/media/liboggplay/include/oggplay/oggplay.h b/media/liboggplay/include/oggplay/oggplay.h
--- a/media/liboggplay/include/oggplay/oggplay.h
+++ b/media/liboggplay/include/oggplay/oggplay.h
@@ -110,16 +110,19 @@ oggplay_get_audio_channels(OggPlay *me,
OggPlayErrorCode
oggplay_get_audio_samplerate(OggPlay *me, int track, int *samplerate);
OggPlayErrorCode
oggplay_get_video_fps(OggPlay *me, int track, int* fps_denom, int* fps_num);
OggPlayErrorCode
+oggplay_get_video_aspect_ratio(OggPlay *me, int track, int* aspect_denom, int* aspect_num);
+
+OggPlayErrorCode
oggplay_convert_video_to_rgb(OggPlay *me, int track, int convert);
OggPlayErrorCode
oggplay_get_kate_category(OggPlay *me, int track, const char** category);
OggPlayErrorCode
oggplay_get_kate_language(OggPlay *me, int track, const char** language);
diff --git a/media/liboggplay/src/liboggplay/oggplay.c b/media/liboggplay/src/liboggplay/oggplay.c
--- a/media/liboggplay/src/liboggplay/oggplay.c
+++ b/media/liboggplay/src/liboggplay/oggplay.c
@@ -280,16 +280,45 @@ oggplay_get_video_fps(OggPlay *me, int t
(*fps_denom) = decode->video_info.fps_denominator;
(*fps_num) = decode->video_info.fps_numerator;
return E_OGGPLAY_OK;
}
OggPlayErrorCode
+oggplay_get_video_aspect_ratio(OggPlay *me, int track, int* aspect_denom, int* aspect_num) {
+ OggPlayTheoraDecode *decode;
+
+ if (me == NULL) {
+ return E_OGGPLAY_BAD_OGGPLAY;
+ }
+
+ if (track < 0 || track >= me->num_tracks) {
+ return E_OGGPLAY_BAD_TRACK;
+ }
+
+ if (me->decode_data[track]->decoded_type != OGGPLAY_YUV_VIDEO) {
+ return E_OGGPLAY_WRONG_TRACK_TYPE;
+ }
+
+ decode = (OggPlayTheoraDecode *)(me->decode_data[track]);
+
+ if ((decode->video_info.aspect_denominator == 0)
+ || (decode->video_info.aspect_numerator == 0)) {
+ return E_OGGPLAY_UNINITIALISED;
+ }
+
+ (*aspect_denom) = decode->video_info.aspect_denominator;
+ (*aspect_num) = decode->video_info.aspect_numerator;
+
+ return E_OGGPLAY_OK;
+}
+
+OggPlayErrorCode
oggplay_convert_video_to_rgb(OggPlay *me, int track, int convert) {
OggPlayTheoraDecode *decode;
if (me == NULL) {
return E_OGGPLAY_BAD_OGGPLAY;
}
if (track < 0 || track >= me->num_tracks) {