[Swfed-svn] swfed-svn [552] printTagData メソッドの実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 4月 8日 (金) 03:59:33 JST


Revision: 552
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=552
Author:   yoya
Date:     2011-04-08 03:59:33 +0900 (Fri, 08 Apr 2011)

Log Message:
-----------
printTagData メソッドの実装

Modified Paths:
--------------
    trunk/src/php_swfed.c
    trunk/src/php_swfed.h
    trunk/src/swf_object.c
    trunk/src/swf_object.h

Added Paths:
-----------
    trunk/sample/swfprinttagdata.swf


-------------- next part --------------
Added: trunk/sample/swfprinttagdata.swf
===================================================================
(Binary files differ)


Property changes on: trunk/sample/swfprinttagdata.swf
___________________________________________________________________
Added: svn:mime-type
   + application/x-shockwave-flash

Modified: trunk/src/php_swfed.c
===================================================================
--- trunk/src/php_swfed.c	2011-04-07 18:44:38 UTC (rev 551)
+++ trunk/src/php_swfed.c	2011-04-07 18:59:33 UTC (rev 552)
@@ -70,6 +70,7 @@
     PHP_ME(swfed,  getTagContentsByCID, NULL, 0)
     PHP_ME(swfed,  replaceTagContentsByCID, NULL, 0)
     PHP_ME(swfed,  removeTag, NULL, 0)
+    PHP_ME(swfed,  printTagData, NULL, 0)
 
     PHP_ME(swfed,  getShapeData, NULL, 0)
     PHP_ME(swfed,  replaceShapeData, NULL, 0)
@@ -739,6 +740,29 @@
     RETURN_TRUE;
 }
 
+PHP_METHOD(swfed, printTagData) {
+    char *data = NULL;
+    unsigned long data_len = 0;
+    swf_object_t *swf = NULL;
+    int ret = 0;
+    switch (ZEND_NUM_ARGS()) {
+      default:
+        WRONG_PARAM_COUNT;
+        RETURN_FALSE; /* XXX */
+      case 1:
+        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
+            RETURN_FALSE;
+        }
+        break;
+    }
+    swf = get_swf_object(getThis() TSRMLS_CC);
+    ret = swf_object_print_tagdata(swf, (unsigned char *)data, data_len);
+    if (ret) {
+        RETURN_FALSE;
+    }
+    RETURN_TRUE;
+}
+
 PHP_METHOD(swfed, getShapeData) {
     long cid = 0;
     swf_object_t *swf = NULL;

Modified: trunk/src/php_swfed.h
===================================================================
--- trunk/src/php_swfed.h	2011-04-07 18:44:38 UTC (rev 551)
+++ trunk/src/php_swfed.h	2011-04-07 18:59:33 UTC (rev 552)
@@ -62,6 +62,7 @@
 PHP_METHOD(swfed, getTagContentsByCID);
 PHP_METHOD(swfed, replaceTagContentsByCID);
 PHP_METHOD(swfed, removeTag);
+PHP_METHOD(swfed, printTagData);
 //
 PHP_METHOD(swfed, getShapeData);
 PHP_METHOD(swfed, replaceShapeData);

Modified: trunk/src/swf_object.c
===================================================================
--- trunk/src/swf_object.c	2011-04-07 18:44:38 UTC (rev 551)
+++ trunk/src/swf_object.c	2011-04-07 18:59:33 UTC (rev 552)
@@ -472,6 +472,26 @@
     return ret;
 }
 
+int
+swf_object_print_tagdata(swf_object_t *swf, unsigned char *data, 
+                         unsigned long length) {
+    bitstream_t *bs;
+    swf_tag_t *tag;
+    bs = bitstream_open();
+    bitstream_input(bs, data, length);
+    tag = swf_tag_create(bs);
+    bitstream_close(bs);
+    if (tag == NULL) {
+        fprintf(stderr, "swf_object_print_tagdata: swf_tag_create failed\n");
+        return 1;
+    }
+    swf_tag_print(tag, swf, 0);
+    swf_tag_destroy(tag);
+    return 0;
+}
+
+
+
 static int
 _swf_object_remove_tag(swf_object_t *swf, swf_tag_t *tag) {
     if (tag->prev) {

Modified: trunk/src/swf_object.h
===================================================================
--- trunk/src/swf_object.h	2011-04-07 18:44:38 UTC (rev 551)
+++ trunk/src/swf_object.h	2011-04-07 18:59:33 UTC (rev 552)
@@ -59,7 +59,10 @@
                                                 unsigned long length);
 extern int swf_object_remove_tag(swf_object_t *swf, int tag_seqno,
                                  int tag_seqno_in_sprite);
+extern int swf_object_print_tagdata(swf_object_t *swf, 
+                                    unsigned char *data, unsigned long length);
 
+
 /* --- */
 
 extern swf_tag_t *swf_object_search_tag_byseqno(swf_object_t *swf,



Swfed-svn メーリングリストの案内
Back to archive index