gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash/server video_stream_instance.cpp video_st...


From: Vitaly Alexeev
Subject: [Gnash-commit] gnash/server video_stream_instance.cpp video_st...
Date: Fri, 27 Oct 2006 14:26:42 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Vitaly Alexeev <alexeev>        06/10/27 14:26:42

Added files:
        server         : video_stream_instance.cpp 
                         video_stream_instance.h 

Log message:
        videostream implementation

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.h?cvsroot=gnash&rev=1.1

Patches:
Index: video_stream_instance.cpp
===================================================================
RCS file: video_stream_instance.cpp
diff -N video_stream_instance.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ video_stream_instance.cpp   27 Oct 2006 14:26:42 -0000      1.1
@@ -0,0 +1,96 @@
+#include "video_stream_instance.h"
+#include "video_stream_def.h"
+#include "fn_call.h"
+#include "as_value.h"
+#include "NetStream.h"
+#include "render.h"
+#include <SDL.h>
+
+namespace gnash {
+
+       static void
+       attach_video(const fn_call& fn)
+       {
+               assert(dynamic_cast<video_stream_instance*>(fn.this_ptr));
+               video_stream_instance* video = 
static_cast<video_stream_instance*>(fn.this_ptr);
+       
+               if (fn.nargs != 1)
+               {
+           log_error("attachVideo needs 1 arg\n");
+           return;
+               }
+
+//             if (dynamic_cast<netstream_as_object*>(fn.arg(0).to_object()))
+               if (video)
+               {
+                       video->m_ns = 
static_cast<netstream_as_object*>(fn.arg(0).to_object());
+               }
+       }
+
+       video_stream_instance::video_stream_instance(
+               video_stream_definition* def, character* parent, int id)
+       :
+       character(parent, id),
+       m_def(def),
+       m_video_source(NULL),
+       m_ns(NULL)
+//     m_source(NULL)
+{
+       assert(m_def);
+       set_member("attachVideo", &attach_video);
+}
+
+video_stream_instance::~video_stream_instance()
+{
+}
+
+void
+video_stream_instance::display()
+{
+       if (m_ns)
+       {
+               matrix m = get_world_matrix();
+               rect bounds(0.0f, 0.0f, PIXELS_TO_TWIPS(m_def->m_width), 
PIXELS_TO_TWIPS(m_def->m_height));
+
+               netstream_as_object* nso = 
static_cast<netstream_as_object*>(m_ns);
+
+               if (nso->obj.playing())
+               {
+                       YUV_video* v = nso->obj.get_video();
+                       if (v)
+                       {
+                               v->display(&m, &bounds);
+                       }
+               }
+       }
+}
+
+void
+video_stream_instance::advance(float delta_time)
+{
+}
+
+//void
+//video_stream_instance::set_member(const tu_stringi& name,    const as_value& 
val)
+//{
+//     if (name == "attachVideo")
+//     {
+//             m_video_source = val.to_object();
+//     }
+//     set_member(name, val);
+//}
+
+//bool
+//video_stream_instance::get_member(const tu_stringi& name, as_value* val)
+//{
+//     if (name == "attachVideo")
+//     {
+//             m_video_source = val->to_object();
+//             val->set_as_object(m_video_source); // 
>set_bool(this->get_visible());
+//             return true;
+//     }
+//     return false;
+//}
+
+} // end of namespace gnash
+

Index: video_stream_instance.h
===================================================================
RCS file: video_stream_instance.h
diff -N video_stream_instance.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ video_stream_instance.h     27 Oct 2006 14:26:42 -0000      1.1
@@ -0,0 +1,50 @@
+#ifndef GNASH_VIDEO_STREAM_INSTANCE_H
+#define GNASH_VIDEO_STREAM_INSTANCE_H
+
+#include "character.h" // for inheritance
+#include "video_stream_def.h"
+
+namespace gnash {
+
+class video_stream_instance : public character
+{
+
+public:
+
+//     const as_object* m_source;
+       video_stream_definition*        m_def;
+       
+       // m_video_source - A Camera object that is capturing video data or a 
NetStream object.
+       // To drop the connection to the Video object, pass null for source.
+       as_object* m_video_source;
+
+       video_stream_instance(video_stream_definition* def,
+                       character* parent, int id);
+
+       ~video_stream_instance();
+
+       virtual void    advance(float delta_time);
+       void    display();
+
+       bool can_handle_mouse_event() { return false; }
+
+//     void set_source(const as_object* source)
+//     {
+//             m_source = source;
+//     }
+
+       //
+       // ActionScript overrides
+       //
+
+//     virtual void set_member(const tu_stringi& name, const as_value& val);
+//     virtual bool get_member(const tu_stringi& name, as_value* val);
+
+       as_object* m_ns;
+
+};
+
+}      // end namespace gnash
+
+
+#endif // GNASH_VIDEO_STREAM_INSTANCE_H




reply via email to

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