mediaframe.mpeg1
Class Element

java.lang.Object
  |
  +--mediaframe.mpeg1.Element

class Element
extends java.lang.Object

The class "Element" stores the information of a single frame. Exactly "MAXELEMENT" objects of this class exist in an array "EL_ARR[]" which is used in wrap around manner. The pixels are given as YUV values and they are then translated into the Java-AWT RGB model.


Field Summary
private static int CB_DIFF_FAC
          The coefficient for Cb value for G color calculation (0.34414 * 2^12).
private static int CB_FAC
          The coefficient for Cb value for B color calculation (1.772*2^12).
private static int CR_DIFF_FAC
          The coefficient for Cr value for G color calculation (0.71414 * 2^12).
private static int CR_FAC
          The coefficient for Cr value for R color calculation (1.402*2^12).
private static int CY_FAC
          The coefficient for Y' value for colors calculation (1.023*2^12).
 int Frame_idx
          Notice the frame number (display order).
 int Frame_type
          The type of the frame (I, B or P).
private  int h
          The height dimension of the frame pixels array.
private  int picRate
          The amount of frames per second.
 int[] Pix_Map
          The pixels in Java RGB model.
private  long pts
          Presentation timestamp (in milliseconds).
private  int sc_x
          The width screen dimension.
private  int sc_y
          The height screen dimension.
private  boolean scaled_x
          Flag, indicates that the frame should be scaled by width.
private  boolean scaled_y
          Flag, indicates that the frame should be scaled by height.
private  long step_x
          The x step (equals to w / sc_x) between pixel columns.
private  long step_y
          The y step (equals to h / sc_y) between pixel rows.
private  int w
          The width dimension of the frame pixels array.
 
Constructor Summary
(package private) Element(MPEG1 app, java.awt.image.ColorModel cm, int w, int h, int o_w, int o_h, int sc_x, int sc_y)
          Constructs an Element object.
 
Method Summary
protected  int getPicRate()
          Gets the amount of frames per second value.
protected  long getPts()
          Gets the time in milliseconds that this element is to be displayed.
 void Make_Picture(int[][] Pixels)
          The method "Make_Picture" is called every time the scanner has decoded a frame.
protected  void setPicRate(int _picRate)
          Sets the amount of frames per second.
protected  void setPts(long presentation_time_stamp)
          Sets the time in milliseconds that this element is to be displayed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Frame_idx

public int Frame_idx
Notice the frame number (display order).


Frame_type

public int Frame_type
The type of the frame (I, B or P).


Pix_Map

public int[] Pix_Map
The pixels in Java RGB model.


CY_FAC

private static final int CY_FAC
The coefficient for Y' value for colors calculation (1.023*2^12).

See Also:
Constant Field Values

CR_FAC

private static final int CR_FAC
The coefficient for Cr value for R color calculation (1.402*2^12).

See Also:
Constant Field Values

CB_FAC

private static final int CB_FAC
The coefficient for Cb value for B color calculation (1.772*2^12).

See Also:
Constant Field Values

CR_DIFF_FAC

private static final int CR_DIFF_FAC
The coefficient for Cr value for G color calculation (0.71414 * 2^12).

See Also:
Constant Field Values

CB_DIFF_FAC

private static final int CB_DIFF_FAC
The coefficient for Cb value for G color calculation (0.34414 * 2^12).

See Also:
Constant Field Values

w

private int w
The width dimension of the frame pixels array.


h

private int h
The height dimension of the frame pixels array.


scaled_x

private boolean scaled_x
Flag, indicates that the frame should be scaled by width.


scaled_y

private boolean scaled_y
Flag, indicates that the frame should be scaled by height.


sc_x

private int sc_x
The width screen dimension.


sc_y

private int sc_y
The height screen dimension.


step_x

private long step_x
The x step (equals to w / sc_x) between pixel columns.


step_y

private long step_y
The y step (equals to h / sc_y) between pixel rows.


pts

private long pts
Presentation timestamp (in milliseconds).


picRate

private int picRate
The amount of frames per second.

Constructor Detail

Element

Element(MPEG1 app,
        java.awt.image.ColorModel cm,
        int w,
        int h,
        int o_w,
        int o_h,
        int sc_x,
        int sc_y)
Constructs an Element object. Notices the frame sizes and produces an image and an array to store the RGB pixel values. The Applet (app) object is necessary to call the "createImage" routine.

Parameters:
app - the applet (app) object.
cm - the color model of the screen (RGB).
w - the width dimension of the frame pixels array.
h - the height dimension of the frame pixels array.
o_w - the width dimension of the movie frame.
o_h - the height dimension of the movie frame.
sc_x - the width screen dimension.
sc_y - the height screen dimension.
Method Detail

getPts

protected long getPts()
Gets the time in milliseconds that this element is to be displayed.

Returns:
the time in milliseconds that this element is to be displayed.

setPts

protected void setPts(long presentation_time_stamp)
Sets the time in milliseconds that this element is to be displayed.

Parameters:
presentation_time_stamp - the time in milliseconds to set.

setPicRate

protected void setPicRate(int _picRate)
Sets the amount of frames per second.

Parameters:
_picRate - the amount of frames per second to set.

getPicRate

protected int getPicRate()
Gets the amount of frames per second value.

Returns:
the amount of frames per second value.

Make_Picture

public void Make_Picture(int[][] Pixels)
The method "Make_Picture" is called every time the scanner has decoded a frame. It expects the frame information as YUV values and translates them into the Java RGB color system.

Parameters:
Pixels - the array of pixels as YUV values.