gnash-dev
[Top][All Lists]
Advanced

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

[Gnash-dev] Patches to make flvdumper output go to stdout


From: John Gilmore
Subject: [Gnash-dev] Patches to make flvdumper output go to stdout
Date: Sat, 14 Feb 2009 17:41:07 -0800

I was trying to poke at saved files and having half the output go to
stderr, the other half to stdout, was making me crazy.

        John

=== modified file 'libamf/buffer.cpp'
--- libamf/buffer.cpp   2008-12-23 02:57:22 +0000
+++ libamf/buffer.cpp   2009-02-15 01:28:32 +0000
@@ -697,7 +697,8 @@
 void
 Buffer::dump(std::ostream& os) const
 {
-    os << "Buffer is " << _seekptr-_data.get() << "/" << _nbytes << " bytes at 
" << (void *)_data.get() << endl;
+    os << "Buffer is " << _seekptr-_data.get() << "/" << _nbytes << " bytes: ";
+         // Skip in-memory address " at " << (void *)_data.get() << endl;
     if (_nbytes < 0xffff) {
        const size_t bytes = _seekptr - _data.get();
        os << gnash::hexify((unsigned char *)_data.get(), bytes, false) << endl;

=== modified file 'libamf/element.cpp'
--- libamf/element.cpp  2008-12-23 02:56:29 +0000
+++ libamf/element.cpp  2009-02-15 01:26:53 +0000
@@ -1436,14 +1436,13 @@
 {
 //    GNASH_REPORT_FUNCTION;
     
-    os << astype_str[_type] << ": ";
     if (_name) {
-       os << " property name is: " << _name << ", ";
+       os << "Property named " << _name;
     } else {
-       os << "(no name)";
+       os << "Unnamed property";
     }
-    os << endl << "data length is " << getDataSize() << endl;
-
+    os << " is a " << astype_str[_type] << " of " << getDataSize() <<
+        " bytes:" << endl;
 
     switch (_type) {
       case Element::NUMBER_AMF0:
@@ -1457,7 +1456,7 @@
          if (getDataSize()) {
              os << "\t\"" << to_string() << "\"";
          }
-         cerr << endl;
+         os << endl;
          break;
       case Element::OBJECT_AMF0:
          break;
@@ -1474,13 +1473,13 @@
       case Element::RECORD_SET_AMF0:
       case Element::XML_OBJECT_AMF0:
       case Element::TYPED_OBJECT_AMF0:
-         cerr << endl;
+         os << endl;
          break;
       case Element::AMF3_DATA:
          if (getDataSize() != 0) {
              log_debug("FIXME: got AMF3 data!");
          }
-//       cerr << "AMF3 data is: 0x" << hexify(_data, _length, false) << endl;
+//       os << "AMF3 data is: 0x" << hexify(_data, _length, false) << endl;
          break;
 //       case Element::VARIABLE:
 //       case Element::FUNCTION:
@@ -1496,7 +1495,7 @@
 
     if (_type != Element::BOOLEAN_AMF0) {
        if (_buffer) {
-           _buffer->dump();
+           _buffer->dump(os);
        }
     }
 

=== modified file 'utilities/flvdumper.cpp'
--- utilities/flvdumper.cpp     2008-12-20 17:11:55 +0000
+++ utilities/flvdumper.cpp     2009-02-15 01:34:06 +0000
@@ -163,7 +163,7 @@
         
         catch (Arg_parser::ArgParserException &e) {
             cerr << _("Error parsing command line options: ") << e.what() << 
endl;
-            cerr << _("This is a Gnash bug.") << endl;
+            cerr << _("This is a Gnash flvdumper bug.") << endl;
         }
     }
     
@@ -179,8 +179,6 @@
     Flv flv; 
     struct stat st;
 
-    boost::uint8_t *buf = 0;
-    boost::uint8_t *ptr = 0;
 //    boost::shared_ptr<Flv::flv_header_t> head;
     Flv::previous_size_t   previous = 0;
     boost::shared_ptr<Flv::flv_tag_t> tag;
@@ -238,7 +236,7 @@
                 ifs.read(reinterpret_cast<char *>(buf->reference()), bodysize);
                 // Got to the end of the file
                 if (ifs.eof()) {
-                    cerr << "end of file" << endl;
+                    cout << "end of file" << endl;
                     break;
                 }
                 total -= bodysize;
@@ -246,7 +244,7 @@
                   case Flv::TAG_AUDIO:
                   {
                       if (all) {
-                          cerr << "FLV Tag type is: Audio" << endl;
+                          cout << "FLV Tag type is: Audio" << endl;
                           boost::shared_ptr<Flv::flv_audio_t> data = 
flv.decodeAudioData(*(buf->reference() + sizeof(Flv::flv_tag_t)));
                           cout << "\tSound Type is: "   << 
type_strs[data->type] << endl;
                           cout << "\tSound Size is: "   << 
size_strs[data->size] << endl;
@@ -271,7 +269,7 @@
                       }
                       boost::shared_ptr<amf::Element> metadata = 
flv.decodeMetaData(buf->reference(), bodysize);
                       if (meta && metadata) {
-                          metadata->dump();
+                          metadata->dump(std::cout);
                       }
                       continue;
                 };              





reply via email to

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