[tracker/drm] tracker-extract-gstreamer: Handle encrypted streams



commit a7298a681d9c7d9aae036c42bb3184360aee0fdc
Author: Jürg Billeter <j bitron ch>
Date:   Thu Feb 4 11:32:52 2010 +0100

    tracker-extract-gstreamer: Handle encrypted streams
    
    Also extract metadata from encrypted streams and set
    nfo:isContentEncrypted to true for these files.
    
    Fixes NB#152635.

 src/tracker-extract/tracker-extract-gstreamer.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 04d6636..d1c770a 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -117,6 +117,8 @@ typedef struct {
 	/* Tags and data */
 	GstTagList     *tagcache;
 
+	gboolean        is_content_encrypted;
+
 	unsigned char  *album_art_data;
 	guint           album_art_size;
 	const gchar    *album_art_mime;
@@ -636,6 +638,11 @@ extract_metadata (MetadataExtractor      *extractor,
 		add_y_date_gst_tag (metadata, uri, "nie:contentCreated", extractor->tagcache, GST_TAG_DATE);
 		add_string_gst_tag (metadata, uri, "nie:comment", extractor->tagcache, GST_TAG_COMMENT);
 
+		if (extractor->is_content_encrypted) {
+			tracker_sparql_builder_predicate (metadata, "nfo:isContentEncrypted");
+			tracker_sparql_builder_object_boolean (metadata, TRUE);
+		}
+
 		if (extractor->mime == EXTRACT_MIME_VIDEO) {
 			add_string_gst_tag (metadata, uri, "dc:source", extractor->tagcache, GST_TAG_CLASSIFICATION);
 
@@ -868,6 +875,22 @@ poll_for_ready (MetadataExtractor *extractor,
 			gchar  *error_message;
 
 			gst_message_parse_error (message, &lerror, &error_message);
+
+#if (GST_VERSION_MICRO >= 20)
+			if (lerror->domain == GST_STREAM_ERROR) {
+				if (lerror->code == GST_STREAM_ERROR_DECRYPT ||
+				    lerror->code == GST_STREAM_ERROR_DECRYPT_NOKEY) {
+					/* also extract metadata from encrypted streams */
+
+					extractor->is_content_encrypted = TRUE;
+
+					g_free (error_message);
+					g_error_free (lerror);
+					break;
+				}
+			}
+#endif
+
 			gst_message_unref (message);
 			g_warning ("Got error :%s", error_message);
 			g_free (error_message);



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