1 /* GStreamer
2  * Copyright (C) 2013 Fluendo S.L. <support@fluendo.com>
3  *   Authors:    2013 Andoni Morales Alastruey <amorales@fluendo.com>
4  * Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
5  *
6  * gstios_assetsrc.h:
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
24 #ifndef __GST_IOS_ASSET_SRC_H__
25 #define __GST_IOS_ASSET_SRC_H__
26 
27 #include <sys/types.h>
28 
29 #include <gst/gst.h>
30 #include <gst/base/base.h>
31 #include <AssetsLibrary/ALAssetsLibrary.h>
32 #include <AssetsLibrary/ALAssetRepresentation.h>
33 
34 G_BEGIN_DECLS
35 
36 #define GST_TYPE_IOS_ASSET_SRC \
37   (gst_ios_asset_src_get_type())
38 #define GST_IOS_ASSET_SRC(obj) \
39   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IOS_ASSET_SRC,GstIOSAssetSrc))
40 #define GST_IOS_ASSET_SRC_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IOS_ASSET_SRC,GstIOSAssetSrcClass))
42 #define GST_IS_IOS_ASSET_SRC(obj) \
43   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IOS_ASSET_SRC))
44 #define GST_IS_IOS_ASSET_SRC_CLASS(klass) \
45   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IOS_ASSET_SRC))
46 #define GST_IOS_ASSET_SRC_CAST(obj) ((GstIOSAssetSrc*) obj)
47 #define GST_IOS_ASSET_SRC_ASSET(obj) \
48   (__bridge ALAssetRepresentation *)(obj->asset)
49 #define GST_IOS_ASSET_SRC_LIBRARY(obj) \
50   (__bridge GstAssetsLibrary *)(obj->library)
51 #define GST_IOS_ASSET_SRC_URL(obj) \
52   (__bridge NSURL *)(obj->url)
53 
54 typedef struct _GstIOSAssetSrc GstIOSAssetSrc;
55 typedef struct _GstIOSAssetSrcClass GstIOSAssetSrcClass;
56 
57 @interface GstAssetsLibrary : ALAssetsLibrary
58 {
59 }
60 
61 @property (retain) ALAsset *asset;
62 @property (retain) ALAssetRepresentation *result;
63 
64 - (ALAssetRepresentation *) assetForURLSync:(NSURL*) uri;
65 @end
66 
67 /**
68  * GstIOSAssetSrc:
69  *
70  * Opaque #GstIOSAssetSrc structure.
71  */
72 struct _GstIOSAssetSrc {
73   GstBaseSrc element;
74 
75   /*< private >*/
76   gchar * uri;                    /* asset uri */
77 
78   /* NOTE: ARC no longer allows Objective-C pointers in structs. */
79   /* Instead, use gpointer with explicit __bridge_* calls */
80   gpointer url;                    /* asset url */
81   gpointer asset;  /* asset representation */
82   gpointer library;     /* assets library */
83 };
84 
85 struct _GstIOSAssetSrcClass {
86   GstBaseSrcClass parent_class;
87 };
88 
89 GType gst_ios_asset_src_get_type (void);
90 
91 G_END_DECLS
92 
93 #endif /* __GST_IOS_ASSET_SRC_H__ */
94