Author: fejj
Date: 2007-12-06 15:47:59 -0500 (Thu, 06 Dec 2007)
New Revision: 90847
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/animation.h
trunk/moon/src/clock.cpp
trunk/moon/src/media.cpp
trunk/moon/src/media.h
Log:
2007-12-06 Jeffrey Stedfast <[EMAIL PROTECTED]>
* media.cpp (media_element_get_attributes): Added.
(media_element_set_attributes): Added.
(MediaElement): Set an empty list of attributes as per the spec.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-12-06 20:01:08 UTC (rev 90846)
+++ trunk/moon/src/ChangeLog 2007-12-06 20:47:59 UTC (rev 90847)
@@ -1,3 +1,9 @@
+2007-12-06 Jeffrey Stedfast <[EMAIL PROTECTED]>
+
+ * media.cpp (media_element_get_attributes): Added.
+ (media_element_set_attributes): Added.
+ (MediaElement): Set an empty list of attributes as per the spec.
+
2007-12-06 Stephane Delcroix <[EMAIL PROTECTED]>
* media.cpp:
Modified: trunk/moon/src/animation.h
===================================================================
--- trunk/moon/src/animation.h 2007-12-06 20:01:08 UTC (rev 90846)
+++ trunk/moon/src/animation.h 2007-12-06 20:47:59 UTC (rev 90847)
@@ -529,6 +529,7 @@
class Storyboard : public ParallelTimeline {
public:
Storyboard ();
+ virtual ~Storyboard ();
virtual Type::Kind GetObjectType () { return Type::STORYBOARD; };
void Begin ();
@@ -536,8 +537,7 @@
void Resume ();
void Seek (TimeSpan timespan);
void Stop ();
- virtual ~Storyboard ();
-
+
static DependencyProperty* TargetNameProperty;
static DependencyProperty* TargetPropertyProperty;
Modified: trunk/moon/src/clock.cpp
===================================================================
--- trunk/moon/src/clock.cpp 2007-12-06 20:01:08 UTC (rev 90846)
+++ trunk/moon/src/clock.cpp 2007-12-06 20:47:59 UTC (rev 90847)
@@ -334,7 +334,6 @@
c->Tick ();
}
}
-
// ... then cause all clocks to raise the events they've queued
up
RaiseEnqueuedEvents ();
@@ -1284,7 +1283,7 @@
node = (Collection::Node *) collection->list->First ();
for ( ; node != NULL; node = (Collection::Node *) node->next) {
- Clock* clock = ((Timeline *) node->obj)->AllocateClock ();
+ Clock *clock = ((Timeline *) node->obj)->AllocateClock ();
group->AddChild (clock);
clock->unref ();
}
Modified: trunk/moon/src/media.cpp
===================================================================
--- trunk/moon/src/media.cpp 2007-12-06 20:01:08 UTC (rev 90846)
+++ trunk/moon/src/media.cpp 2007-12-06 20:47:59 UTC (rev 90847)
@@ -264,10 +264,10 @@
if (mplayer == NULL || mplayer->asf_parser == NULL ||
mplayer->asf_parser->script_command == NULL)
return;
- char** command_types = NULL;
- asf_script_command_entry ** commands = NULL;
- asf_script_command * command = mplayer->asf_parser->script_command;
- TimelineMarkerCollection* col = NULL;
+ char **command_types = NULL;
+ asf_script_command_entry **commands = NULL;
+ asf_script_command *command = mplayer->asf_parser->script_command;
+ TimelineMarkerCollection *col = NULL;
int i = -1;
commands = command->get_commands (mplayer->asf_parser, &command_types);
@@ -282,8 +282,8 @@
i = -1;
while (commands [++i] != NULL) {
- asf_script_command_entry* entry = commands [i];
- TimelineMarker* marker = new TimelineMarker ();
+ asf_script_command_entry *entry = commands [i];
+ TimelineMarker *marker = new TimelineMarker ();
marker->SetValue (TimelineMarker::TextProperty, entry->get_name
());
if (entry->type_index + 1 <= command->command_type_count) {
marker->SetValue (TimelineMarker::TypeProperty,
command_types [entry->type_index]);
@@ -291,9 +291,10 @@
marker->SetValue (TimelineMarker::TypeProperty, "");
}
//printf ("MediaElement::ReadMarkers () Added marker at %i
(text: %s, type: %s)\n", entry->pts, entry->get_name (), command_types
[entry->type_index]);
- marker->SetValue (TimelineMarker::TimeProperty, Value((gint64)
entry->pts * 10000, Type::TIMESPAN));
+ marker->SetValue (TimelineMarker::TimeProperty, Value
((int64_t) entry->pts * 10000, Type::TIMESPAN));
col->Add (marker);
}
+
// Docs says we overwrite whatever's been loaded already.
SetValue (MarkersProperty, col);
@@ -309,49 +310,47 @@
}
void
-MediaElement::CheckMarkers (gint64 from, gint64 to)
+MediaElement::CheckMarkers (int64_t from, int64_t to)
{
//printf ("MediaElement::CheckMarkers (%llu, %llu)\n", from, to);
if (from == to)
return;
- Value* val = GetValue (MarkersProperty);
+ Value *val = GetValue (MarkersProperty);
if (val == NULL)
return;
- TimelineMarkerCollection* col = GetValue
(MarkersProperty)->AsTimelineMarkerCollection ();
+ TimelineMarkerCollection *col = GetValue
(MarkersProperty)->AsTimelineMarkerCollection ();
if (col == NULL)
return;
-
// We might want to use a more intelligent algorithm here,
// this code only loops through all markers on every frame.
- Collection::Node* node = (Collection::Node*) col->list->First ();
+ Collection::Node *node = (Collection::Node *) col->list->First ();
while (node != NULL) {
- TimelineMarker* marker = (TimelineMarker*) node->obj;
+ TimelineMarker *marker = (TimelineMarker *) node->obj;
if (marker == NULL)
return;
-
+
val = marker->GetValue (TimelineMarker::TimeProperty);
if (val == NULL)
return;
- gint64 pts = (gint64) val->AsTimeSpan ();
+ int64_t pts = (int64_t) val->AsTimeSpan ();
- if (pts >=from && pts <= to) {
- printf ("MediaElement::CheckMarkers (%llu, %llu): Hit
marker '%s' at '%llu'.\n", from, to, marker->GetValue
(TimelineMarker::TextProperty)->AsString (), pts);
+ if (pts >= from && pts <= to) {
marker->ref ();
Emit (MarkerReachedEvent, marker);
marker->unref ();
}
- node = (Collection::Node*) node->next;
+ node = (Collection::Node *) node->next;
}
}
@@ -404,10 +403,14 @@
part_name = NULL;
source = NULL;
- TimelineMarkerCollection *col = new TimelineMarkerCollection ();
- media_element_set_markers (this, col);
- col->unref ();
+ MediaAttributeCollection *attrs = new MediaAttributeCollection ();
+ media_element_set_attributes (this, attrs);
+ attrs->unref ();
+ TimelineMarkerCollection *markers = new TimelineMarkerCollection ();
+ media_element_set_markers (this, markers);
+ markers->unref ();
+
previous_position = 0;
}
@@ -439,6 +442,7 @@
{
double h = framework_element_get_height (this);
double w = framework_element_get_width (this);
+
if (w == 0.0 && h == 0.0) {
h = (double) mplayer->height;
w = (double) mplayer->width;
@@ -680,7 +684,7 @@
void
MediaElement::Pause ()
{
- //printf ("MediaElement::Pause() requested\n");
+ //printf ("MediaElement(%p)::Pause() requested\n", this);
play_pending = false;
@@ -696,7 +700,7 @@
void
MediaElement::Play ()
{
- //printf ("MediaElement::Play() requested\n");
+ //printf ("MediaElement(%p)::Play() requested\n", this);
if (downloader && downloader->Completed () && !mplayer->IsPlaying ()) {
source->Play ();
@@ -709,7 +713,7 @@
void
MediaElement::Stop ()
{
- //printf ("MediaElement::Stop() requested\n");
+ //printf ("MediaElement(%p)::Stop() requested\n", this);
play_pending = false;
@@ -905,11 +909,25 @@
}
void
-media_element_set_source (MediaElement *media, DependencyObject* Downloader,
const char* PartName)
+media_element_set_source (MediaElement *media, DependencyObject *Downloader,
const char *PartName)
{
media->SetSource (Downloader, PartName);
}
+MediaAttributeCollection *
+media_element_get_attributes (MediaElement *media)
+{
+ Value *value = media->GetValue (MediaElement::AttributesProperty);
+
+ return value ? (MediaAttributeCollection *)
value->AsMediaAttributeCollection () : NULL;
+}
+
+void
+media_element_set_attributes (MediaElement *media, MediaAttributeCollection
*value)
+{
+ media->SetValue (MediaElement::AttributesProperty, Value (value));
+}
+
int
media_element_get_audio_stream_count (MediaElement *media)
{
@@ -1051,7 +1069,7 @@
media->SetValue (MediaElement::MarkersProperty, Value (value));
}
-Duration*
+Duration *
media_element_get_natural_duration (MediaElement *media)
{
return media->GetValue
(MediaElement::NaturalDurationProperty)->AsDuration ();
@@ -1114,7 +1132,7 @@
//
// Image
//
-GHashTable* Image::surface_cache = NULL;
+GHashTable *Image::surface_cache = NULL;
int Image::ImageFailedEvent = -1;
@@ -1613,7 +1631,7 @@
const char *
media_attribute_get_value (MediaAttribute *attribute)
{
- Value * value = attribute->GetValue (MediaAttribute::ValueProperty);
+ Value *value = attribute->GetValue (MediaAttribute::ValueProperty);
return value ? value->AsString () : NULL;
}
Modified: trunk/moon/src/media.h
===================================================================
--- trunk/moon/src/media.h 2007-12-06 20:01:08 UTC (rev 90846)
+++ trunk/moon/src/media.h 2007-12-06 20:47:59 UTC (rev 90847)
@@ -32,7 +32,7 @@
virtual Type::Kind GetObjectType () { return Type::MEDIAATTRIBUTE; };
};
-MediaAttribute *media_attribute_new ();
+MediaAttribute *media_attribute_new (void);
const char *media_attribute_get_value (MediaAttribute *attribute);
void media_attribute_set_value (MediaAttribute *attribute, const char *value);
@@ -50,7 +50,7 @@
virtual void OnPropertyChanged (DependencyProperty *prop);
};
-MediaBase* media_base_new ();
+MediaBase *media_base_new (void);
char *media_base_get_source (MediaBase *media);
void media_base_set_source (MediaBase *media, const char *value);
@@ -62,12 +62,12 @@
class Image : public MediaBase {
bool create_xlib_surface;
-
+
bool CreateSurface (const char *fname);
void CleanupSurface ();
void CleanupPattern ();
void DownloaderAbort ();
-
+
// downloader callbacks
void PixbufWrite (guchar *bug, gsize offset, gsize count);
void DownloaderComplete ();
@@ -80,16 +80,16 @@
struct CachedSurface {
int ref_cnt;
-
+
char *fname;
cairo_surface_t *cairo;
bool xlib_surface_created;
GdkPixbuf *backing_pixbuf;
-
+
int width;
int height;
};
-
+
CachedSurface *surface;
char *part_name;
@@ -97,11 +97,11 @@
cairo_pattern_t *pattern;
double pattern_opacity;
int opacity_stability_count;
-
+
public:
Image ();
virtual ~Image ();
-
+
virtual Type::Kind GetObjectType () { return Type::IMAGE; };
virtual void Render (cairo_t *cr, Region *region);
@@ -109,18 +109,18 @@
virtual Point GetTransformOrigin ();
cairo_surface_t *GetCairoSurface ();
-
+
void SetSource (DependencyObject *Downloader, const char *PartName);
-
+
virtual void OnPropertyChanged (DependencyProperty *prop);
-
+
int GetHeight () { return surface ? surface->height : 0; };
int GetWidth () { return surface ? surface->width : 0; };
-
+
ImageBrush *brush;
-
+
static GHashTable *surface_cache;
-
+
static int ImageFailedEvent;
};
@@ -132,39 +132,39 @@
MediaElement *element;
char *source_name;
char *file_name;
-
+
MediaSource (MediaElement *element, const char *source_name, const char
*file_name);
-
+
MediaPlayer *GetMediaPlayer ();
-
+
virtual bool OpenInternal () = 0;
-
+
public:
virtual ~MediaSource ();
-
+
const char *GetSourceName ();
const char *GetFileName ();
-
+
virtual bool Open ();
virtual void Play () = 0;
virtual void Pause () = 0;
virtual void Stop (bool media_ended) = 0;
virtual void Close () = 0;
-
+
static MediaSource *CreateSource (MediaElement *element, const char
*source_name, const char *file_name);
};
class SingleMedia : public MediaSource {
private:
guint advance_frame_timeout_id;
-
+
void ClearTimeout ();
protected:
virtual bool OpenInternal ();
public:
SingleMedia (MediaElement *element, const char *source_name, const char
*file_name);
virtual ~SingleMedia ();
-
+
virtual void Play ();
virtual void Pause ();
virtual void Stop (bool media_ended);
@@ -199,7 +199,7 @@
static void size_notify (int64_t size, gpointer data);
void ReadASFMarkers ();
- void CheckMarkers (gint64 from, gint64 to);
+ void CheckMarkers (int64_t from, int64_t to);
public:
static DependencyProperty *AttributesProperty;
@@ -266,6 +266,9 @@
gboolean media_element_advance_frame (gpointer data);
+MediaAttributeCollection *media_element_get_attributes (MediaElement *media);
+void media_element_set_attributes (MediaElement *media,
MediaAttributeCollection *value);
+
int media_element_get_audio_stream_count (MediaElement *media);
void media_element_set_audio_stream_count (MediaElement *media, int value);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches