Name: csapi-media-content
Summary: Tizen Media Content API for C#
-Version: 1.0.12
+Version: 1.0.13
Release: 1
Group: Development/Libraries
License: Apache-2.0
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone");
- mediaContents.Add(new MediaInformation(newHandle));
+ MediaContentType type;
+ Interop.MediaInformation.GetMediaType(newHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
+
+ mediaContents.Add(new ImageInformation(imageInfo, newHandle));
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
+
+ mediaContents.Add(new AudioInformation(audioInfo, newHandle));
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
+
+ mediaContents.Add(new VideoInformation(videoInfo, newHandle));
+ }
+ else if (type == MediaContentType.Others)
+ {
+ mediaContents.Add(new MediaInformation(newHandle));
+ }
+
return true;
};
MediaContentValidator.ThrowIfError(
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.GetMediaFromDB(id, out mediaHandle), "Failed to get information");
- return new MediaInformation(mediaHandle);
+ MediaContentType type;
+ MediaInformation res;
+ Interop.MediaInformation.GetMediaType(mediaHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaHandle.DangerousGetHandle(), out imageInfo), "Failed to get image information");
+
+ res = new ImageInformation(imageInfo, mediaHandle);
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaHandle.DangerousGetHandle(), out audioInfo), "Failed to get audio information");
+
+ res = new AudioInformation(audioInfo, mediaHandle);
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaHandle.DangerousGetHandle(), out videoInfo), "Failed to get video information");
+
+ res = new VideoInformation(videoInfo, mediaHandle);
+ }
+ else
+ {
+ res = new MediaInformation(mediaHandle);
+ }
+
+ return res;
}
/// <summary>
{
MediaContentValidator.ThrowIfError(
Interop.ImageInformation.UpdateToDB(((ImageInformation)mediaInfo).ImageHandle), "Failed to update DB");
+
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
}
else if (type == typeof(AudioInformation))
{
MediaContentValidator.ThrowIfError(
Interop.AudioInformation.UpdateToDB(((AudioInformation)mediaInfo).AudioHandle), "Failed to update DB");
+
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
}
else if (type == typeof(VideoInformation))
{
MediaContentValidator.ThrowIfError(
Interop.VideoInformation.UpdateToDB(((VideoInformation)mediaInfo).VideoHandle), "Failed to update DB");
+
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
}
else if (type == typeof(MediaInformation))
{
MediaContentValidator.ThrowIfError(
- Interop.MediaInformation.UpdateToDB(((MediaInformation)mediaInfo).MediaHandle), "Failed to update DB");
+ Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB");
}
else
{
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.Insert(filePath, out mediaInformationHandle), "Failed to Insert MediaInformation to DB");
- return new MediaInformation(mediaInformationHandle);
+ MediaContentType type;
+ MediaInformation res;
+ Interop.MediaInformation.GetMediaType(mediaInformationHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaInformationHandle.DangerousGetHandle(), out imageInfo), "Failed to get image information");
+
+ res = new ImageInformation(imageInfo, mediaInformationHandle);
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaInformationHandle.DangerousGetHandle(), out audioInfo), "Failed to get audio information");
+
+ res = new AudioInformation(audioInfo, mediaInformationHandle);
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaInformationHandle.DangerousGetHandle(), out videoInfo), "Failed to get video information");
+
+ res = new VideoInformation(videoInfo, mediaInformationHandle);
+ }
+ else
+ {
+ res = new MediaInformation(mediaInformationHandle);
+ }
+
+ return res;
}
/// <summary>
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone MediaInformation instance");
- mediaContents.Add(new MediaInformation(newHandle));
+ MediaContentType type;
+ Interop.MediaInformation.GetMediaType(newHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
+
+ mediaContents.Add(new ImageInformation(imageInfo, newHandle));
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
+
+ mediaContents.Add(new AudioInformation(audioInfo, newHandle));
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
+
+ mediaContents.Add(new VideoInformation(videoInfo, newHandle));
+ }
+ else if (type == MediaContentType.Others)
+ {
+ mediaContents.Add(new MediaInformation(newHandle));
+ }
+
return true;
};
MediaContentValidator.ThrowIfError(
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone");
- mediaContents.Add(new MediaInformation(newHandle));
+ MediaContentType type;
+ Interop.MediaInformation.GetMediaType(newHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
+
+ mediaContents.Add(new ImageInformation(imageInfo, newHandle));
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
+
+ mediaContents.Add(new AudioInformation(audioInfo, newHandle));
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
+
+ mediaContents.Add(new VideoInformation(videoInfo, newHandle));
+ }
+ else if (type == MediaContentType.Others)
+ {
+ mediaContents.Add(new MediaInformation(newHandle));
+ }
+
return true;
};
MediaContentValidator.ThrowIfError(
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media");
- mediaContents.Add(new MediaInformation(newHandle));
+ MediaContentType type;
+ Interop.MediaInformation.GetMediaType(newHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
+
+ mediaContents.Add(new ImageInformation(imageInfo, newHandle));
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
+
+ mediaContents.Add(new AudioInformation(audioInfo, newHandle));
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
+
+ mediaContents.Add(new VideoInformation(videoInfo, newHandle));
+ }
+ else if (type == MediaContentType.Others)
+ {
+ mediaContents.Add(new MediaInformation(newHandle));
+ }
+
return true;
};
MediaContentValidator.ThrowIfError(
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media");
- mediaContents.Add(new MediaInformation(newHandle));
+ MediaContentType type;
+ Interop.MediaInformation.GetMediaType(newHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
+
+ mediaContents.Add(new ImageInformation(imageInfo, newHandle));
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
+
+ mediaContents.Add(new AudioInformation(audioInfo, newHandle));
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
+
+ mediaContents.Add(new VideoInformation(videoInfo, newHandle));
+ }
+ else if (type == MediaContentType.Others)
+ {
+ mediaContents.Add(new MediaInformation(newHandle));
+ }
+
return true;
};
MediaContentValidator.ThrowIfError(
MediaContentValidator.ThrowIfError(
Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media");
- mediaContents.Add(new MediaInformation(newHandle));
+ MediaContentType type;
+ Interop.MediaInformation.GetMediaType(newHandle, out type);
+ if (type == MediaContentType.Image)
+ {
+ Interop.ImageInformation.SafeImageInformationHandle imageInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information");
+
+ mediaContents.Add(new ImageInformation(imageInfo, newHandle));
+ }
+ else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound))
+ {
+ Interop.AudioInformation.SafeAudioInformationHandle audioInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information");
+
+ mediaContents.Add(new AudioInformation(audioInfo, newHandle));
+ }
+ else if (type == MediaContentType.Video)
+ {
+ Interop.VideoInformation.SafeVideoInformationHandle videoInfo;
+ MediaContentValidator.ThrowIfError(
+ Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information");
+
+ mediaContents.Add(new VideoInformation(videoInfo, newHandle));
+ }
+ else if (type == MediaContentType.Others)
+ {
+ mediaContents.Add(new MediaInformation(newHandle));
+ }
+
return true;
};