FFmpeg
Functions
hevc.h File Reference
#include <stdint.h>
#include "avio.h"

Go to the source code of this file.

Functions

int ff_hevc_annexb2mp4 (AVIOContext *pb, const uint8_t *buf_in, int size, int filter_ps, int *ps_count)
 Writes Annex B formatted HEVC NAL units to the provided AVIOContext. More...
 
int ff_hevc_annexb2mp4_buf (const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
 Writes Annex B formatted HEVC NAL units to a data buffer. More...
 
int ff_isom_write_hvcc (AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
 Writes HEVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext. More...
 

Detailed Description

internal header for HEVC (de)muxer utilities

Definition in file hevc.h.

Function Documentation

◆ ff_hevc_annexb2mp4()

int ff_hevc_annexb2mp4 ( AVIOContext pb,
const uint8_t *  buf_in,
int  size,
int  filter_ps,
int ps_count 
)

Writes Annex B formatted HEVC NAL units to the provided AVIOContext.

The NAL units are converted to an MP4-compatible format (start code prefixes are replaced by 4-byte size fields, as per ISO/IEC 14496-15).

If filter_ps is non-zero, any HEVC parameter sets found in the input will be discarded, and *ps_count will be set to the number of discarded PS NAL units.

Parameters
pbaddress of the AVIOContext where the data shall be written
buf_inaddress of the buffer holding the input data
sizesize (in bytes) of the input buffer
filter_pswhether to write parameter set NAL units to the output (0) or to discard them (non-zero)
ps_countaddress of the variable where the number of discarded parameter set NAL units shall be written, may be NULL
Returns
the amount (in bytes) of data written in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 998 of file hevc.c.

Referenced by ff_hevc_annexb2mp4_buf(), and ff_mov_write_packet().

◆ ff_hevc_annexb2mp4_buf()

int ff_hevc_annexb2mp4_buf ( const uint8_t *  buf_in,
uint8_t **  buf_out,
int size,
int  filter_ps,
int ps_count 
)

Writes Annex B formatted HEVC NAL units to a data buffer.

The NAL units are converted to an MP4-compatible format (start code prefixes are replaced by 4-byte size fields, as per ISO/IEC 14496-15).

If filter_ps is non-zero, any HEVC parameter sets found in the input will be discarded, and *ps_count will be set to the number of discarded PS NAL units.

On success, *size holds the size (in bytes) of the output data buffer.

Parameters
buf_inaddress of the buffer holding the input data
sizeaddress of the variable holding the size (in bytes) of the input buffer (on input) and of the output buffer (on success)
buf_outon success, address of the variable holding the address of the output buffer
filter_pswhether to write parameter set NAL units to the output (0) or to discard them (non-zero)
ps_countaddress of the variable where the number of discarded parameter set NAL units shall be written, may be NULL
Returns
0 in case of success, a negative value corresponding to an AVERROR code in case of failure
Note
*buf_out will be treated as uninitialized on input and won't be freed.

Definition at line 1046 of file hevc.c.

Referenced by ff_mov_write_packet().

◆ ff_isom_write_hvcc()

int ff_isom_write_hvcc ( AVIOContext pb,
const uint8_t *  data,
int  size,
int  ps_array_completeness 
)

Writes HEVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext.

If the extradata is Annex B format, it gets converted to hvcC format before writing.

Parameters
pbaddress of the AVIOContext where the hvcC shall be written
dataaddress of the buffer holding the data needed to write the hvcC
sizesize (in bytes) of the data buffer
ps_array_completenesswhether all parameter sets are in the hvcC (1) or there may be additional parameter sets in the bitstream (0)
Returns
>=0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 1067 of file hevc.c.

Referenced by mkv_assemble_native_codecprivate(), and mov_write_hvcc_tag().