pjs/media/liboggplay/aspect_ratio.patch

73 строки
2.3 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
@@ -226,16 +226,19 @@ oggplay_get_audio_samplerate(OggPlay *me
* @retval E_OGGPLAY_BAD_TRACK the given track number does not exists
* @retval E_OGGPLAY_WRONG_TRACK_TYPE the given track is not an audio track
* @retval E_OGGPLAY_UNINITIALISED the OggPlay handle is uninitalised.
*/
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, int swap_rgb);
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
@@ -297,16 +297,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, int swap_rgb) {
OggPlayTheoraDecode *decode;
if (me == NULL) {
return E_OGGPLAY_BAD_OGGPLAY;
}
if (track < 0 || track >= me->num_tracks) {