gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/asobj/NetStreamGst.cpp t...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/NetStreamGst.cpp t...
Date: Tue, 22 Jan 2008 09:30:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/01/22 09:30:36

Modified files:
        .              : ChangeLog 
        server/asobj   : NetStreamGst.cpp 
        testsuite/misc-ming.all: NetStream-SquareTest.c 

Log message:
                * server/asobj/NetStreamGst.cpp: make metadata object properties
                  enumerable, deletable and overridable, fix bool properties
                  and the 'duration' unit.
                * testsuite/misc-ming.all/NetStream-SquareTest.c: test metadata
                  object composition.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5458&r2=1.5459
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamGst.cpp?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c?cvsroot=gnash&r1=1.18&r2=1.19

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5458
retrieving revision 1.5459
diff -u -b -r1.5458 -r1.5459
--- ChangeLog   22 Jan 2008 08:39:07 -0000      1.5458
+++ ChangeLog   22 Jan 2008 09:30:35 -0000      1.5459
@@ -1,3 +1,11 @@
+2008-01-22 Sandro Santilli <address@hidden>
+
+       * server/asobj/NetStreamGst.cpp: make metadata object properties
+         enumerable, deletable and overridable, fix bool properties
+         and the 'duration' unit.
+       * testsuite/misc-ming.all/NetStream-SquareTest.c: test metadata
+         object composition.
+
 2008-01-21 Bastiaan Jacques <address@hidden>
 
        * server/asobj/NetConnection.cpp: Remove duplicate URL announcement

Index: server/asobj/NetStreamGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamGst.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- server/asobj/NetStreamGst.cpp       22 Jan 2008 08:39:08 -0000      1.70
+++ server/asobj/NetStreamGst.cpp       22 Jan 2008 09:30:36 -0000      1.71
@@ -21,6 +21,9 @@
 #endif
 
 #include "NetStreamGst.h"
+#include "VM.h" 
+#include "string_table.h"
+#include <boost/algorithm/string/case_conv.hpp> // for PROPNAME (shouldn't 
this include be in the header actualy defining PROPNAME, btw?)
 
 #include "gstgnashsrc.h"
 #include "Object.h"
@@ -359,6 +362,20 @@
   g_print("tag name: %s,description: %s, type: %s.\n", nick, descr, 
g_type_name(gst_tag_get_type(tag)));
 #endif
 
+  // NOTE: gst provides more metadata elements then those provided by
+  //       the reference player, we might want to pick only the standard ones.
+  //       Won't do for now.
+
+  // We want props of the metadata object to be:
+  //   - enumerable
+  //   - overridable
+  //   - deletable
+  // This is tested in misc-ming.all/NetStream-SquareTest.{c,swf}
+  //
+
+  VM& vm = o->getVM();
+  string_table& st = vm.getStringTable();
+  string_table::key key = st.find(PROPNAME(nick));
 
   switch(gst_tag_get_type(tag)) {
     case G_TYPE_STRING:
@@ -367,7 +384,7 @@
 
       gst_tag_list_get_string(list, tag, &value);
       
-      o->init_member(nick, value);
+      o->set_member(key, value);
       
       g_free(value);
 
@@ -377,7 +394,7 @@
     {
       gdouble value;
       gst_tag_list_get_double(list, tag, &value);
-      o->init_member(nick, value);
+      o->set_member(key, (double)value);
       
       break;
     }
@@ -385,21 +402,32 @@
     {
       gboolean value;
       gst_tag_list_get_boolean(list, tag, &value);
-      o->init_member(nick, value);
+      o->set_member(key, (bool)value);
       break;
     }
     case G_TYPE_UINT64:
     {
       guint64 value;
       gst_tag_list_get_uint64(list, tag, &value);
-      o->init_member(nick, (unsigned long) value); // FIXME: actually, fix 
as_value().
+      as_value val;
+      if ( ! strcmp(nick, "duration") )
+      {
+         // duration is given in nanoseconds, we want that in seconds,
+         // and rounded to the millisecond 
+         val.set_double(rint(value/1000000.0)/1000.0);
+      }
+      else
+      {
+         val.set_double(value);
+      }
+      o->set_member(key, val); 
       break;
     }
     case G_TYPE_UINT:
     {
       guint value;
       gst_tag_list_get_uint(list, tag, &value);
-      o->init_member(nick, value);
+      o->set_member(key, value);
       break;
     }
     default:

Index: testsuite/misc-ming.all/NetStream-SquareTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- testsuite/misc-ming.all/NetStream-SquareTest.c      21 Jan 2008 16:48:22 
-0000      1.18
+++ testsuite/misc-ming.all/NetStream-SquareTest.c      22 Jan 2008 09:30:36 
-0000      1.19
@@ -267,13 +267,103 @@
                " _root.note('onCuePoint('+info+') called'); "
                "};"
                "stream.onMetaData = function(info) {"
-               " _root.note('onMetaData('+info+') called'); "
+
+               // debugging
+               " var s='';"
+               " for (e in info) { "
+               "  s += e+':'+info[e]+' ';"
+               " }"
+               " _root.note('onMetaData: '+s);"
+
+               " check_equals(arguments.length, 1, 'single argument');"
+
+               // Test enumeration
+               " var enu = new Array;"
+               " for (e in info) { "
+               "  enu.push(e);"
+               " }"
+               " xcheck_equals(enu.length, 11);" // gnash contains 2 more 
+
+               // Test composision
+
+               " check(info.hasOwnProperty('filesize'), 'metadata has 
filesize');"
+               " check_equals(typeof(info.filesize), 'number', 'filesize is a 
number');"
+               " check_equals(info.filesize, '21482', 'actual filesize');"
+               " info.filesize = 'changed';"
+               " check_equals(info.filesize, 'changed');" // can be overridden
+               " delete info.filesize;"
+               " check(!info.hasOwnProperty('filesize'), 'metadata filesize 
can be deleted');"
+
+               " check(info.hasOwnProperty('audiocodecid'), 'metadata has 
audiocodecid');"
+               " check_equals(typeof(info.audiocodecid), 'number', 
'audiocodecid is a number');"
+               " check_equals(info.audiocodecid, 2, 'actual audiocodecid');"
+               " info.audiocodecid = 'changed';"
+               " check_equals(info.audiocodecid, 'changed');" // can be 
overridden
+               " delete info.audiocodecid;"
+               " check(!info.hasOwnProperty('audiocodecid'), 'metadata 
audiocodecid can be deleted');"
+
+               " check(info.hasOwnProperty('stereo'), 'metadata has stereo');"
+               " check_equals(typeof(info.stereo), 'boolean', 'stereo is 
boolean');" 
+               " check_equals(info.stereo, false, 'actual stereo');"
+               " info.stereo = 'changed';"
+               " check_equals(info.stereo, 'changed');" // can be overridden
+               " delete info.stereo;"
+               " check(!info.hasOwnProperty('stereo'), 'metadata stereo can be 
deleted');"
+
+               " check(info.hasOwnProperty('audiosamplesize'), 'metadata has 
audiosamplesize');"
+               " check_equals(typeof(info.audiosamplesize), 'number', 
'audiosamplesize is a number');"
+               " check_equals(info.audiosamplesize, 16, 'actual 
audiosamplesize');"
+               " info.audiosamplesize = 'changed';"
+               " check_equals(info.audiosamplesize, 'changed');" // can be 
overridden
+               " delete info.audiosamplesize;"
+               " check(!info.hasOwnProperty('audiosamplesize'), 'metadata 
audiosamplesize can be deleted');"
+
+               " check(info.hasOwnProperty('audiosamplerate'), 'metadata has 
audiosamplerate');"
+               " check_equals(typeof(info.audiosamplerate), 'number', 
'audiosamplerate is a number');"
+               " check_equals(info.audiosamplerate, 44100, 'actual 
audiosamplerate');"
+               " info.audiosamplerate = 'changed';"
+               " check_equals(info.audiosamplerate, 'changed');" // can be 
overridden
+               " delete info.audiosamplerate;"
+               " check(!info.hasOwnProperty('audiosamplerate'), 'metadata 
audiosamplerate can be deleted');"
+
+               " check(info.hasOwnProperty('videocodecid'), 'metadata has 
videocodecid');"
+               " check_equals(typeof(info.videocodecid), 'number', 
'videocodecid is a number');"
+               " check_equals(info.videocodecid, 2, 'actual videocodecid');"
+               " info.videocodecid = 'changed';"
+               " check_equals(info.videocodecid, 'changed');" // can be 
overridden
+               " delete info.videocodecid;"
+               " check(!info.hasOwnProperty('videocodecid'), 'metadata 
videocodecid can be deleted');"
+
+               " check(info.hasOwnProperty('height'), 'metadata has height');"
+               " check_equals(typeof(info.height), 'number', 'height is a 
number');"
+               " check_equals(info.height, 96, 'actual height');"
+               " info.height = 'changed';"
+               " check_equals(info.height, 'changed');" // can be overridden
+               " delete info.height;"
+               " check(!info.hasOwnProperty('height'), 'metadata height can be 
deleted');"
+
+               " check(info.hasOwnProperty('width'), 'metadata has width');"
+               " check_equals(typeof(info.width), 'number', 'width is a 
number');"
+               " check_equals(info.width, 128, 'actual width');"
+               " info.width = 'changed';"
+               " check_equals(info.width, 'changed');" // can be overridden
+               " delete info.width;"
+               " check(!info.hasOwnProperty('width'), 'metadata width can be 
deleted');"
+
+               " check(info.hasOwnProperty('duration'), 'metadata has 
duration');"
+               " check_equals(typeof(info.duration), 'number', 'duration is a 
number');"
+               " check_equals(info.duration, 2.299, 'actual duration');" // 
seconds, rounded to milliseconds
+               " info.duration = 'changed';"
+               " check_equals(info.duration, 'changed');" // can be overridden
+               " delete info.duration;"
+               " check(!info.hasOwnProperty('duration'), 'metadata duration 
can be deleted');"
+
                "};"
                ));
 
   SWFMovie_nextFrame(mo);
 
-  SWFMovie_add(mo, (SWFBlock)newSWFAction("totals(); stop();"));
+  SWFMovie_add(mo, (SWFBlock)newSWFAction("totals(99); stop();"));
 
   SWFMovie_nextFrame(mo);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]