Bug 480058. New liboggplay API oggplay_get_video_aspect_ratio. r=doublec
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 19 May 2009 12:23:52 +1200
changeset 28534 058122b0bf3cb3e2a8ff4590969356f6b906bc08
parent 28533 3916d3b0b0b98757716b0dc895169b6781f7aed5
child 28536 f580ee2f7331f4113d6500e9f1e430ec7b42fd62
push id7108
push userrocallahan@mozilla.com
push dateTue, 19 May 2009 01:17:50 +0000
treeherdermozilla-central@058122b0bf3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec
bugs480058
milestone1.9.2a1pre
Bug 480058. New liboggplay API oggplay_get_video_aspect_ratio. r=doublec
media/liboggplay/README_MOZILLA
media/liboggplay/aspect_ratio.patch
media/liboggplay/include/oggplay/oggplay.h
media/liboggplay/src/liboggplay/oggplay.c
media/liboggplay/update.sh
--- a/media/liboggplay/README_MOZILLA
+++ b/media/liboggplay/README_MOZILLA
@@ -15,8 +15,10 @@ bug485291_yuv_align: only use optimized 
 endian: pick up NSPR's little/big endian defines in oggplay's config.h.
 
 bug481921: fix a crash in oggplay_callback_info_prepare().
 
 trac466: Fix for infinite loop in liboggplay when running decoder on its own thread. Cherry picked from liboggplay git commit e6871f.
 
 bug492436: Fix for that bug cherry picked from liboggplay git commit 4b97ad.
 bug493140: Fix for offsets not being used.
+
+aspect-ratio: Adds oggplay_get_video_aspect_ratio, used for bug 480058.
new file mode 100644
--- /dev/null
+++ b/media/liboggplay/aspect_ratio.patch
@@ -0,0 +1,72 @@
+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) {
--- 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);
 
--- 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) {
--- a/media/liboggplay/update.sh
+++ b/media/liboggplay/update.sh
@@ -45,8 +45,9 @@ sed 's/#include <config.h>/#ifdef WIN32\
 rm ./src/liboggplay/oggplay_private.h1
 sed s/\#ifdef\ HAVE_INTTYPES_H/\#if\ HAVE_INTTYPES_H/g $1/src/liboggplay/oggplay_data.c >./src/liboggplay/oggplay_data.c
 patch -p3 < bug485291_yuv_align.patch
 patch -p3 < endian.patch
 patch -p3 < trac466.patch
 patch -p3 < bug492436.patch
 patch -p3 < bug493140.patch
 patch -p3 < bug481921.patch
+patch -p3 < aspect_ratio.patch