4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
8 * This library is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; either version 2.1 of the License, or (at your option)
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 * License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, write to the Free Software Foundation, Inc., 51
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #include "gstdrmsrc.h"
30 #define LOG_TRACE(message) //g_print("DRM_SRC: %s: %d: %s - %s \n", __FILE__, __LINE__, __FUNCTION__, message);
32 #define GST_TAG_PLAYREADY "playready_file_path"
34 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,GST_STATIC_CAPS_ANY);
37 GST_DEBUG_CATEGORY_STATIC (gst_drm_src_debug);
38 #define GST_CAT_DEFAULT gst_drm_src_debug
47 static void gst_drm_src_finalize (GObject * object);
48 static void gst_drm_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
49 static void gst_drm_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
50 static gboolean gst_drm_src_start (GstBaseSrc * basesrc);
51 static gboolean gst_drm_src_stop (GstBaseSrc * basesrc);
52 static gboolean gst_drm_src_is_seekable (GstBaseSrc * src);
53 static gboolean gst_drm_src_get_size (GstBaseSrc * src, guint64 * size);
54 static GstFlowReturn gst_drm_src_create (GstBaseSrc * src, guint64 offset, guint length, GstBuffer ** buffer);
55 static void gst_drm_src_uri_handler_init (gpointer g_iface, gpointer iface_data);
57 * This function does the following:
58 * 1. Initializes GstDrmSrc ( defines gst_drm_get_type)
60 * @param drmsrc_type [out] GType
64 static void _do_init (GType drmsrc_type)
66 // 1. Initializes GstDrmSrc ( defines gst_drm_get_type)
67 static const GInterfaceInfo urihandler_info = {
68 gst_drm_src_uri_handler_init,
73 g_type_add_interface_static (drmsrc_type, GST_TYPE_URI_HANDLER, &urihandler_info);
74 GST_DEBUG_CATEGORY_INIT (gst_drm_src_debug, "drmsrc", 0, "drmsrc element");
76 GST_BOILERPLATE_FULL (GstDrmSrc, gst_drm_src, GstBaseSrc, GST_TYPE_BASE_SRC, _do_init);
78 * This function does the following:
79 * 1. Sets the class details
80 * 2. Adds the source pad template
82 * @param g_class [out] gpointer
86 static void gst_drm_src_base_init (gpointer g_class)
88 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
89 // 1. Sets the class details
90 gst_element_class_set_details_simple (gstelement_class,
93 "Read from arbitrary point in a standard/DRM file",
94 "Kishore Arepalli <kishore.a@samsung.com> and Sadanand Dodawadakar <sadanand.d@samsung.com>");
95 // 2. Adds the source pad template
96 gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&srctemplate));
99 * This function does the following:
100 * 1. Installs the properties
101 * 2. Assigns the function pointers GObject class attributes
103 * @param klass [out] GstDrmSrcClass Structure
107 static void gst_drm_src_class_init (GstDrmSrcClass * klass)
109 GObjectClass *gobject_class;
110 GstElementClass *gstelement_class;
111 GstBaseSrcClass *gstbasesrc_class;
112 gobject_class = G_OBJECT_CLASS (klass);
113 gstelement_class = GST_ELEMENT_CLASS (klass);
114 gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
115 // Assigns the function pointers GObject class attributes
116 gobject_class->set_property = gst_drm_src_set_property;
117 gobject_class->get_property = gst_drm_src_get_property;
118 // 1. Installs the properties
119 g_object_class_install_property (gobject_class, ARG_FD,
120 g_param_spec_int ("fd", "File-descriptor",
121 "File-descriptor for the file being mmap()d", 0, G_MAXINT, 0,
123 g_object_class_install_property (gobject_class, ARG_LOCATION,
124 g_param_spec_string ("location", "File Location",
125 "Location of the file to read", NULL, G_PARAM_READWRITE));
126 g_object_class_install_property (gobject_class, IS_DRM,
127 g_param_spec_boolean ("is-drm", "whether selected file type is drm or not",
128 "true, false", FALSE, G_PARAM_READWRITE));
129 // 2. Assigns the function pointers GObject class attributes
130 gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_drm_src_finalize);
131 gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_drm_src_start);
132 gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_drm_src_stop);
133 gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_drm_src_is_seekable);
134 gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_drm_src_get_size);
135 gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_drm_src_create);
138 gst_tag_register (GST_TAG_PLAYREADY, GST_TAG_FLAG_META,
140 "PlayReady File Path",
141 "a tag that is specific to PlayReady File",
145 * This function does the following:
146 * 1. Initilizes the parameters of GstDrmSrc
148 * @param src [out] GstDrmSrc structure
149 * @param g_class [in] GstDrmSrcClass structure
151 * @return gboolean Returns TRUE on success and FALSE on ERROR
153 static void gst_drm_src_init (GstDrmSrc * src, GstDrmSrcClass * g_class)
155 // 1. Initilizes the parameters of GstDrmSrc
156 src->filename = NULL;
159 src->is_regular = FALSE;
160 src->drm_file = FALSE;
161 src->seekable = FALSE;
163 src->event_posted = FALSE;
164 src->is_playready = FALSE;
168 * This function does the following:
169 * 1. deallocates the filename and uri
170 * 2. calls the parent class->finalize
172 * @param object [in] GObject Structure
176 static void gst_drm_src_finalize (GObject * object)
180 src = GST_DRM_SRC (object);
181 // 1. deallocates the filename and uri
182 g_free (src->filename);
184 // 2. calls the parent class->finalize
185 G_OBJECT_CLASS (parent_class)->finalize (object);
188 * This function does the following:
189 * 1. Checks the state
190 * 2. Checks the filename
191 * 3. Sets the filename
193 * @param src [in] GstDrmSrc Structure
194 * @param location [in] location of the file
196 * @return gboolean Returns TRUE on success and FALSE on ERROR
198 static gboolean gst_drm_src_set_location (GstDrmSrc * src, const gchar * location)
202 GST_OBJECT_LOCK (src);
203 // 1. Checks the state
204 state = GST_STATE (src);
205 if (state != GST_STATE_READY && state != GST_STATE_NULL)
207 GST_DEBUG_OBJECT (src, "setting location in wrong state");
208 GST_OBJECT_UNLOCK (src);
211 GST_OBJECT_UNLOCK (src);
212 g_free (src->filename);
214 // 2. Checks the filename
215 if (location == NULL)
217 src->filename = NULL;
222 // 3. Sets the filename
223 src->filename = g_strdup (location);
224 src->uri = gst_uri_construct ("file", src->filename);
226 g_object_notify (G_OBJECT (src), "location");
227 gst_uri_handler_new_uri (GST_URI_HANDLER (src), src->uri);
231 * This function does the following:
232 * 1. Sets the location of the file.
234 * @param object [in] GObject Structure
235 * @param prop_id [in] id of the property
236 * @param value [in] property value
237 * @param pspec [in] GParamSpec Structure
241 static void gst_drm_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
245 g_return_if_fail (GST_IS_DRM_SRC (object));
246 src = GST_DRM_SRC (object);
249 // 1. Sets the location of the file.
251 gst_drm_src_set_location (src, g_value_get_string (value));
254 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
259 * This function does the following:
260 * 1. Provides the location of the file.
261 * 2. Provides the file descriptor.
263 * @param object [in] GObject Structure
264 * @param prop_id [in] id of the property
265 * @param value [out] property value
266 * @param pspec [in] GParamSpec Structure
270 static void gst_drm_src_get_property (GObject * object, guint prop_id, GValue * value,GParamSpec * pspec)
274 g_return_if_fail (GST_IS_DRM_SRC (object));
275 src = GST_DRM_SRC (object);
278 // 1. Provides the location of the file.
280 g_value_set_string (value, src->filename);
282 // 2. Provides the file descriptor.
284 g_value_set_int (value, src->fd);
287 g_value_set_boolean(value, src->drm_file);
290 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
295 * This function does the following:
296 * 1. Seeks to the specified position for DRM file.
297 * 2. Allocates a buffer to push the data for DRM file.
298 * 3. Reads from the file and sets the related params for DRM file.
300 * @param i_pDrmSrc [in] GstDrmSrc Structure
301 * @param i_uiOffset [in] offset of the file to seek
302 * @param length [in] size of the data in bytes
303 * @param o_pBbuffer [out] GstBuffer to hold the contents
305 * @return GstFlowReturn Returns GST_FLOW_OK on success and ERROR on failure
307 static GstFlowReturn gst_drm_src_create_read_drm_file (GstDrmSrc* i_pDrmSrc, guint64 i_uiOffset, guint length, GstBuffer ** o_pBbuffer)
309 GstBuffer *buf = NULL;
310 unsigned int readSize;
311 DRM_RESULT in_res = DRM_RESULT_SUCCESS;
313 // 1. Seeks to the specified position for DRM file.
314 if (G_UNLIKELY (i_pDrmSrc->read_position != i_uiOffset))
316 in_res =drm_svc_seek_file(i_pDrmSrc->hfile, i_uiOffset, DRM_SEEK_SET);
318 if(in_res != DRM_RESULT_SUCCESS)
321 i_pDrmSrc->read_position = i_uiOffset;
323 // 2. Allocates a buffer to push the data for DRM file.
324 buf = gst_buffer_new_and_alloc (length);
327 LOG_TRACE("Exit on error");
328 return GST_FLOW_ERROR;
330 // 3. Reads from the file and sets the related params for DRM file.
331 in_res = drm_svc_read_file(i_pDrmSrc->hfile, GST_BUFFER_DATA(buf), length, &readSize);
333 if (in_res != DRM_RESULT_SUCCESS)
338 LOG_TRACE("Exit on error");
339 return GST_FLOW_ERROR;
342 #if 0 // Drm service can give lesser size block than requested thing.
343 if (G_UNLIKELY ((guint) readSize < length && i_pDrmSrc->seekable))
345 GST_ELEMENT_ERROR (i_pDrmSrc, RESOURCE, READ, (NULL),("unexpected end of file."));
346 gst_buffer_unref (buf);
347 return GST_FLOW_ERROR;
351 if (G_UNLIKELY (readSize == 0 && length > 0))
353 GST_DEBUG ("non-regular file hits EOS");
354 gst_buffer_unref (buf);
355 return GST_FLOW_UNEXPECTED;
358 GST_BUFFER_SIZE (buf) = length;
359 GST_BUFFER_OFFSET (buf) = i_uiOffset;
360 GST_BUFFER_OFFSET_END (buf) = i_uiOffset + length;
362 i_pDrmSrc->read_position += length;
369 GST_ELEMENT_ERROR (i_pDrmSrc, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
370 return GST_FLOW_ERROR;
374 * This function does the following:
375 * 1. Seeks to the specified position.
376 * 2. Allocates a buffer to push the data
377 * 3. Reads from the file and sets the related params
379 * @param src [in] GstDrmSrc Structure
380 * @param offset [in] offset of the file to seek
381 * @param length [in] size of the data in bytes
382 * @param buffer [out] GstBuffer to hold the contents
384 * @return GstFlowReturn Returns GST_FLOW_OK on success and ERROR on failure
386 static GstFlowReturn gst_drm_src_create_read (GstDrmSrc * src, guint64 offset, guint length, GstBuffer ** buffer)
390 // 1. Seeks to the specified position.
391 if (G_UNLIKELY (src->read_position != offset))
394 res = lseek (src->fd, offset, SEEK_SET);
395 if (G_UNLIKELY (res < 0 || res != offset))
397 GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
398 return GST_FLOW_ERROR;
400 src->read_position = offset;
402 // 2. Allocates a buffer to push the data
403 buf = gst_buffer_new_and_alloc (length);
404 GST_LOG_OBJECT (src, "Reading %d bytes", length);
405 // 3. Reads from the file and sets the related params
406 ret = read (src->fd, GST_BUFFER_DATA (buf), length);
407 if (G_UNLIKELY (ret < 0))
409 GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
410 gst_buffer_unref (buf);
411 return GST_FLOW_ERROR;
413 if (G_UNLIKELY ((guint) ret < length && src->seekable))
415 GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),("unexpected end of file."));
416 gst_buffer_unref (buf);
417 return GST_FLOW_ERROR;
419 if (G_UNLIKELY (ret == 0 && length > 0))
421 GST_DEBUG ("non-regular file hits EOS");
422 gst_buffer_unref (buf);
423 return GST_FLOW_UNEXPECTED;
426 GST_BUFFER_SIZE (buf) = length;
427 GST_BUFFER_OFFSET (buf) = offset;
428 GST_BUFFER_OFFSET_END (buf) = offset + length;
430 src->read_position += length;
434 * This function does the following:
435 * 1. Calls DRM file read chain method for drm files.
436 * 2. Calls normal file read chain method for standard files.
438 * @param basesrc [in] BaseSrc Structure
439 * @param size [out] Size of the file
441 * @return gboolean Returns TRUE on success and FALSE on ERROR
443 static GstFlowReturn gst_drm_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer)
445 GstDrmSrc *src = GST_DRM_SRC (basesrc);
447 if (src->is_playready && src->event_posted == FALSE) {
448 GstTagList *tags = NULL;
449 GST_DEBUG_OBJECT (src, "posting playready tags");
450 tags = gst_tag_list_new_full (GST_TAG_PLAYREADY, src->filename, NULL);
452 GstPad* src_pad = gst_element_get_static_pad (src, "src");
454 src->event_posted = gst_pad_push_event (src_pad, gst_event_new_tag (tags) );
455 GST_DEBUG_OBJECT (src, "posting tags returns [%d]", src->event_posted);
456 gst_object_unref (src_pad);
461 // 1. Calls DRM file read chain method for drm files.
462 if(src->drm_file == TRUE)
463 return gst_drm_src_create_read_drm_file (src, offset, length, buffer);
464 // 2. Calls normal file read chain method for standard files.
465 return gst_drm_src_create_read (src, offset, length, buffer);
469 * @param basesrc [in] BaseSrc Structure
471 * @return gboolean Returns TRUE if the file is seekable and FALSE if the file is not seekable
473 static gboolean gst_drm_src_is_seekable (GstBaseSrc * basesrc)
475 GstDrmSrc *src = GST_DRM_SRC (basesrc);
476 return src->seekable;
479 * This function does the following:
480 * 1. Gets the filesize for drm file by using seek oprations
481 * 2. Gets the file size for standard file by using statistics
483 * @param basesrc [in] BaseSrc Structure
484 * @param size [in] Size of the file
486 * @return gboolean Returns TRUE on success and FALSE on ERROR
488 static gboolean gst_drm_src_get_size (GstBaseSrc * basesrc, guint64 * size)
490 struct stat stat_results;
492 src = GST_DRM_SRC (basesrc);
493 // 1. Gets the filesize for drm file by using seek oprations
494 if(src->drm_file==TRUE)
496 drm_svc_seek_file(src->hfile, 0, DRM_SEEK_END);
497 *size = drm_svc_tell_file(src->hfile);
498 drm_svc_seek_file(src->hfile, 0, DRM_SEEK_SET);
499 src->read_position = 0;
506 // 2. Gets the file size for standard file by using statistics
507 if (fstat (src->fd, &stat_results) < 0)
509 *size = stat_results.st_size;
513 * This function does the following:
514 * 1. Checks the filename
515 * 2. Opens the file and check statistics of the file
516 * 3. Checks whether DRM file or not.
517 * 4. Checks the DRM file type (supports only for OMA) if it is DRM
518 * 5. Opens the DRM file if it is DRM
519 * 6. Gets the DRM_FILE_HANDLE and sets the drm, seekable and regular flag.
520 * 7. Checks the seeking for standard files
522 * @param basesrc [in] BaseSrc Structure
524 * @return gboolean Returns TRUE on success and FALSE on ERROR
526 static gboolean gst_drm_src_start (GstBaseSrc * basesrc)
528 GstDrmSrc *src = GST_DRM_SRC (basesrc);
529 struct stat stat_results;
530 DRM_BOOL res = DRM_TRUE;
531 DRM_FILE_TYPE type = DRM_FILE_TYPE_NONE;
532 DRM_RESULT in_res = DRM_RESULT_SUCCESS;
535 // 1. Checks the filename
536 if (src->filename == NULL || src->filename[0] == '\0')
538 GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,("No file name specified for reading."), (NULL));
541 // 2. Opens the file and check statistics of the file
542 GST_INFO_OBJECT (src, "opening file %s", src->filename);
543 src->fd = open (src->filename, O_RDONLY | O_BINARY);
548 GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),("No such file \"%s\"", src->filename));
551 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("Could not open file \"%s\" for reading.", src->filename), GST_ERROR_SYSTEM);
554 if (fstat (src->fd, &stat_results) < 0)
556 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("Could not get info on \"%s\".", src->filename), (NULL));
560 if (S_ISDIR (stat_results.st_mode))
562 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("\"%s\" is a directory.", src->filename), (NULL));
566 if (S_ISSOCK (stat_results.st_mode))
568 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("File \"%s\" is a socket.", src->filename), (NULL));
572 src->read_position = 0;
573 /* DRM Related code */
574 // 3. Checks whether DRM file or not.
575 PROFILE_BLOCK_BEGIN("drmstart");
576 res = drm_svc_is_drm_file(src->filename);
578 type = drm_svc_get_drm_type(src->filename);
579 GST_LOG_OBJECT (src, "is_drm=[%d], drm_type=[%d]", res, type);
581 /* We handles as DRM file if it is drm with OMA type */
582 if(res == DRM_TRUE && type == DRM_FILE_TYPE_OMA)
584 #if 0 // Do not check here.
585 // 4. Checks the DRM file type (supports only for OMA) if it is DRM
586 if(drm_svc_get_drm_type(src->filename) != DRM_FILE_TYPE_OMA)
588 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("File \"%s\" is not OMA DRM.", src->filename), (NULL));
593 // 5. Opens the DRM file if it is DRM
594 PROFILE_BLOCK_BEGIN("drmopen");
595 in_res=drm_svc_open_file(src->filename, DRM_PERMISSION_PLAY, &(src->hfile));
596 if(in_res != DRM_RESULT_SUCCESS)
598 GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("File \"%s\" open fail.", src->filename), (NULL));
601 PROFILE_BLOCK_END("drmopen");
603 // 6. Gets the DRM_FILE_HANDLE and sets the drm, seekable and regular flags.
604 res = drm_svc_is_drm_file_handle(src->hfile);
607 drm_svc_seek_file(src->hfile, 0, DRM_SEEK_END);
608 drm_svc_seek_file(src->hfile, 0, DRM_SEEK_SET);
610 src->seekable = TRUE;
611 src->is_regular = TRUE;
612 src->drm_file = TRUE;
613 PROFILE_BLOCK_END("drmstart");
619 if(res == DRM_TRUE && type == DRM_FILE_TYPE_PLAYREADY) {
620 src->is_playready = TRUE;
621 src->event_posted = FALSE;
624 // 7. Checks the seeking for standard files
625 if (S_ISREG (stat_results.st_mode))
626 src->is_regular = TRUE;
627 ret = lseek (src->fd, 0, SEEK_END);
630 GST_LOG_OBJECT (src, "disabling seeking, not in mmap mode and lseek "
631 "failed: %s", g_strerror (errno));
632 src->seekable = FALSE;
636 src->seekable = TRUE;
638 lseek (src->fd, 0, SEEK_SET);
639 src->seekable = src->seekable && src->is_regular;
644 * This function does the following:
645 * 1. Closes the file desciptor and resets the flags
647 * @param basesrc [in] BaseSrc Structure
649 * @return gboolean Returns TRUE on success and FALSE on ERROR
651 static gboolean gst_drm_src_stop (GstBaseSrc * basesrc)
653 GstDrmSrc *src = GST_DRM_SRC (basesrc);
656 drm_svc_close_file(src->hfile);
659 // 1. Closes the file desciptor and resets the flags
663 src->is_regular = FALSE;
664 src->event_posted = FALSE;
665 src->is_playready = FALSE;
666 // PROFILE_SHOW_RESULT;
673 * @return GstURIType Returns GST_URI_SRC
676 static GstURIType gst_drm_src_uri_get_type (void)
682 * This function does the following:
683 * 1. Defines the list of protocols
687 * @return gchar ** Returns the protocol list
690 static gchar ** gst_drm_src_uri_get_protocols (void)
692 static gchar *protocols[] = { "file", NULL };
697 * @param handler [in] GstURIHandler structure
699 * @return gchar* Returns the uri
701 static const gchar * gst_drm_src_uri_get_uri (GstURIHandler *handler)
703 GstDrmSrc *src = GST_DRM_SRC (handler);
707 * This function does the following:
708 * 1. Checks the protocol
709 * 2. Checks the whether it is absolute or not
710 * 3 sets the location
712 * @param handler [in] GstURIHandler structure
713 * @param uri [in] uri string
715 * @return gboolean Returns TRUE on success and FALSE on Error
717 static gboolean gst_drm_src_uri_set_uri (GstURIHandler *handler, const gchar * uri)
719 gchar *protocol, *location;
721 GstDrmSrc *src = GST_DRM_SRC (handler);
722 // 1. Checks the protocol
723 protocol = gst_uri_get_protocol (uri);
724 if (strcmp (protocol, "file") != 0)
730 if (g_str_has_prefix (uri, "file://localhost/"))
733 tmp = g_strconcat ("file://", uri + 16, NULL);
734 location = gst_uri_get_location (tmp);
737 else if (strcmp (uri, "file://") == 0)
739 gst_drm_src_set_location (src, NULL);
744 location = gst_uri_get_location (uri);
748 // 2. Checks the whether it is absolute or not
749 if (!g_path_is_absolute (location))
754 // 3 sets the location
755 ret = gst_drm_src_set_location (src, location);
760 * This function does the following:
761 * 1. Assignes the function pointer for URI related stuff
763 * @param g_iface [in] an interface to URI handler
764 * @param iface_data [in] a gpointer
768 static void gst_drm_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
770 GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
771 // 1. Assigning the function pointer for URI related stuff
772 iface->get_type = gst_drm_src_uri_get_type;
773 iface->get_protocols = gst_drm_src_uri_get_protocols;
774 iface->get_uri = gst_drm_src_uri_get_uri;
775 iface->set_uri = gst_drm_src_uri_set_uri;
778 * This function does the following:
779 * 1. Registers an element as drmsrc
781 * @param i_pPlugin [in] a plug-in structure
783 * @return gboolean TRUE on SUCCESS and FALSE on Error
785 static gboolean plugin_init(GstPlugin* i_pPlugin)
787 return gst_element_register(i_pPlugin, "drmsrc", GST_RANK_NONE, GST_TYPE_DRM_SRC);;
790 * This function does the following:
791 * 1. plugin defination
794 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
797 "Plugin to read data from standad/DRM File",
801 "Samsung Electronics Co",
802 "http://www.samsung.com/")