Coverage Report - org.jaudiotagger.audio.asf.data.VideoStreamChunk
 
Classes in this File Line Coverage Branch Coverage Complexity
VideoStreamChunk
13%
3/23
0%
0/2
1.111
 
 1  
 /*
 2  
  * Entagged Audio Tag library
 3  
  * Copyright (c) 2004-2005 Christian Laireiter <liree@web.de>
 4  
  * 
 5  
  * This library is free software; you can redistribute it and/or
 6  
  * modify it under the terms of the GNU Lesser General Public
 7  
  * License as published by the Free Software Foundation; either
 8  
  * version 2.1 of the License, or (at your option) any later version.
 9  
  *  
 10  
  * This library is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  
  * Lesser General Public License for more details.
 14  
  * 
 15  
  * You should have received a copy of the GNU Lesser General Public
 16  
  * License along with this library; if not, write to the Free Software
 17  
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 18  
  */
 19  
 package org.jaudiotagger.audio.asf.data;
 20  
 
 21  
 import org.jaudiotagger.audio.asf.util.Utils;
 22  
 
 23  
 import java.math.BigInteger;
 24  
 
 25  
 /**
 26  
  * @author Christian Laireiter
 27  
  */
 28  
 public class VideoStreamChunk extends StreamChunk {
 29  
 
 30  
     /**
 31  
      * Stores the codecs id. Normally the Four-CC (4-Bytes).
 32  
      */
 33  4
     private byte[] codecId = new byte[0];
 34  
 
 35  
     /**
 36  
      * This field stores the height of the video stream.
 37  
      */
 38  
     private long pictureHeight;
 39  
 
 40  
     /**
 41  
      * This field stores the width of the video stream.
 42  
      */
 43  
     private long pictureWidth;
 44  
 
 45  
     /**
 46  
      * Creates an instance.
 47  
      * 
 48  
      * @param chunkLen
 49  
      *            Length of the entire chunk (including guid and size)
 50  
      */
 51  
     public VideoStreamChunk(final BigInteger chunkLen) {
 52  4
         super(GUID.GUID_VIDEOSTREAM, chunkLen);
 53  4
     }
 54  
 
 55  
     /**
 56  
      * @return Returns the codecId.
 57  
      */
 58  
     public byte[] getCodecId() {
 59  0
         return this.codecId.clone();
 60  
     }
 61  
 
 62  
     /**
 63  
      * Returns the {@link #getCodecId()}, as a String, where each byte has been
 64  
      * converted to a <code>char</code>.
 65  
      * 
 66  
      * @return Codec Id as String.
 67  
      */
 68  
     public String getCodecIdAsString() {
 69  
         String result;
 70  0
         if (this.codecId == null) {
 71  0
             result = "Unknown"; 
 72  
         } else {
 73  0
             result = new String(getCodecId());
 74  
         }
 75  0
         return result;
 76  
     }
 77  
 
 78  
     /**
 79  
      * @return Returns the pictureHeight.
 80  
      */
 81  
     public long getPictureHeight() {
 82  0
         return this.pictureHeight;
 83  
     }
 84  
 
 85  
     /**
 86  
      * @return Returns the pictureWidth.
 87  
      */
 88  
     public long getPictureWidth() {
 89  0
         return this.pictureWidth;
 90  
     }
 91  
 
 92  
     /**
 93  
      * (overridden)
 94  
      * 
 95  
      * @see org.jaudiotagger.audio.asf.data.StreamChunk#prettyPrint(String)
 96  
      */
 97  
     @Override
 98  
     public String prettyPrint(final String prefix) {
 99  0
         final StringBuilder result = new StringBuilder(super.prettyPrint(prefix));
 100  0
         result.insert(0, Utils.LINE_SEPARATOR + prefix + "|->VideoStream");
 101  0
         result.append(prefix).append("Video info:")
 102  
                 .append(Utils.LINE_SEPARATOR);
 103  0
         result.append(prefix).append("      |->Width  : ").append(
 104  
                 getPictureWidth()).append(Utils.LINE_SEPARATOR);
 105  0
         result.append(prefix).append("      |->Heigth : ").append(
 106  
                 getPictureHeight()).append(Utils.LINE_SEPARATOR);
 107  0
         result.append(prefix).append("      |->Codec  : ").append(
 108  
                 getCodecIdAsString()).append(Utils.LINE_SEPARATOR);
 109  0
         return result.toString();
 110  
     }
 111  
 
 112  
     /**
 113  
      * @param codecIdentifier
 114  
      *            The codecId to set.
 115  
      */
 116  
     public void setCodecId(final byte[] codecIdentifier) {
 117  0
         this.codecId = codecIdentifier.clone();
 118  0
     }
 119  
 
 120  
     /**
 121  
      * @param picHeight
 122  
      */
 123  
     public void setPictureHeight(final long picHeight) {
 124  0
         this.pictureHeight = picHeight;
 125  0
     }
 126  
 
 127  
     /**
 128  
      * @param picWidth
 129  
      */
 130  
     public void setPictureWidth(final long picWidth) {
 131  0
         this.pictureWidth = picWidth;
 132  0
     }
 133  
 }