Bug 584259 - Update libnestegg. r=doublec a=roc
authorMatthew Gregan <kinetik@flim.org>
Wed, 03 Nov 2010 12:38:04 +1300
changeset 59430 28f582d9b6d8a24dca02b3937a283689344bacdb
parent 59429 c6c33df76468e285a7eb0bc322fd778478dd8349
child 59431 df3122f033283062d715cf9a66700073ce4f3275
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersdoublec, roc
bugs584259
milestone2.0b9pre
Bug 584259 - Update libnestegg. r=doublec a=roc
media/libnestegg/README_MOZILLA
media/libnestegg/include/nestegg.h
media/libnestegg/src/nestegg.c
--- a/media/libnestegg/README_MOZILLA
+++ b/media/libnestegg/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the nestegg
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The nestegg git repository is: git://github.com/kinetiknz/nestegg.git
 
-The git commit ID used was 0d51131519a1014660b5e111e28a78785d76600f.
+The git commit ID used was ef45a1c3a6b86ce3d86d179537e94c57008f07f4.
--- a/media/libnestegg/include/nestegg.h
+++ b/media/libnestegg/include/nestegg.h
@@ -63,16 +63,22 @@ extern "C" {
     The <tt>libnestegg</tt> C API. */
 
 #define NESTEGG_TRACK_VIDEO 0 /**< Track is of type video. */
 #define NESTEGG_TRACK_AUDIO 1 /**< Track is of type audio. */
 
 #define NESTEGG_CODEC_VP8    0 /**< Track uses Google On2 VP8 codec. */
 #define NESTEGG_CODEC_VORBIS 1 /**< Track uses Xiph Vorbis codec. */
 
+#define NESTEGG_VIDEO_MONO              0 /**< Track is mono video. */
+#define NESTEGG_VIDEO_STEREO_LEFT_RIGHT 1 /**< Track is side-by-side stereo video.  Left first. */
+#define NESTEGG_VIDEO_STEREO_BOTTOM_TOP 2 /**< Track is top-bottom stereo video.  Right first. */
+#define NESTEGG_VIDEO_STEREO_TOP_BOTTOM 3 /**< Track is top-bottom stereo video.  Left first. */
+#define NESTEGG_VIDEO_STEREO_RIGHT_LEFT 11 /**< Track is side-by-side stereo video.  Right first. */
+
 #define NESTEGG_SEEK_SET 0 /**< Seek offset relative to beginning of stream. */
 #define NESTEGG_SEEK_CUR 1 /**< Seek offset relative to current position in stream. */
 #define NESTEGG_SEEK_END 2 /**< Seek offset relative to end of stream. */
 
 #define NESTEGG_LOG_DEBUG    1     /**< Debug level log message. */
 #define NESTEGG_LOG_INFO     10    /**< Informational level log message. */
 #define NESTEGG_LOG_WARNING  100   /**< Warning level log message. */
 #define NESTEGG_LOG_ERROR    1000  /**< Error level log message. */
@@ -108,16 +114,20 @@ typedef struct {
   int64_t (* tell)(void * userdata);
 
   /** User supplied pointer to be passed to the IO callbacks. */
   void * userdata;
 } nestegg_io;
 
 /** Parameters specific to a video track. */
 typedef struct {
+  unsigned int stereo_mode;    /**< Video mode.  One of #NESTEGG_VIDEO_MONO,
+                                    #NESTEGG_VIDEO_STEREO_LEFT_RIGHT,
+                                    #NESTEGG_VIDEO_STEREO_BOTTOM_TOP, or
+                                    #NESTEGG_VIDEO_STEREO_TOP_BOTTOM. */
   unsigned int width;          /**< Width of the video frame in pixels. */
   unsigned int height;         /**< Height of the video frame in pixels. */
   unsigned int display_width;  /**< Display width of the video frame in pixels. */
   unsigned int display_height; /**< Display height of the video frame in pixels. */
   unsigned int crop_bottom;    /**< Pixels to crop from the bottom of the frame. */
   unsigned int crop_top;       /**< Pixels to crop from the top of the frame. */
   unsigned int crop_left;      /**< Pixels to crop from the left of the frame. */
   unsigned int crop_right;     /**< Pixels to crop from the right of the frame. */
--- a/media/libnestegg/src/nestegg.c
+++ b/media/libnestegg/src/nestegg.c
@@ -61,16 +61,17 @@
 #define ID_FLAG_LACING          0x9c
 #define ID_TRACK_TIMECODE_SCALE 0x23314f
 #define ID_LANGUAGE             0x22b59c
 #define ID_CODEC_ID             0x86
 #define ID_CODEC_PRIVATE        0x63a2
 
 /* Video Elements */
 #define ID_VIDEO                0xe0
+#define ID_STEREO_MODE          0x53b8
 #define ID_PIXEL_WIDTH          0xb0
 #define ID_PIXEL_HEIGHT         0xba
 #define ID_PIXEL_CROP_BOTTOM    0x54aa
 #define ID_PIXEL_CROP_TOP       0x54bb
 #define ID_PIXEL_CROP_LEFT      0x54cc
 #define ID_PIXEL_CROP_RIGHT     0x54dd
 #define ID_DISPLAY_WIDTH        0x54b0
 #define ID_DISPLAY_HEIGHT       0x54ba
@@ -194,16 +195,17 @@ struct block_group {
 };
 
 struct cluster {
   struct ebml_type timecode;
   struct ebml_list block_group;
 };
 
 struct video {
+  struct ebml_type stereo_mode;
   struct ebml_type pixel_width;
   struct ebml_type pixel_height;
   struct ebml_type pixel_crop_bottom;
   struct ebml_type pixel_crop_top;
   struct ebml_type pixel_crop_left;
   struct ebml_type pixel_crop_right;
   struct ebml_type display_width;
   struct ebml_type display_height;
@@ -368,16 +370,17 @@ static struct ebml_element_desc ne_block
 static struct ebml_element_desc ne_cluster_elements[] = {
   E_FIELD(ID_TIMECODE, TYPE_UINT, struct cluster, timecode),
   E_MASTER(ID_BLOCK_GROUP, TYPE_MASTER, struct cluster, block_group),
   E_SUSPEND(ID_SIMPLE_BLOCK, TYPE_BINARY),
   E_LAST
 };
 
 static struct ebml_element_desc ne_video_elements[] = {
+  E_FIELD(ID_STEREO_MODE, TYPE_UINT, struct video, stereo_mode),
   E_FIELD(ID_PIXEL_WIDTH, TYPE_UINT, struct video, pixel_width),
   E_FIELD(ID_PIXEL_HEIGHT, TYPE_UINT, struct video, pixel_height),
   E_FIELD(ID_PIXEL_CROP_BOTTOM, TYPE_UINT, struct video, pixel_crop_bottom),
   E_FIELD(ID_PIXEL_CROP_TOP, TYPE_UINT, struct video, pixel_crop_top),
   E_FIELD(ID_PIXEL_CROP_LEFT, TYPE_UINT, struct video, pixel_crop_left),
   E_FIELD(ID_PIXEL_CROP_RIGHT, TYPE_UINT, struct video, pixel_crop_right),
   E_FIELD(ID_DISPLAY_WIDTH, TYPE_UINT, struct video, display_width),
   E_FIELD(ID_DISPLAY_HEIGHT, TYPE_UINT, struct video, display_height),
@@ -1409,17 +1412,17 @@ ne_null_log_callback(nestegg * ctx, unsi
 
 int
 nestegg_init(nestegg ** context, nestegg_io io, nestegg_log callback)
 {
   int r;
   uint64_t id, version, docversion;
   struct ebml_list_node * track;
   char * doctype;
-  nestegg * ctx = NULL;
+  nestegg * ctx;
 
   if (!(io.read && io.seek && io.tell))
     return -1;
 
   ctx = ne_alloc(sizeof(*ctx));
 
   ctx->io = ne_alloc(sizeof(*ctx->io));
   *ctx->io = io;
@@ -1767,16 +1770,22 @@ nestegg_track_video_params(nestegg * ctx
 
   entry = ne_find_track_entry(ctx, track);
   if (!entry)
     return -1;
 
   if (nestegg_track_type(ctx, track) != NESTEGG_TRACK_VIDEO)
     return -1;
 
+  value = 0;
+  ne_get_uint(entry->video.stereo_mode, &value);
+  if (value <= NESTEGG_VIDEO_STEREO_TOP_BOTTOM ||
+      value == NESTEGG_VIDEO_STEREO_RIGHT_LEFT)
+    params->stereo_mode = value;
+
   if (ne_get_uint(entry->video.pixel_width, &value) != 0)
     return -1;
   params->width = value;
 
   if (ne_get_uint(entry->video.pixel_height, &value) != 0)
     return -1;
   params->height = value;