FFmpeg
Loading...
Searching...
No Matches
demux_utils.c File Reference
#include <inttypes.h>
#include "libavutil/mem.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavcodec/bytestream.h"
#include "packet_internal.h"
#include "avformat.h"
#include "avformat_internal.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"

Go to the source code of this file.

Macros

#define SMPB_MAX_SAMPLES   (INT64_C(1) << 40)
 

Functions

struct AVCodecParserContextav_stream_get_parser (const AVStream *st)
 
void avpriv_stream_set_need_parsing (AVStream *st, enum AVStreamParseType type)
 
AVChapteravpriv_new_chapter (AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title)
 Add a new chapter.
 
int avformat_queue_attached_pictures (AVFormatContext *s)
 
int ff_add_attached_pic (AVFormatContext *s, AVStream *st0, AVIOContext *pb, AVBufferRef **buf, int size)
 Add an attached pic to an AVStream.
 
int ff_add_param_change (AVPacket *pkt, int32_t channels, uint64_t channel_layout, int32_t sample_rate, int32_t width, int32_t height)
 Add side data to a packet for changing parameters to the given values.
 
int av_read_play (AVFormatContext *s)
 Start playing a network-based stream (e.g.
 
int av_read_pause (AVFormatContext *s)
 Pause a network-based stream (e.g.
 
int avformat_send_command (AVFormatContext *s, enum AVFormatCommandID id, void *data)
 Send a command to the demuxer.
 
int avformat_receive_command_reply (AVFormatContext *s, enum AVFormatCommandID id, void **data_out)
 Receive a command reply from the demuxer.
 
int ff_generate_avci_extradata (AVStream *st)
 Generate standard extradata for AVC-Intra based on width/height and field order.
 
int ff_get_extradata (void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
 Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and fill it from pb.
 
int ff_find_stream_index (const AVFormatContext *s, int id)
 Find stream index based on format-specific stream ID.
 
int ff_itunes_parse_smpb (const char *value, int64_t *priming, int64_t *remainder, int64_t *samples)
 Parse the gapless playback information Apple encoders store in an iTunSMPB tag.
 

Macro Definition Documentation

◆ SMPB_MAX_SAMPLES

#define SMPB_MAX_SAMPLES   (INT64_C(1) << 40)

Definition at line 368 of file demux_utils.c.

Referenced by ff_itunes_parse_smpb().

Function Documentation

◆ av_stream_get_parser()

struct AVCodecParserContext * av_stream_get_parser ( const AVStream * st)

Definition at line 36 of file demux_utils.c.

Referenced by ist_dts_update().

◆ avpriv_stream_set_need_parsing()

void avpriv_stream_set_need_parsing ( AVStream * st,
enum AVStreamParseType type )

Definition at line 41 of file demux_utils.c.

Referenced by v4l2_read_header().

◆ avpriv_new_chapter()

AVChapter * avpriv_new_chapter ( AVFormatContext * s,
int64_t id,
AVRational time_base,
int64_t start,
int64_t end,
const char * title )

Add a new chapter.

Parameters
smedia file handle
idunique ID for this chapter
startchapter start time in time_base units
endchapter end time in time_base units
titlechapter title
Returns
AVChapter or NULL on error

Definition at line 46 of file demux_utils.c.

Referenced by aa_read_header(), asf_read_marker(), asf_read_marker(), concat_parse_script(), decode_info_header(), dvdvideo_chapters_setup_preindex(), dvdvideo_chapters_setup_simple(), ff_id3v2_parse_chapters(), flac_read_header(), mov_metadata_hmmt(), mov_read_chapters(), mov_read_chpl(), ogm_chapter(), read_chapter(), and read_header().

◆ ff_add_attached_pic()

int ff_add_attached_pic ( AVFormatContext * s,
AVStream * st,
AVIOContext * pb,
AVBufferRef ** buf,
int size )

Add an attached pic to an AVStream.

Parameters
stif set, the stream to add the attached pic to; if unset, a new stream will be added to s.
pbAVIOContext to read data from if buf is unset.
bufif set, it contains the data and size information to be used for the attached pic; if unset, data is read from pb.
sizethe size of the data to read if buf is unset.
Returns
0 on success, < 0 on error. On error, this function removes the stream it has added (if any).

Definition at line 110 of file demux_utils.c.

Referenced by ape_tag_read_field(), asf_read_picture(), ff_flac_parse_picture(), ff_id3v2_parse_apic(), get_attachment(), mov_read_chapters(), and mov_read_covr().

◆ ff_add_param_change()

int ff_add_param_change ( AVPacket * pkt,
int32_t channels,
uint64_t channel_layout,
int32_t sample_rate,
int32_t width,
int32_t height )

Add side data to a packet for changing parameters to the given values.

Parameters set to 0 aren't included in the change.

Definition at line 145 of file demux_utils.c.

Referenced by flv_read_packet(), load_ipmovie_packet(), and swf_read_packet().

◆ ff_generate_avci_extradata()

int ff_generate_avci_extradata ( AVStream * st)

Generate standard extradata for AVC-Intra based on width/height and field order.

Definition at line 208 of file demux_utils.c.

Referenced by mov_finalize_stsd_entry(), and mxf_parse_structural_metadata().

◆ ff_get_extradata()

◆ ff_find_stream_index()

int ff_find_stream_index ( const AVFormatContext * s,
int id )

Find stream index based on format-specific stream ID.

Returns
stream index, or < 0 on error

Definition at line 359 of file demux_utils.c.

Referenced by get_sindex(), parse_chunks(), pmt_cb(), and scte_data_cb().

◆ ff_itunes_parse_smpb()

int ff_itunes_parse_smpb ( const char * value,
int64_t * priming,
int64_t * remainder,
int64_t * samples )

Parse the gapless playback information Apple encoders store in an iTunSMPB tag.

The tag is a list of hexadecimal fields; the ones of interest are

<reserved> <priming> <remainder> <valid samples>

The decoded stream holds the three sample counts back to back, the priming and remainder samples being encoder artifacts.

The counts are returned small enough to be added and rescaled without overflowing.

Parameters
valuetag contents
primingnumber of samples to discard at the start of the stream
remaindernumber of samples to discard at the end of the stream
samplesnumber of valid samples between the two
Returns
>= 0 if OK, AVERROR_INVALIDDATA if the tag could not be parsed or holds counts too large to be sample counts

Definition at line 370 of file demux_utils.c.

Referenced by mov_read_custom(), and mp3_parse_itunes_smpb().