| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| VideoStreamChunk |
|
| 1.2222222222222223;1.222 |
| 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 java.math.BigInteger; | |
| 22 | ||
| 23 | import org.jaudiotagger.audio.asf.util.Utils; | |
| 24 | ||
| 25 | /** | |
| 26 | * @author Christian Laireiter | |
| 27 | */ | |
| 28 | public class VideoStreamChunk extends StreamChunk | |
| 29 | { | |
| 30 | ||
| 31 | /** | |
| 32 | * Stores the codecs id. Normally the Four-CC (4-Bytes). | |
| 33 | */ | |
| 34 | private byte[] codecId; | |
| 35 | ||
| 36 | /** | |
| 37 | * Thies field stores the height of the video stream. | |
| 38 | */ | |
| 39 | private long pictureHeight; | |
| 40 | ||
| 41 | /** | |
| 42 | * This field stores the width of the video stream. | |
| 43 | */ | |
| 44 | private long pictureWidth; | |
| 45 | ||
| 46 | /** | |
| 47 | * Creates an instance. | |
| 48 | * | |
| 49 | * @param chunkLen Length of the entire chunk (including guid and size) | |
| 50 | */ | |
| 51 | public VideoStreamChunk(BigInteger chunkLen) | |
| 52 | { | |
| 53 | 0 | super(GUID.GUID_VIDEOSTREAM, chunkLen); |
| 54 | 0 | } |
| 55 | ||
| 56 | /** | |
| 57 | * @return Returns the codecId. | |
| 58 | */ | |
| 59 | public byte[] getCodecId() | |
| 60 | { | |
| 61 | 0 | return this.codecId; |
| 62 | } | |
| 63 | ||
| 64 | /** | |
| 65 | * Returns the {@link #getCodecId()}, as a String, where each byte has been | |
| 66 | * converted to a <code>char</code>. | |
| 67 | * | |
| 68 | * @return Codec Id as String. | |
| 69 | */ | |
| 70 | public String getCodecIdAsString() | |
| 71 | { | |
| 72 | 0 | if (getCodecId() != null) |
| 73 | { | |
| 74 | 0 | return new String(getCodecId()); |
| 75 | } | |
| 76 | 0 | return "Unknown"; |
| 77 | } | |
| 78 | ||
| 79 | /** | |
| 80 | * @return Returns the pictureHeight. | |
| 81 | */ | |
| 82 | public long getPictureHeight() | |
| 83 | { | |
| 84 | 0 | return pictureHeight; |
| 85 | } | |
| 86 | ||
| 87 | /** | |
| 88 | * @return Returns the pictureWidth. | |
| 89 | */ | |
| 90 | public long getPictureWidth() | |
| 91 | { | |
| 92 | 0 | return pictureWidth; |
| 93 | } | |
| 94 | ||
| 95 | /** | |
| 96 | * (overridden) | |
| 97 | * | |
| 98 | * @see org.jaudiotagger.audio.asf.data.StreamChunk#prettyPrint(String) | |
| 99 | */ | |
| 100 | public String prettyPrint(final String prefix) | |
| 101 | { | |
| 102 | 0 | StringBuffer result = new StringBuffer(super.prettyPrint(prefix)); |
| 103 | 0 | result.insert(0, Utils.LINE_SEPARATOR + prefix + "|->VideoStream"); |
| 104 | 0 | result.append(prefix + "Video info:" + Utils.LINE_SEPARATOR); |
| 105 | 0 | result.append(prefix + " |->Width : " + getPictureWidth() |
| 106 | + Utils.LINE_SEPARATOR); | |
| 107 | 0 | result.append(prefix + " |->Heigth : " + getPictureHeight() |
| 108 | + Utils.LINE_SEPARATOR); | |
| 109 | 0 | result.append(prefix + " |->Codec : " + getCodecIdAsString() |
| 110 | + Utils.LINE_SEPARATOR); | |
| 111 | 0 | return result.toString(); |
| 112 | } | |
| 113 | ||
| 114 | /** | |
| 115 | * @param codecIdentifier The codecId to set. | |
| 116 | */ | |
| 117 | public void setCodecId(byte[] codecIdentifier) | |
| 118 | { | |
| 119 | 0 | this.codecId = codecIdentifier; |
| 120 | 0 | } |
| 121 | ||
| 122 | /** | |
| 123 | * @param picHeight | |
| 124 | */ | |
| 125 | public void setPictureHeight(long picHeight) | |
| 126 | { | |
| 127 | 0 | this.pictureHeight = picHeight; |
| 128 | 0 | } |
| 129 | ||
| 130 | /** | |
| 131 | * @param picWidth | |
| 132 | */ | |
| 133 | public void setPictureWidth(long picWidth) | |
| 134 | { | |
| 135 | 0 | this.pictureWidth = picWidth; |
| 136 | 0 | } |
| 137 | } |