org.jcodec.codecs.h264
Class H264Utils

java.lang.Object
  extended by org.jcodec.codecs.h264.H264Utils

public class H264Utils
extends Object

This class is part of JCodec ( www.jcodec.org ) This software is distributed under FreeBSD License

Author:
Jay Codec

Constructor Summary
H264Utils()
           
 
Method Summary
static SampleEntry createMOVSampleEntry(List<ByteBuffer> spsList, List<ByteBuffer> ppsList)
           
static SampleEntry createMOVSampleEntry(SeqParameterSet initSPS, PictureParameterSet initPPS)
           
static void encodeMOVPacket(ByteBuffer avcFrame, List<ByteBuffer> spsList, List<ByteBuffer> ppsList)
          Encodes AVC frame in ISO BMF format.
static void escapeNAL(ByteBuffer src, ByteBuffer dst)
           
static int getPicHeightInMbs(SeqParameterSet sps)
           
static int golomb2Signed(int val)
           
static ByteBuffer gotoNALUnit(ByteBuffer buf)
          Finds next Nth H.264 bitstream NAL unit (0x00000001) and returns the data that preceeds it as a ByteBuffer slice Segment byte order is always little endian TODO: emulation prevention
static boolean idrSlice(ByteBuffer _data)
           
static boolean idrSlice(List<ByteBuffer> _data)
           
static void joinNALUnits(List<ByteBuffer> nalUnits, ByteBuffer out)
           
static ByteBuffer nextNALUnit(ByteBuffer buf)
           
static void saveRawFrame(ByteBuffer data, AvcCBox avcC, File f)
           
static void saveStreamParams(AvcCBox avcC, SeekableByteChannel raw)
           
static void skipToNALUnit(ByteBuffer buf)
           
static List<ByteBuffer> splitFrame(ByteBuffer frame)
           
static List<ByteBuffer> splitMOVPacket(ByteBuffer buf, AvcCBox avcC)
           
static void unescapeNAL(ByteBuffer _buf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

H264Utils

public H264Utils()
Method Detail

nextNALUnit

public static ByteBuffer nextNALUnit(ByteBuffer buf)

skipToNALUnit

public static final void skipToNALUnit(ByteBuffer buf)

gotoNALUnit

public static final ByteBuffer gotoNALUnit(ByteBuffer buf)
Finds next Nth H.264 bitstream NAL unit (0x00000001) and returns the data that preceeds it as a ByteBuffer slice Segment byte order is always little endian TODO: emulation prevention

Parameters:
buf -
Returns:

unescapeNAL

public static final void unescapeNAL(ByteBuffer _buf)

escapeNAL

public static final void escapeNAL(ByteBuffer src,
                                   ByteBuffer dst)

golomb2Signed

public static int golomb2Signed(int val)

splitMOVPacket

public static List<ByteBuffer> splitMOVPacket(ByteBuffer buf,
                                              AvcCBox avcC)

encodeMOVPacket

public static void encodeMOVPacket(ByteBuffer avcFrame,
                                   List<ByteBuffer> spsList,
                                   List<ByteBuffer> ppsList)
Encodes AVC frame in ISO BMF format. Takes Annex B format. Scans the packet for each NAL Unit starting with 00 00 00 01 and replaces this 4 byte sequence with 4 byte integer representing this NAL unit length. Removes any leading SPS/PPS structures and collects them into a provided storaae.

Parameters:
avcFrame - AVC frame encoded in Annex B NAL unit format
spsList - Storage for leading SPS structures ( can be null, then all leading SPSs are discarded ).
ppsList - Storage for leading PPS structures ( can be null, then all leading PPSs are discarded ).

createMOVSampleEntry

public static SampleEntry createMOVSampleEntry(List<ByteBuffer> spsList,
                                               List<ByteBuffer> ppsList)

createMOVSampleEntry

public static SampleEntry createMOVSampleEntry(SeqParameterSet initSPS,
                                               PictureParameterSet initPPS)

idrSlice

public static boolean idrSlice(ByteBuffer _data)

idrSlice

public static boolean idrSlice(List<ByteBuffer> _data)

saveRawFrame

public static void saveRawFrame(ByteBuffer data,
                                AvcCBox avcC,
                                File f)
                         throws IOException
Throws:
IOException

saveStreamParams

public static void saveStreamParams(AvcCBox avcC,
                                    SeekableByteChannel raw)
                             throws IOException
Throws:
IOException

getPicHeightInMbs

public static int getPicHeightInMbs(SeqParameterSet sps)

splitFrame

public static List<ByteBuffer> splitFrame(ByteBuffer frame)

joinNALUnits

public static void joinNALUnits(List<ByteBuffer> nalUnits,
                                ByteBuffer out)


Copyright © 2013. All Rights Reserved.