📄 swftagdumper.java
字号:
println( dashes );
}
}
/**
* SWFTagTypes interface
*/
public void tagDefineBitsJPEG2( int id, InputStream jpegImage ) throws IOException
{
println( "jpeg2 id=" + id + " (from input stream)" );
}
/**
* SWFTagTypes interface
*/
public SWFShape tagDefineMorphShape( int id, Rect startBounds, Rect endBounds )
throws IOException
{
println( "morph-shape id=" + id + " start: " +
startBounds + " end: " + endBounds );
return this;
}
/**
* SWFTagTypes interface
*/
public void tagDefineBitsLossless( int id, int format, int width, int height,
Color[] colors, byte[] imageData )
throws IOException
{
dumpBitsLossless( "bits-lossless", id, format, width, height, colors, imageData );
}
/**
* SWFTagTypes interface
*/
public void tagDefineBitsLossless2( int id, int format, int width, int height,
Color[] colors, byte[] imageData )
throws IOException
{
dumpBitsLossless( "bits-lossless2", id, format, width, height, colors, imageData );
}
public void dumpBitsLossless( String name, int id, int format,
int width, int height,
Color[] colors, byte[] imageData )
throws IOException
{
int size = 0;
if ( format == SWFConstants.BITMAP_FORMAT_8_BIT ) size = 8;
else if( format == SWFConstants.BITMAP_FORMAT_16_BIT ) size = 16;
else if( format == SWFConstants.BITMAP_FORMAT_32_BIT ) size = 32;
println( name + " id=" + id + " bits=" + size +
" width=" + width + " height=" + height );
if( dumpHex )
{
for( int i = 0; i < colors.length; i++ )
{
println( " " + i + ": " + colors[i] );
}
Hex.dump( writer, imageData, 0L, indent + " ", false );
println( dashes );
}
}
/**
* SWFVectors interface
* SWFText interface
*/
public void done() throws IOException
{
println( " " + dashes );
}
/**
* SWFVectors interface
*/
public void line( int dx, int dy ) throws IOException
{
println( " line " + dx + "," + dy );
}
/**
* SWFVectors interface
*/
public void curve( int cx, int cy, int dx, int dy ) throws IOException
{
println( " curve " + cx + "," + cy + " - " + dx + "," + dy );
}
/**
* SWFVectors interface
*/
public void move( int x, int y ) throws IOException
{
println( " move " + x + "," + y );
}
/**
* SWFShape interface
*/
public void setFillStyle0( int styleIndex ) throws IOException
{
println( " fill0 = " + styleIndex );
}
/**
* SWFShape interface
*/
public void setFillStyle1( int styleIndex ) throws IOException
{
println( " fill1 = " + styleIndex );
}
/**
* SWFShape interface
*/
public void setLineStyle( int styleIndex ) throws IOException
{
println( " line = " + styleIndex );
}
/**
* SWFShape interface
*/
public void defineFillStyle( Color color ) throws IOException
{
println( " fill " + color );
}
/**
* SWFShape interface
*/
public void defineFillStyle( Matrix matrix, int[] ratios,
Color[] colors, boolean radial )
throws IOException
{
println( " fill radial=" + radial + " " + matrix );
for( int i = 0; i < ratios.length && i < colors.length; i++ )
{
if( colors[i] == null ) continue;
println( " ratio=" + ratios[i] + " " + colors[i] );
}
}
/**
* SWFShape interface
*/
public void defineFillStyle( int bitmapId, Matrix matrix, boolean clipped )
throws IOException
{
println( " fill clipped=" + clipped + " image=" + bitmapId + " " + matrix );
}
/**
* SWFShape interface
*/
public void defineLineStyle( int width, Color color ) throws IOException
{
println( " line-style width=" + width + " " + color );
}
/**
* SWFText interface
*/
public void font( int fontId, int textHeight ) throws IOException
{
println( " font id=" + fontId + " size=" + textHeight );
}
/**
* SWFText interface
*/
public void color( Color color ) throws IOException
{
println( " color " + color );
}
/**
* SWFText interface
*/
public void setX( int x ) throws IOException
{
println( " x = " + x );
}
/**
* SWFText interface
*/
public void setY( int y ) throws IOException
{
println( " y = " + y );
}
/**
* SWFText interface
*/
public void text( int[] glyphIndices, int[] glyphAdvances ) throws IOException
{
StringBuffer buff1 = new StringBuffer();
StringBuffer buff2 = new StringBuffer();
buff1.append( "(" );
buff2.append( "(" );
for( int i = 0; i < glyphIndices.length && i < glyphAdvances.length; i++ )
{
buff1.append( " " );
buff2.append( " " );
buff1.append( glyphIndices[i] );
buff2.append( glyphAdvances[i] );
}
buff1.append( " )" );
buff2.append( " )" );
println( " text" );
println( " glyph indices = " + buff1 );
println( " advances = " + buff2 );
}
public void flush() throws IOException
{
writer.flush();
}
/**
* args[0] = name of SWF file to dump to System.out
* args[1] = if exists then dump-hex is true (dumps binary as hex - otherwise skips)
* args[2] = if exists then decompiles action codes
*/
public static void main( String[] args ) throws IOException
{
SWFTagDumper dumper = new SWFTagDumper( args.length > 1, args.length > 2 );
FileInputStream in = new FileInputStream( args[0] );
SWFTags tagparser = new TagParser( dumper );
SWFReader reader = new SWFReader( tagparser, in );
try
{
reader.readFile();
}
finally
{
dumper.flush();
in.close();
}
}
/**
* @see com.anotherbigidea.flash.interfaces.SWFTagTypes#tagScriptLimits(int, int)
*/
public void tagScriptLimits(int maxRecursionDepth, int scriptTimeoutSecs)
throws IOException {
println( "script-limits max-recursion-depth=" + maxRecursionDepth + " script-timeout=" + scriptTimeoutSecs + " secs" );
}
/**
* @see com.anotherbigidea.flash.interfaces.SWFSpriteTagTypes#tagTabOrder(int, int)
*/
public void tagTabOrder(int depth, int tabOrder) throws IOException {
println( "tab-order depth=" + depth + " order=" + tabOrder );
}
/** @see com.anotherbigidea.flash.interfaces.SWFTagTypes#tagDefineVideoStream(int, int, int, int, int, int) */
public void tagDefineVideoStream(int id, int numFrames, int width,
int height, int flags, int codec) throws IOException {
String codecName = "codec=" + codec;
if ( codec == SWFConstants.VIDEO_CODEC_SCREEN_VIDEO ) codecName = "codec=screen-video";
else if( codec == SWFConstants.VIDEO_CODEC_SORENSON_H263 ) codecName = "codec=sorenson-H.263";
String deblocking = "deblocking-in-packet";
if((flags & SWFConstants.VIDEO_STREAM_DEBLOCKING_ON) != 0 ) {
deblocking = "deblocking-on";
} else if((flags & SWFConstants.VIDEO_STREAM_DEBLOCKING_OFF) != 0 ) {
deblocking = "deblocking-off";
}
String smoothing = ((flags & SWFConstants.VIDEO_STREAM_SMOOTHING_ON) != 0 ) ?
"smoothing-on" :
"smoothing-off";
println( "define video stream, id=" + id + ", frames=" + numFrames +
", (" + width + "x" + height + "), " + codecName +
", " + deblocking + ", " + smoothing );
}
/** @see com.anotherbigidea.flash.interfaces.SWFTagTypes#tagVideoFrame(int, int, byte[]) */
public void tagVideoFrame(int streamId, int seqNum, int frameType, int codec, byte[] videoPacket)
throws IOException {
String codecName = " codec=" + codec;
if ( codec == SWFConstants.VIDEO_CODEC_SCREEN_VIDEO ) codecName = " codec=screen-video";
else if( codec == SWFConstants.VIDEO_CODEC_SORENSON_H263 ) codecName = " codec=sorenson-H.263";
String type = "type=" + frameType;
if ( frameType == SWFConstants.VIDEO_FRAME_KEYFRAME ) type = " type=key-frame";
else if( frameType == SWFConstants.VIDEO_FRAME_INTERFRAME ) type = " type=inter-frame";
println( "video frame #" + seqNum + " - streamId=" + streamId + codecName + type );
if( codec == SWFConstants.VIDEO_CODEC_SCREEN_VIDEO ) {
ScreenVideoPacket svp = new ScreenVideoPacket( new InStream( videoPacket ));
println( " packet: image(" +
svp.getImageWidth() + "x" + svp.getImageHeight() +
") block(" + svp.getBlockWidth() + "x" + svp.getBlockHeight() +
") #blocks=" + svp.getImageBlocks().length );
}
if( dumpHex ) {
Hex.dump( writer, videoPacket, 0L, indent + " ", false );
println( dashes );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -