/*
 * Copyright (c) 2008-2011, Oracle and/or its affiliates. All rights reserved.
 */


package javafx.scene.media;
import com.sun.javafx.beans.annotations.NoBuilder;
import com.sun.media.jfxmedia.track.VideoResolution;

/**
 * A {@link Track} that describes a video track. This will usually be the unique
 * visual track in an audiovisual media resource.
 *
 * @see Track
 * @see Media
 */
@NoBuilder
public final class VideoTrack extends Track {
    /**
     * The width in pixels of the video contained in this video track.
     */
    private int width;

    /**
     * Retrieves the width of the track.
     * @return the track width.
     */
    public final int getWidth() {
        return width;
    }

    /**
     * The height in pixels of the video contained in this video track.
     */
    private int height;

    /**
     * Retrieves the height of the track.
     * @return the track height.
     */
    public final int getHeight() {
        return height;
    }

    /**
     * Creates a new {@link VideoTrack} from a {@link com.sun.media.jfxmedia.track.VideoTrack}.
     *
     * @param nativeTrack the implementation layer track.
     * @throws NullPointerException if <code>nativeTrack</code> is <code>null</code>.
     */
    VideoTrack(com.sun.media.jfxmedia.track.VideoTrack nativeTrack) {
        super(nativeTrack);
        VideoResolution frameSize = ((com.sun.media.jfxmedia.track.VideoTrack) nativeTrack).getFrameSize();
        width = frameSize.width;
        height = frameSize.height;
    }

    /**
     * Returns a string representation of this <code>VideoTrack</code> object.
     * @return a string representation of this <code>VideoTrack</code> object.
     */ 
    @Override
    public String toString() {
        return "Video Track: name="+super.getName()+", resolution=("+width+","+height+")";
    }
}
