media/liboggplay/aspect_ratio.patch
author Jason Duell <jduell.mcbugs@gmail.com>
Sat, 17 Oct 2009 00:05:27 -0700
changeset 46662 a77022f7680c9486748abe5ddb55cb9af6686cea
parent 33012 314c78cf870089e5134db3459077ab815271f61a
permissions -rw-r--r--
Add run_test_in_child() and do_load_child_test_harness() xpcshell functions (bug 521922). r=bent sr=ted Add necko 'unit_ipc' test directory under e10s, plus simple HTTP test.

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) {