[Bug 677757] datetime: allow GstDateTime where not all fields are set

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sun Jun 10 08:33:22 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=677757
  GStreamer | gstreamer (core) | git

Oleksij Rempel <bug-track> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #216032|0                           |1
        is obsolete|                            |

--- Comment #3 from Oleksij Rempel <bug-track at fisher-privat.net> 2012-06-10 15:33:18 UTC ---
Created an attachment (id=216063)
 View: https://bugzilla.gnome.org/attachment.cgi?id=216063
 Review: https://bugzilla.gnome.org/review?bug=677757&attachment=216063

[RFC] patch v1

This patch is my proposal for this issue.
The previous API is not changed, so it even should not brake any thing.

i added 3 functions:
gst_date_time_set_partial_flags
gst_date_time_get_partial_flags
gst_date_time_new_ymd

use case:

ret = sscanf (value, "%04d-%02d-%02dT%02d:%02d:%02d"
    &year, &month, &day, &hour, &minute, &second);

if (ret = 3)
  datetime = gst_date_time_new_ymd(year, month, day);
else if (ret = 1) {
  datetime = gst_date_time_new_ymd(year, 1, 1);
  gst_date_time_set_partial_flags(datetime,
      GST_DATE_TIME_HAS_NO_MONTH |
      GST_DATE_TIME_HAS_NO_DAY);
} ... 
same with
gst_date_time_new or gst_date_time_new_local_time


example on restoring the date:
flags = gst_date_time_get_partial_flags(datetime);
if(!flags & GST_DATE_TIME_HAS_NO_YEAR)
  year = gst_date_time_get_year(datetime);
  ... do what you need...
else
  ... stop processing or skip year and continue with month ...

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list