Java Code Examples for io.vov.vitamio.utils.Log#e()
The following examples show how to use
io.vov.vitamio.utils.Log#e() .
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: MediaPlayer.java From video-player with MIT License | 6 votes |
@SuppressLint("NewApi") private int audioTrackInit(int sampleRateInHz, int channels) { // this.sampleRateInHz=sampleRateInHz; // this.channels=channels; // return 0; audioTrackRelease(); int channelConfig = channels >= 2 ? AudioFormat.CHANNEL_OUT_STEREO : AudioFormat.CHANNEL_OUT_MONO; try { mAudioTrackBufferSize = AudioTrack.getMinBufferSize(sampleRateInHz, channelConfig, AudioFormat.ENCODING_PCM_16BIT); mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRateInHz, channelConfig, AudioFormat.ENCODING_PCM_16BIT, mAudioTrackBufferSize, AudioTrack.MODE_STREAM); } catch (Exception e) { mAudioTrackBufferSize = 0; Log.e("audioTrackInit", e); } return mAudioTrackBufferSize; }
Example 2
Source File: MediaScanner.java From NetEasyNews with GNU General Public License v3.0 | 6 votes |
public Uri doScanFile(String path, long lastModified, long fileSize, boolean scanAlways) { Uri result = null; try { FileCacheEntry entry = beginFile(path, lastModified, fileSize); if (entry != null && (entry.mLastModifiedChanged || scanAlways)) { if (processFile(path, null)) { result = endFile(entry); } else { if (mCaseInsensitivePaths) mFileCache.remove(path.toLowerCase()); else mFileCache.remove(path); } } } catch (RemoteException e) { Log.e("RemoteException in MediaScanner.scanFile()", e); } return result; }
Example 3
Source File: MediaScanner.java From video-player with MIT License | 6 votes |
public Uri doScanFile(String path, long lastModified, long fileSize, boolean scanAlways) { Uri result = null; try { FileCacheEntry entry = beginFile(path, lastModified, fileSize); if (entry != null && (entry.mLastModifiedChanged || scanAlways)) { if (processFile(path, null)) { result = endFile(entry); } else { if (mCaseInsensitivePaths) mFileCache.remove(path.toLowerCase()); else mFileCache.remove(path); } } } catch (RemoteException e) { Log.e("RemoteException in MediaScanner.scanFile()", e); } return result; }
Example 4
Source File: MediaScanner.java From MyHearts with Apache License 2.0 | 6 votes |
public Uri doScanFile(String path, long lastModified, long fileSize, boolean scanAlways) { Uri result = null; try { FileCacheEntry entry = beginFile(path, lastModified, fileSize); if (entry != null && (entry.mLastModifiedChanged || scanAlways)) { if (processFile(path, null)) { result = endFile(entry); } else { if (mCaseInsensitivePaths) mFileCache.remove(path.toLowerCase()); else mFileCache.remove(path); } } } catch (RemoteException e) { Log.e("RemoteException in MediaScanner.scanFile()", e); } return result; }
Example 5
Source File: VideoView.java From MyHearts with Apache License 2.0 | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { Log.d("onInfo: (%d, %d)", what, extra); if(MediaPlayer.MEDIA_INFO_UNKNOW_TYPE == what){ Log.e(" VITAMIO--TYPE_CHECK stype not include onInfo mediaplayer unknow type "); } if(MediaPlayer.MEDIA_INFO_FILE_OPEN_OK == what){ long buffersize=mMediaPlayer.audioTrackInit(); mMediaPlayer.audioInitedOk(buffersize); } Log.d("onInfo: (%d, %d)", what, extra); if (mOnInfoListener != null) { mOnInfoListener.onInfo(mp, what, extra); } else if (mMediaPlayer != null) { if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) { mMediaPlayer.pause(); if (mMediaBufferingIndicator != null) mMediaBufferingIndicator.setVisibility(View.VISIBLE); } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) { mMediaPlayer.start(); if (mMediaBufferingIndicator != null) mMediaBufferingIndicator.setVisibility(View.GONE); } } return true; }
Example 6
Source File: MediaPlayer.java From video-player with MIT License | 5 votes |
private void surfaceRender() { synchronized (this) { if (mLocalSurface == null || !mLocalSurface.isValid() || mBitmap == null || mByteBuffer == null) return; try { Canvas c = mLocalSurface.lockCanvas(null); mBitmap.copyPixelsFromBuffer(mByteBuffer); c.drawBitmap(mBitmap, 0, 0, null); mLocalSurface.unlockCanvasAndPost(c); } catch (Exception e) { Log.e("surfaceRender", e); } } }
Example 7
Source File: MediaPlayer.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
private void closeFD() { if (mFD != null) { try { mFD.close(); } catch (IOException e) { Log.e("closeFD", e); } mFD = null; } }
Example 8
Source File: VideoView.java From video-player with MIT License | 5 votes |
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { Log.d("onInfo: (%d, %d)", what, extra); if(MediaPlayer.MEDIA_INFO_UNKNOW_TYPE == what){ Log.e(" VITAMIO--TYPE_CHECK stype not include onInfo mediaplayer unknow type "); } if(MediaPlayer.MEDIA_INFO_FILE_OPEN_OK == what){ long buffersize=mMediaPlayer.audioTrackInit(); mMediaPlayer.audioInitedOk(buffersize); } Log.d("onInfo: (%d, %d)", what, extra); if (mOnInfoListener != null) { mOnInfoListener.onInfo(mp, what, extra); } else if (mMediaPlayer != null) { if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) { mMediaPlayer.pause(); if (mMediaBufferingIndicator != null) mMediaBufferingIndicator.setVisibility(View.VISIBLE); } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) { mMediaPlayer.start(); if (mMediaBufferingIndicator != null) mMediaBufferingIndicator.setVisibility(View.GONE); } } return true; }
Example 9
Source File: MediaPlayer.java From HPlayer with Apache License 2.0 | 5 votes |
private void closeFD() { if (mFD != null) { try { mFD.close(); } catch (IOException e) { Log.e("closeFD", e); } mFD = null; } }
Example 10
Source File: MediaPlayer.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
private void surfaceRender() { synchronized (this) { if (mLocalSurface == null || !mLocalSurface.isValid() || mBitmap == null || mByteBuffer == null) return; try { Canvas c = mLocalSurface.lockCanvas(null); mBitmap.copyPixelsFromBuffer(mByteBuffer); c.drawBitmap(mBitmap, 0, 0, null); mLocalSurface.unlockCanvasAndPost(c); } catch (Exception e) { Log.e("surfaceRender", e); } } }
Example 11
Source File: MediaPlayer.java From HPlayer with Apache License 2.0 | 5 votes |
/** * Default constructor. The same as Android's MediaPlayer(). * <p> * When done with the MediaPlayer, you should call {@link #release()}, to free * the resources. If not released, too many MediaPlayer instances may result * in an exception. * </p> * * @param preferHWDecoder MediaPlayer will try to use hardware accelerated decoder if true */ public MediaPlayer(Context ctx, boolean preferHWDecoder) { mContext = ctx; String LIB_ROOT = Vitamio.getLibraryPath(); if (preferHWDecoder) { if (!NATIVE_OMX_LOADED.get()) { if (Build.VERSION.SDK_INT > 17) loadOMX_native( LIB_ROOT + "libOMX.18.so"); else if (Build.VERSION.SDK_INT > 13) loadOMX_native( LIB_ROOT + "libOMX.14.so"); else if (Build.VERSION.SDK_INT > 10) loadOMX_native( LIB_ROOT + "libOMX.11.so"); else loadOMX_native( LIB_ROOT + "libOMX.9.so"); NATIVE_OMX_LOADED.set(true); } } else { try { unloadOMX_native(); } catch (UnsatisfiedLinkError e) { Log.e("unloadOMX failed %s", e.toString()); } NATIVE_OMX_LOADED.set(false); } Looper looper; if ((looper = Looper.myLooper()) != null) mEventHandler = new EventHandler(this, looper); else if ((looper = Looper.getMainLooper()) != null) mEventHandler = new EventHandler(this, looper); else mEventHandler = null; native_init(); }
Example 12
Source File: MediaScanner.java From video-player with MIT License | 5 votes |
public void handleStringTag(String name, byte[] valueBytes, String valueEncoding) { String value; try { value = new String(valueBytes, valueEncoding); } catch (Exception e) { Log.e("handleStringTag", e); value = new String(valueBytes); } Log.i("%s : %s", name, value); if (name.equalsIgnoreCase("title")) { mTitle = value; } else if (name.equalsIgnoreCase("artist")) { mArtist = value.trim(); } else if (name.equalsIgnoreCase("albumartist")) { if (TextUtils.isEmpty(mArtist)) mArtist = value.trim(); } else if (name.equalsIgnoreCase("album")) { mAlbum = value.trim(); } else if (name.equalsIgnoreCase("language")) { mLanguage = value.trim(); } else if (name.equalsIgnoreCase("duration")) { mDuration = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("width")) { mWidth = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("height")) { mHeight = parseSubstring(value, 0, 0); } }
Example 13
Source File: MediaScanner.java From MyHearts with Apache License 2.0 | 5 votes |
public void handleStringTag(String name, byte[] valueBytes, String valueEncoding) { String value; try { value = new String(valueBytes, valueEncoding); } catch (Exception e) { Log.e("handleStringTag", e); value = new String(valueBytes); } Log.i("%s : %s", name, value); if (name.equalsIgnoreCase("title")) { mTitle = value; } else if (name.equalsIgnoreCase("artist")) { mArtist = value.trim(); } else if (name.equalsIgnoreCase("albumartist")) { if (TextUtils.isEmpty(mArtist)) mArtist = value.trim(); } else if (name.equalsIgnoreCase("album")) { mAlbum = value.trim(); } else if (name.equalsIgnoreCase("language")) { mLanguage = value.trim(); } else if (name.equalsIgnoreCase("duration")) { mDuration = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("width")) { mWidth = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("height")) { mHeight = parseSubstring(value, 0, 0); } }
Example 14
Source File: MediaPlayer.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
private static void postEventFromNative(Object mediaplayer_ref, int what, int arg1, int arg2, Object obj) { MediaPlayer mp = (MediaPlayer) (mediaplayer_ref); if (mp == null) return; try { //synchronized (mp.mEventHandler) { if (mp.mEventHandler != null) { Message m = mp.mEventHandler.obtainMessage(what, arg1, arg2, obj); mp.mEventHandler.sendMessage(m); } } catch (Exception e) { Log.e("exception: " + e); } }
Example 15
Source File: MediaScanner.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
public Uri scanSingleFile(String path, String mimeType) { try { prescan(path); File file = new File(path); long lastModifiedSeconds = file.lastModified() / 1000; return mClient.doScanFile(path, lastModifiedSeconds, file.length(), true); } catch (RemoteException e) { Log.e("RemoteException in MediaScanner.scanFile()", e); return null; } }
Example 16
Source File: MediaScanner.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
public void handleStringTag(String name, byte[] valueBytes, String valueEncoding) { String value; try { value = new String(valueBytes, valueEncoding); } catch (Exception e) { Log.e("handleStringTag", e); value = new String(valueBytes); } Log.i("%s : %s", name, value); if (name.equalsIgnoreCase("title")) { mTitle = value; } else if (name.equalsIgnoreCase("artist")) { mArtist = value.trim(); } else if (name.equalsIgnoreCase("albumartist")) { if (TextUtils.isEmpty(mArtist)) mArtist = value.trim(); } else if (name.equalsIgnoreCase("album")) { mAlbum = value.trim(); } else if (name.equalsIgnoreCase("language")) { mLanguage = value.trim(); } else if (name.equalsIgnoreCase("duration")) { mDuration = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("width")) { mWidth = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("height")) { mHeight = parseSubstring(value, 0, 0); } }
Example 17
Source File: MediaPlayer.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
public int audioTrackInit() { // Log.e(" ffff mediaplayer audiotrackinit start . sampleRateInHz:=" + sampleRateInHz + " channels:=" + channels ); audioTrackRelease(); int channelConfig = channels >= 2 ? AudioFormat.CHANNEL_OUT_STEREO : AudioFormat.CHANNEL_OUT_MONO; try { mAudioTrackBufferSize = AudioTrack.getMinBufferSize(sampleRateInHz, channelConfig, AudioFormat.ENCODING_PCM_16BIT); mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRateInHz, channelConfig, AudioFormat.ENCODING_PCM_16BIT, mAudioTrackBufferSize, AudioTrack.MODE_STREAM); } catch (Exception e) { mAudioTrackBufferSize = 0; Log.e("audioTrackInit", e); } return mAudioTrackBufferSize; }
Example 18
Source File: MediaPlayer.java From MyHearts with Apache License 2.0 | 5 votes |
private static void postEventFromNative(Object mediaplayer_ref, int what, int arg1, int arg2, Object obj) { MediaPlayer mp = (MediaPlayer) (mediaplayer_ref); if (mp == null) return; try { //synchronized (mp.mEventHandler) { if (mp.mEventHandler != null) { Message m = mp.mEventHandler.obtainMessage(what, arg1, arg2, obj); mp.mEventHandler.sendMessage(m); } } catch (Exception e) { Log.e("exception: " + e); } }
Example 19
Source File: MediaPlayer.java From video-player with MIT License | 4 votes |
public MediaPlayer(Context ctx, boolean preferHWDecoder) { mContext = ctx; String LIB_ROOT; if(VERSION.SDK_INT > 23) { LIB_ROOT = Vitamio.getLibraryPath(); } else if(VERSION.SDK_INT > 20) { LIB_ROOT = ""; } else{ LIB_ROOT = Vitamio.getLibraryPath(); } if (preferHWDecoder) { if (!NATIVE_OMX_LOADED.get()) { if (Build.VERSION.SDK_INT > 17) load_omxnative_lib( LIB_ROOT , "libOMX.18.so"); else if (Build.VERSION.SDK_INT > 13) load_omxnative_lib( LIB_ROOT , "libOMX.14.so"); else if (Build.VERSION.SDK_INT > 10) load_omxnative_lib( LIB_ROOT , "libOMX.11.so"); else load_omxnative_lib( LIB_ROOT , "libOMX.9.so"); NATIVE_OMX_LOADED.set(true); } } else { try { unloadOMX_native(); } catch (UnsatisfiedLinkError e) { Log.e("unloadOMX failed %s", e.toString()); } NATIVE_OMX_LOADED.set(false); } Looper looper; if ((looper = Looper.myLooper()) != null) mEventHandler = new EventHandler(this, looper); else if ((looper = Looper.getMainLooper()) != null) mEventHandler = new EventHandler(this, looper); else mEventHandler = null; native_init(); }
Example 20
Source File: MediaPlayer.java From NetEasyNews with GNU General Public License v3.0 | 4 votes |
public MediaPlayer(Context ctx, boolean preferHWDecoder) { mContext = ctx; String LIB_ROOT; if(VERSION.SDK_INT > 23) { LIB_ROOT = Vitamio.getLibraryPath(); } else if(VERSION.SDK_INT > 20) { LIB_ROOT = ""; } else{ LIB_ROOT = Vitamio.getLibraryPath(); } if (preferHWDecoder) { if (!NATIVE_OMX_LOADED.get()) { if (Build.VERSION.SDK_INT > 17) load_omxnative_lib( LIB_ROOT , "libOMX.18.so"); else if (Build.VERSION.SDK_INT > 13) load_omxnative_lib( LIB_ROOT , "libOMX.14.so"); else if (Build.VERSION.SDK_INT > 10) load_omxnative_lib( LIB_ROOT , "libOMX.11.so"); else load_omxnative_lib( LIB_ROOT , "libOMX.9.so"); NATIVE_OMX_LOADED.set(true); } } else { try { unloadOMX_native(); } catch (UnsatisfiedLinkError e) { Log.e("unloadOMX failed %s", e.toString()); } NATIVE_OMX_LOADED.set(false); } Looper looper; if ((looper = Looper.myLooper()) != null) mEventHandler = new EventHandler(this, looper); else if ((looper = Looper.getMainLooper()) != null) mEventHandler = new EventHandler(this, looper); else mEventHandler = null; native_init(); }