org.seamless.util.MimeType Java Examples
The following examples show how to use
org.seamless.util.MimeType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomContentDirectory.java From airsonic-advanced with GNU General Public License v3.0 | 6 votes |
protected Res createResourceForSong(MediaFile song) { Player player = playerService.getGuestPlayer(null); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(getBaseUrl() + "/ext/stream") .queryParam("id", song.getId()) .queryParam("player", player.getId()); if (song.isVideo()) { builder.queryParam("format", TranscodingService.FORMAT_RAW); } jwtSecurityService.addJWTToken(User.USERNAME_ANONYMOUS, builder); String url = builder.toUriString(); String suffix = song.isVideo() ? FilenameUtils.getExtension(song.getPath()) : transcodingService.getSuffix(player, song, null); String mimeTypeString = StringUtil.getMimeType(suffix); MimeType mimeType = mimeTypeString == null ? null : MimeType.valueOf(mimeTypeString); Res res = new Res(mimeType, null, url); res.setDuration(formatDuration(song.getDuration())); return res; }
Example #2
Source File: CustomContentDirectory.java From airsonic with GNU General Public License v3.0 | 6 votes |
protected Res createResourceForSong(MediaFile song) { Player player = playerService.getGuestPlayer(null); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(getBaseUrl() + "/ext/stream") .queryParam("id", song.getId()) .queryParam("player", player.getId()); if (song.isVideo()) { builder.queryParam("format", TranscodingService.FORMAT_RAW); } jwtSecurityService.addJWTToken(builder); String url = builder.toUriString(); String suffix = song.isVideo() ? FilenameUtils.getExtension(song.getPath()) : transcodingService.getSuffix(player, song, null); String mimeTypeString = StringUtil.getMimeType(suffix); MimeType mimeType = mimeTypeString == null ? null : MimeType.valueOf(mimeTypeString); Res res = new Res(mimeType, null, url); res.setDuration(formatDuration(song.getDurationSeconds())); return res; }
Example #3
Source File: ZxtConnectionManagerService.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public ZxtConnectionManagerService() { sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/jpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/png"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/gif"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/bmp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/pjpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/tiff"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/x-ms-bmp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/3gpp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/mp4"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/3gp2"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/avi"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/flv"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/mpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-mkv"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-matroska"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/msvideo"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/quicktime"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-msvideo"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-ms-wmv"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/aac"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/3gpp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/amr"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/ogg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/mpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/midi"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-midi"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-mid"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-wav"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-ms-wma"))); log.info("Supported MIME types: " + sinkProtocolInfo.size()); }
Example #4
Source File: SubsonicContentDirectory.java From subsonic with GNU General Public License v3.0 | 5 votes |
protected Res createResourceForSong(MediaFile song) { Player player = playerService.getGuestPlayer(null); String url = getBaseUrl() + "stream?id=" + song.getId() + "&player=" + player.getId(); if (song.isVideo()) { url += "&format=" + TranscodingService.FORMAT_RAW; } String suffix = song.isVideo() ? FilenameUtils.getExtension(song.getPath()) : transcodingService.getSuffix(player, song, null); String mimeTypeString = StringUtil.getMimeType(suffix); MimeType mimeType = mimeTypeString == null ? null : MimeType.valueOf(mimeTypeString); Res res = new Res(mimeType, null, url); res.setDuration(formatDuration(song.getDurationSeconds())); return res; }
Example #5
Source File: Icon.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
protected Icon(MimeType mimeType, int width, int height, int depth, URI uri, byte[] data) { this.mimeType = mimeType; this.width = width; this.height = height; this.depth = depth; this.uri = uri; this.data = data; }
Example #6
Source File: ZxtConnectionManagerService.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public ZxtConnectionManagerService() { sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/jpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/png"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/gif"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/bmp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/pjpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/tiff"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("image/x-ms-bmp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/3gpp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/mp4"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/3gp2"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/avi"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/flv"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/mpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-mkv"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-matroska"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/msvideo"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/quicktime"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-msvideo"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("video/x-ms-wmv"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/aac"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/3gpp"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/amr"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/ogg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/mpeg"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/midi"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-midi"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-mid"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-wav"))); sinkProtocolInfo.add(new ProtocolInfo(MimeType.valueOf("audio/x-ms-wma"))); log.info("Supported MIME types: " + sinkProtocolInfo.size()); }
Example #7
Source File: Icon.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
protected Icon(MimeType mimeType, int width, int height, int depth, URI uri, byte[] data) { this.mimeType = mimeType; this.width = width; this.height = height; this.depth = depth; this.uri = uri; this.data = data; }
Example #8
Source File: ContentActivity.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
@Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { // TODO Auto-generated method stub ContentItem content = mContentList.get(position); if (content.isContainer()) { mProgressBarPreparing.setVisibility(View.VISIBLE); upnpService.getControlPoint() .execute( new ContentBrowseActionCallback( ContentActivity.this, content .getService(), content .getContainer(), mContentList, mHandler)); } else { MimeType localMimeType = content.getItem().getResources() .get(0).getProtocolInfo().getContentFormatMimeType(); if (null == localMimeType) { return; } String type = localMimeType.getType(); if (null == type) { return; } currentContentFormatMimeType = localMimeType.toString(); Intent intent = new Intent(); if (type.equals("image")) { ConfigData.photoPosition = position; jumpToImage(content); } else { jumpToControl(content); } } }
Example #9
Source File: DLNAProtocolInfo.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public DLNAProtocolInfo(DLNAProfiles profile, EnumMap<DLNAAttribute.Type, DLNAAttribute> attributes) { super(MimeType.valueOf(profile.getContentFormat())); this.attributes.putAll(attributes); this.attributes.put(DLNAAttribute.Type.DLNA_ORG_PN, new DLNAProfileAttribute(profile)); this.additionalInfo = this.getAttributesString(); }
Example #10
Source File: DLNAProtocolInfo.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public DLNAProtocolInfo(DLNAProfiles profile) { super(MimeType.valueOf(profile.getContentFormat())); this.attributes.put(DLNAAttribute.Type.DLNA_ORG_PN, new DLNAProfileAttribute(profile)); this.additionalInfo = this.getAttributesString(); }
Example #11
Source File: DLNAProtocolInfo.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public DLNAProtocolInfo(MimeType contentFormatMimeType) { super(contentFormatMimeType); }
Example #12
Source File: Res.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public Res(MimeType httpGetMimeType, Long size, String value) { this(new ProtocolInfo(httpGetMimeType), size, value); }
Example #13
Source File: Res.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public Res(MimeType httpGetMimeType, Long size, String duration, Long bitrate, String value) { this(new ProtocolInfo(httpGetMimeType), size, duration, bitrate, value); }
Example #14
Source File: StreamResponseMessage.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public StreamResponseMessage(byte[] body, MimeType mimeType) { this(body, new ContentTypeHeader(mimeType)); }
Example #15
Source File: StreamResponseMessage.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public StreamResponseMessage(String body, MimeType mimeType) { this(body, new ContentTypeHeader(mimeType)); }
Example #16
Source File: ContentTypeHeader.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public void setString(String s) throws InvalidHeaderException { setValue(MimeType.valueOf(s)); }
Example #17
Source File: ContentTypeHeader.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public ContentTypeHeader(MimeType contentType) { setValue(contentType); }
Example #18
Source File: Icon.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public MimeType getMimeType() { return mimeType; }
Example #19
Source File: ProtocolInfo.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public ProtocolInfo(MimeType contentFormatMimeType) { this.protocol = Protocol.HTTP_GET; this.contentFormat = contentFormatMimeType.toString(); }
Example #20
Source File: ProtocolInfo.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public MimeType getContentFormatMimeType() throws IllegalArgumentException { return MimeType.valueOf(contentFormat); }
Example #21
Source File: Icon.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
/** * Used internally by Cling when {@link RemoteDevice} is discovered, you shouldn't have to call this. */ public Icon(String mimeType, int width, int height, int depth, URI uri) { this(mimeType != null && mimeType.length() > 0 ? MimeType.valueOf(mimeType) : null, width, height, depth, uri, null); }
Example #22
Source File: GenerateContentTask.java From HPlayer with Apache License 2.0 | 4 votes |
/** * 添加音频 */ private void addAudioContent(Context context, ContentNode rootNode) { Container audioContainer = new Container(ContentTree.AUDIO_ID, ContentTree.ROOT_ID, "Audios", "HPlayer MediaServer", new DIDLObject.Class("object.container"), 0); audioContainer.setRestricted(true); audioContainer.setWriteStatus(WriteStatus.NOT_WRITABLE); rootNode.getContainer().addContainer(audioContainer); rootNode.getContainer().setChildCount( rootNode.getContainer().getChildCount() + 1); ContentTree.addNode(ContentTree.AUDIO_ID, new ContentNode( ContentTree.AUDIO_ID, audioContainer)); Cursor cursor = context.getContentResolver() .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, null); if (cursor == null) { return; } while (cursor.moveToNext()) { String id = ContentTree.AUDIO_PREFIX + cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media._ID)); String title = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE)); String creator = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST)); String filePath = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.DATA)); String mimeType = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.MIME_TYPE)); long size = cursor.getLong(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.SIZE)); long duration = cursor.getLong(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION)); String album = cursor.getString(cursor .getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM)); Res res = new Res(new MimeType(mimeType.substring(0, mimeType.indexOf('/')), mimeType.substring(mimeType.indexOf('/') + 1)), size, "http://" + address + "/" + id); res.setDuration(duration / (1000 * 60 * 60) + ":" + (duration % (1000 * 60 * 60)) / (1000 * 60) + ":" + (duration % (1000 * 60)) / 1000); // Music Track must have `artist' with role field, or // DIDLParser().generate(didl) will throw nullpointException MusicTrack musicTrack = new MusicTrack(id, ContentTree.AUDIO_ID, title, creator, album, new PersonWithRole(creator, "Performer"), res); audioContainer.addItem(musicTrack); audioContainer.setChildCount(audioContainer.getChildCount() + 1); ContentTree.addNode(id, new ContentNode(id, musicTrack, filePath)); // Log.d(TAG, "added audio item " + title + "from " + filePath); } cursor.close(); }
Example #23
Source File: Res.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public Res(MimeType httpGetMimeType, Long size, String value) { this(new ProtocolInfo(httpGetMimeType), size, value); }
Example #24
Source File: Icon.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
/** * Used internally by Cling when {@link RemoteDevice} is discovered, you shouldn't have to call this. */ public Icon(String mimeType, int width, int height, int depth, URI uri) { this(mimeType != null && mimeType.length() > 0 ? MimeType.valueOf(mimeType) : null, width, height, depth, uri, null); }
Example #25
Source File: Icon.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public MimeType getMimeType() { return mimeType; }
Example #26
Source File: ContentTypeHeader.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public ContentTypeHeader(MimeType contentType) { setValue(contentType); }
Example #27
Source File: ContentTypeHeader.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public void setString(String s) throws InvalidHeaderException { setValue(MimeType.valueOf(s)); }
Example #28
Source File: StreamResponseMessage.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public StreamResponseMessage(String body, MimeType mimeType) { this(body, new ContentTypeHeader(mimeType)); }
Example #29
Source File: StreamResponseMessage.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public StreamResponseMessage(byte[] body, MimeType mimeType) { this(body, new ContentTypeHeader(mimeType)); }
Example #30
Source File: Res.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public Res(MimeType httpGetMimeType, Long size, String duration, Long bitrate, String value) { this(new ProtocolInfo(httpGetMimeType), size, duration, bitrate, value); }