Re: [Tracker] Add support for OMA DRM Content format

On Fri, 2011-02-18 at 16:57 +0800, Lin, Mengdong wrote:

I want to add support for OMA DRM Content Format (DCF), an encrypted file format. Here is my solution:
(1) I've registered *.dcf files in shared-mime-info, MIME type is "application/vnd.oma.drm.content". 

(2) We developed a DRM-aware GStreamer file source plug-in that can decrypt the protected content. So 
GStreamer can play the content and extract meta data from it. This means the GStreamer extractor can be 
re-used to extract metadata. 

(3) I plan to write a extractor:
  It will get the original media MIME type from the DCF file header, since the file header is not encrypted.
  If the MIME type is video, audio or image, the extractor will call GStreamer extractor to do the 
following work.  
  This is the method suggested by Philip gnome org/msg06840.html
  The difference is that not specific extractors (eg. MP3 extractor) but the general extractor - GStreamer 
will be used to extract meta data,  because specific extractors cannot parse the encrypted DCF format. 
Is this method doable?  
I want to make code like this. But I still have two questions:
1. How can my extractor see the general extractors? "priv-> generic_extractors" is a private data structure 
of tracker-extract. But I don't want to duplicate the work of GStreamer-extractor to use the decodebin2.

That would be something you'd have to develop. I'm guessing that adding
an API like tracker_extract_get_generic_extractors could be needed here.

2. Are there any other generic extractors that can disturb the flow?

That is hard to say, we will of course continue developing extractors as
time goes by.

Perhaps add -drm to the MIME-type that you parse, and then add it as
such to the GStreamer extractor? (to avoid that other extractors are
found as supporting your DRM encrypted file, too, while they don't
support it).

For example (inline changed):

static TrackerExtractData extract_data[] = {
  { "application/vnd.oma.drm.content", extract_drm}
  { NULL, NULL }

TrackerExtractData *
tracker_extract_get_data (void) {
  return extract_data;

And it passes that to a native one:

static void
extract_drm (const gchar          *uri,
             TrackerSparqlBuilder *preupdate,
             TrackerSparqlBuilder *metadata) {
    GPtrArray *generic_extractors;
    const gchar *orig_mime;
    gchar *passed_mime;

    generic_extractors = tracker_extract_get_generic_extractors ();

    orig_mime = ...
        /* parse the original media MIME type,
        If this is video or audio, set the pattern as "audio/*"
        or "video/*" */

    passed_mime = g_strdup_printf ("%s-drm", orig_mime);

   for (i = 0; i < generic_extractors->len; i++) {
      const TrackerExtractData *edata;
      ModuleData *mdata;

      mdata = &g_array_index (priv->generic_extractors, ModuleData, i);
      edata = mdata->edata;

          if (g_pattern_match (mdata->pattern, length, passed_mime, reversed)) {
              (*edata->func) (uri, preupdate, statements);

          else if if (g_pattern_match (mdata->pattern, length, passed_mime, reversed)) {
              (*edata->func) (uri, preupdate, statements);
          else if if (g_pattern_match (mdata->pattern, length, passed_mime, reversed)) {
              (*edata->func) (uri, preupdate, statements);
      /* DCF can also be used to protect JAVA applications, but we have no underlying components can 
extract their meta data */

    g_free (passed_mime);


And then in tracker-extract-gstreamer.c:

static TrackerExtractData data[] = {
        { "audio/*", extract_gstreamer_audio },
        { "video/*", extract_gstreamer_video },
        { "image/*", extract_gstreamer_image },
        { "image/svg+xml", extract_gstreamer_svg },
        /* Tell gstreamer to guess if mimetype guessing returns video also for
audio files */
        { "video/3gpp", extract_gstreamer_guess },
        { "video/mp4", extract_gstreamer_guess },
        { "video/x-ms-asf", extract_gstreamer_guess },
        /* DRM formats */

+       { "audio/*-drm", extract_gstreamer_audio },
+       { "video/*-drm", extract_gstreamer_video },
+       { "image/*-drm", extract_gstreamer_image },
+       { "image/svg+xml-drm", extract_gstreamer_svg },
+       { "video/3gpp-drm", extract_gstreamer_guess },
+       { "video/mp4-drm", extract_gstreamer_guess },
+       { "video/x-ms-asf-drm", extract_gstreamer_guess },

        { NULL, NULL }




Philip Van Hoof
freelance software developer
Codeminded BVBA -

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