yashketkar/video-player

View on GitHub

Showing 144 of 144 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

  private static  boolean loadFFmpeg_native_lib(String path, String name){
      boolean load=false;
      File file=new File(Vitamio.getBrowserLibraryPath() + "/"+ name );    
      if(file.exists())    
      {   
Severity: Major
Found in vitamio/src/io/vov/vitamio/MediaPlayer.java and 3 other locations - About 1 hr to fix
vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 215..232
vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 233..249
vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 251..266

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

  private static  boolean load_omxnative_lib(String path, String name){
      boolean load=false;
      
      File file=new File(Vitamio.getBrowserLibraryPath() + "/" +  name );    
      if(file.exists())    
Severity: Major
Found in vitamio/src/io/vov/vitamio/MediaPlayer.java and 3 other locations - About 1 hr to fix
vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 233..249
vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 251..266
vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 268..283

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method beginFile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public FileCacheEntry beginFile(String path, long lastModified, long fileSize) {
      int lastSlash = path.lastIndexOf('/');
      if (lastSlash >= 0 && lastSlash + 2 < path.length()) {
        if (path.regionMatches(lastSlash + 1, "._", 0, 2))
          return null;
Severity: Minor
Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 1 hr to fix

    Method loadFragment has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void loadFragment(int fragmentID) {
            if(MainActivity.permissionsSnackbar != null){
                MainActivity.permissionsSnackbar.dismiss();
            }
            Fragment fragment = null;
    Severity: Minor
    Found in app/src/main/java/com/yashketkar/ykplayer/MainActivity.java - About 1 hr to fix

      Method openVideo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private void openVideo() {
      //    if (mUri == null || mSurfaceHolder == null || !Vitamio.isInitialized(mContext))
      //      return;
          if (mUri == null || mSurfaceHolder == null )
          return;
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/widget/VideoView.java - About 1 hr to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          @SuppressLint("NewApi")
          
        private int audioTrackInit(int sampleRateInHz, int channels) {
         //  this.sampleRateInHz=sampleRateInHz;
         //  this.channels=channels;
        Severity: Major
        Found in vitamio/src/io/vov/vitamio/MediaPlayer.java and 1 other location - About 1 hr to fix
        vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 1368..1380

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 101.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          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 {
        Severity: Major
        Found in vitamio/src/io/vov/vitamio/MediaPlayer.java and 1 other location - About 1 hr to fix
        vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 1350..1367

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 101.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method onCreateView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                     Bundle savedInstanceState) {
                // Inflate the layout for this fragment
                View InputFragmentView = inflater.inflate(R.layout.fragment_zbigz, container, false);
        Severity: Minor
        Found in app/src/main/java/com/yashketkar/ykplayer/ZbigzFragment.java - About 1 hr to fix

          Method endFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private Uri endFile(FileCacheEntry entry) throws RemoteException {
                Uri tableUri;
                boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0;
                if (isVideo) {
                  tableUri = Video.Media.CONTENT_URI;
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 1 hr to fix

            Method dispatchKeyEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              @Override
              public boolean dispatchKeyEvent(KeyEvent event) {
                int keyCode = event.getKeyCode();
                if (event.getRepeatCount() == 0 && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
                  doPauseResume();
            Severity: Minor
            Found in vitamio/src/io/vov/vitamio/widget/MediaController.java - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method updateSub has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              private void updateSub(int subType, byte[] bytes, String encoding, int width, int height) {
                if (mEventHandler != null) {
                  Message m = mEventHandler.obtainMessage(MEDIA_TIMED_TEXT, width, height);
                  Bundle b = m.getData();
                  if (subType == SUBTITLE_TEXT) {
            Severity: Minor
            Found in vitamio/src/io/vov/vitamio/MediaPlayer.java - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method onCreate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
            
                    hideUI();
            Severity: Minor
            Found in app/src/main/java/com/yashketkar/ykplayer/VideoPlayerActivity.java - About 1 hr to fix

              Method handleStringTag has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void handleStringTag(String name, byte[] valueBytes, String valueEncoding) {
                    String value;
                    try {
                      value = new String(valueBytes, valueEncoding);
                    } catch (Exception e) {
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method onRequestPermissionsResult has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  public void onRequestPermissionsResult(int requestCode,
                                                         String permissions[], int[] grantResults) {
                      switch (requestCode) {
                          case MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE: {
              Severity: Minor
              Found in app/src/main/java/com/yashketkar/ykplayer/MainActivity.java - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method saveMiniThumbToFile has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                protected synchronized void saveMiniThumbToFile(byte[] data, long id, long magic) throws IOException {
                  RandomAccessFile r = miniThumbDataFile();
                  if (r == null)
                    return;
              
              
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.java - About 1 hr to fix

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    public static String fixLastSlash(String str) {
                        String res = str == null ? "/" : str.trim() + "/";
                        if (res.length() > 2 && res.charAt(res.length() - 2) == '/')
                            res = res.substring(0, res.length() - 1);
                        return res;
                Severity: Major
                Found in vitamio/src/io/vov/vitamio/utils/ContextUtils.java and 1 other location - About 1 hr to fix
                vitamio/src/io/vov/vitamio/utils/StringUtils.java on lines 42..47

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 80.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    public static String fixLastSlash(String str) {
                        String res = str == null ? "/" : str.trim() + "/";
                        if (res.length() > 2 && res.charAt(res.length() - 2) == '/')
                            res = res.substring(0, res.length() - 1);
                        return res;
                Severity: Major
                Found in vitamio/src/io/vov/vitamio/utils/StringUtils.java and 1 other location - About 1 hr to fix
                vitamio/src/io/vov/vitamio/utils/ContextUtils.java on lines 40..45

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 80.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method getMiniThumbFromFile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected synchronized byte[] getMiniThumbFromFile(long id, byte[] data) {
                    RandomAccessFile r = miniThumbDataFile();
                    if (r == null)
                      return null;
                
                
                Severity: Minor
                Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.java - About 1 hr to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                            synchronized (sThumbBufLock) {
                              if (sThumbBuf == null)
                                sThumbBuf = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
                              if (thumbFile.getMiniThumbFromFile(origId, sThumbBuf) != null) {
                                bitmap = BitmapFactory.decodeByteArray(sThumbBuf, 0, sThumbBuf.length);
                  Severity: Major
                  Found in vitamio/src/io/vov/vitamio/provider/MediaStore.java and 1 other location - About 1 hr to fix
                  vitamio/src/io/vov/vitamio/provider/MediaStore.java on lines 256..264

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 78.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                            synchronized (sThumbBufLock) {
                              if (sThumbBuf == null)
                                sThumbBuf = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
                              if (thumbFile.getMiniThumbFromFile(origId, sThumbBuf) != null) {
                                bitmap = BitmapFactory.decodeByteArray(sThumbBuf, 0, sThumbBuf.length);
                  Severity: Major
                  Found in vitamio/src/io/vov/vitamio/provider/MediaStore.java and 1 other location - About 1 hr to fix
                  vitamio/src/io/vov/vitamio/provider/MediaStore.java on lines 291..299

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 78.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language