avformat.h File Reference

#include <time.h>
#include <stdio.h>
#include "libavcodec/avcodec.h"
#include "avio.h"

Go to the source code of this file.

Data Structures

struct  AVPacket
struct  AVFrac
struct  AVProbeData
struct  AVFormatParameters
struct  AVOutputFormat
struct  AVInputFormat
struct  AVIndexEntry
struct  AVStream
struct  AVProgram
struct  AVChapter
struct  AVFormatContext
struct  AVPacketList

Defines

#define LIBAVFORMAT_VERSION_MAJOR   52
#define LIBAVFORMAT_VERSION_MINOR   17
#define LIBAVFORMAT_VERSION_MICRO   0
#define LIBAVFORMAT_VERSION_INT
#define LIBAVFORMAT_VERSION
#define LIBAVFORMAT_BUILD   LIBAVFORMAT_VERSION_INT
#define LIBAVFORMAT_IDENT   "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
#define PKT_FLAG_KEY   0x0001
#define AVPROBE_SCORE_MAX   100
 max score, half of that is used for file extension based detection
#define AVPROBE_PADDING_SIZE   32
 extra allocated bytes at the end of the probe buffer
#define AVFMT_NOFILE   0x0001
 demuxer will use url_fopen, no opened file should be provided by the caller
#define AVFMT_NEEDNUMBER   0x0002
#define AVFMT_SHOW_IDS   0x0008
#define AVFMT_RAWPICTURE   0x0020
#define AVFMT_GLOBALHEADER   0x0040
#define AVFMT_NOTIMESTAMPS   0x0080
#define AVFMT_GENERIC_INDEX   0x0100
#define AVINDEX_KEYFRAME   0x0001
#define AV_DISPOSITION_DEFAULT   0x0001
#define AV_DISPOSITION_DUB   0x0002
#define AV_DISPOSITION_ORIGINAL   0x0004
#define AV_DISPOSITION_COMMENT   0x0008
#define AV_DISPOSITION_LYRICS   0x0010
#define AV_DISPOSITION_KARAOKE   0x0020
#define MAX_REORDER_DELAY   4
#define AV_PROGRAM_RUNNING   1
#define AVFMTCTX_NOHEADER   0x0001
#define MAX_STREAMS   20
#define AVFMT_NOOUTPUTLOOP   -1
#define AVFMT_INFINITEOUTPUTLOOP   0
#define AVFMT_FLAG_GENPTS   0x0001
 generate pts if missing even if it requires parsing future frames
#define AVFMT_FLAG_IGNIDX   0x0002
 ignore index
#define AVFMT_FLAG_NONBLOCK   0x0004
 do not block when reading packets from input
#define FF_FDEBUG_TS   0x0001
#define AVSEEK_FLAG_BACKWARD   1
 seek backward
#define AVSEEK_FLAG_BYTE   2
 seeking based on position in bytes
#define AVSEEK_FLAG_ANY   4
 seek to any frame, even non keyframes
#define FFM_PACKET_SIZE   4096

Typedefs

typedef AVFrac attribute_deprecated

Enumerations

enum  AVStreamParseType { AVSTREAM_PARSE_NONE, AVSTREAM_PARSE_FULL, AVSTREAM_PARSE_HEADERS, AVSTREAM_PARSE_TIMESTAMPS }

Functions

void av_destruct_packet_nofree (AVPacket *pkt)
void av_destruct_packet (AVPacket *pkt)
void av_init_packet (AVPacket *pkt)
int av_new_packet (AVPacket *pkt, int size)
int av_get_packet (ByteIOContext *s, AVPacket *pkt, int size)
int av_dup_packet (AVPacket *pkt)
static void av_free_packet (AVPacket *pkt)
AVInputFormatav_iformat_next (AVInputFormat *f)
AVOutputFormatav_oformat_next (AVOutputFormat *f)
enum CodecID av_guess_image2_codec (const char *filename)
void av_register_input_format (AVInputFormat *format)
void av_register_output_format (AVOutputFormat *format)
AVOutputFormatguess_stream_format (const char *short_name, const char *filename, const char *mime_type)
AVOutputFormatguess_format (const char *short_name, const char *filename, const char *mime_type)
enum CodecID av_guess_codec (AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum CodecType type)
void av_hex_dump (FILE *f, uint8_t *buf, int size)
void av_hex_dump_log (void *avcl, int level, uint8_t *buf, int size)
void av_pkt_dump (FILE *f, AVPacket *pkt, int dump_payload)
void av_pkt_dump_log (void *avcl, int level, AVPacket *pkt, int dump_payload)
void av_register_all (void)
enum CodecID av_codec_get_id (const struct AVCodecTag **tags, unsigned int tag)
unsigned int av_codec_get_tag (const struct AVCodecTag **tags, enum CodecID id)
AVInputFormatav_find_input_format (const char *short_name)
AVInputFormatav_probe_input_format (AVProbeData *pd, int is_opened)
int av_open_input_stream (AVFormatContext **ic_ptr, ByteIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap)
int av_open_input_file (AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap)
AVFormatContextav_alloc_format_context (void)
int av_find_stream_info (AVFormatContext *ic)
int av_read_packet (AVFormatContext *s, AVPacket *pkt)
int av_read_frame (AVFormatContext *s, AVPacket *pkt)
int av_seek_frame (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
int av_read_play (AVFormatContext *s)
int av_read_pause (AVFormatContext *s)
void av_close_input_stream (AVFormatContext *s)
void av_close_input_file (AVFormatContext *s)
AVStreamav_new_stream (AVFormatContext *s, int id)
AVProgramav_new_program (AVFormatContext *s, int id)
AVChapterff_new_chapter (AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)
void av_set_pts_info (AVStream *s, int pts_wrap_bits, int pts_num, int pts_den)
int av_find_default_stream_index (AVFormatContext *s)
int av_index_search_timestamp (AVStream *st, int64_t timestamp, int flags)
void ff_reduce_index (AVFormatContext *s, int stream_index)
int av_add_index_entry (AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
int av_seek_frame_binary (AVFormatContext *s, int stream_index, int64_t target_ts, int flags)
void av_update_cur_dts (AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
int64_t av_gen_search (AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t(*read_timestamp)(struct AVFormatContext *, int, int64_t *, int64_t))
int av_set_parameters (AVFormatContext *s, AVFormatParameters *ap)
int av_write_header (AVFormatContext *s)
int av_write_frame (AVFormatContext *s, AVPacket *pkt)
int av_interleaved_write_frame (AVFormatContext *s, AVPacket *pkt)
int av_interleave_packet_per_dts (AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
int av_write_trailer (AVFormatContext *s)
 Write the stream trailer to an output media file and free the file private data.
void dump_format (AVFormatContext *ic, int index, const char *url, int is_output)
attribute_deprecated int parse_image_size (int *width_ptr, int *height_ptr, const char *str)
attribute_deprecated int parse_frame_rate (int *frame_rate, int *frame_rate_base, const char *arg)
int64_t parse_date (const char *datestr, int duration)
int64_t av_gettime (void)
offset_t ffm_read_write_index (int fd)
void ffm_write_write_index (int fd, offset_t pos)
void ffm_set_write_index (AVFormatContext *s, offset_t pos, offset_t file_size)
int find_info_tag (char *arg, int arg_size, const char *tag1, const char *info)
int av_get_frame_filename (char *buf, int buf_size, const char *path, int number)
int av_filename_number_test (const char *filename)
int avf_sdp_create (AVFormatContext *ac[], int n_files, char *buff, int size)


Define Documentation

#define AV_DISPOSITION_COMMENT   0x0008

Definition at line 309 of file avformat.h.

#define AV_DISPOSITION_DEFAULT   0x0001

Definition at line 306 of file avformat.h.

Referenced by mkv_write_tracks().

#define AV_DISPOSITION_DUB   0x0002

Definition at line 307 of file avformat.h.

#define AV_DISPOSITION_KARAOKE   0x0020

Definition at line 311 of file avformat.h.

#define AV_DISPOSITION_LYRICS   0x0010

Definition at line 310 of file avformat.h.

#define AV_DISPOSITION_ORIGINAL   0x0004

Definition at line 308 of file avformat.h.

#define AV_PROGRAM_RUNNING   1

Definition at line 398 of file avformat.h.

#define AVFMT_FLAG_GENPTS   0x0001

generate pts if missing even if it requires parsing future frames

Definition at line 499 of file avformat.h.

Referenced by av_read_frame(), decode_thread(), and open_input_stream().

#define AVFMT_FLAG_IGNIDX   0x0002

ignore index

Definition at line 500 of file avformat.h.

Referenced by avi_read_header().

#define AVFMT_FLAG_NONBLOCK   0x0004

do not block when reading packets from input

Definition at line 501 of file avformat.h.

Referenced by device_open(), and vfw_read_packet().

#define AVFMT_GENERIC_INDEX   0x0100

use generic index building code

Definition at line 184 of file avformat.h.

Referenced by av_read_frame_internal().

#define AVFMT_GLOBALHEADER   0x0040

format wants global header

Definition at line 182 of file avformat.h.

Referenced by new_audio_stream(), and new_video_stream().

#define AVFMT_INFINITEOUTPUTLOOP   0

Definition at line 494 of file avformat.h.

#define AVFMT_NEEDNUMBER   0x0002

needs 'd' in filename

Definition at line 178 of file avformat.h.

Referenced by av_open_input_file(), and opt_output_file().

#define AVFMT_NOFILE   0x0001

demuxer will use url_fopen, no opened file should be provided by the caller

Definition at line 177 of file avformat.h.

Referenced by av_close_input_file(), av_estimate_timings(), av_exit(), av_open_input_file(), av_probe_input_format2(), img_read_header(), libextractor_thumbnailffmpeg_extract(), main(), and opt_output_file().

#define AVFMT_NOOUTPUTLOOP   -1

Definition at line 493 of file avformat.h.

#define AVFMT_NOTIMESTAMPS   0x0080

format does not need / have any timestamps

Definition at line 183 of file avformat.h.

Referenced by av_interleaved_write_frame(), and av_write_frame().

#define AVFMT_RAWPICTURE   0x0020

format wants AVPicture structure for raw picture data

Definition at line 180 of file avformat.h.

Referenced by do_video_out(), open_video(), and write_video_frame().

#define AVFMT_SHOW_IDS   0x0008

show format stream IDs numbers

Definition at line 179 of file avformat.h.

Referenced by dump_stream_format().

#define AVFMTCTX_NOHEADER   0x0001

signal that no header is present (streams are added dynamically)

Definition at line 416 of file avformat.h.

Referenced by avs_read_header(), flv_read_header(), flv_read_packet(), img_read_header(), make_setup_request(), mpegps_read_header(), mpegts_read_header(), read_header(), sdp_read_header(), str_read_header(), and swf_read_header().

#define AVINDEX_KEYFRAME   0x0001

Definition at line 300 of file avformat.h.

Referenced by asf_build_simple_index(), asf_read_pts(), av_index_search_timestamp(), av_read_frame_internal(), avi_read_idx1(), clean_index(), find_and_decode_index(), flv_read_packet(), mov_build_index(), mov_read_trun(), mpc8_parse_seektable(), mpc_read_packet(), mpegps_read_pes_header(), pva_read_header(), read_braindead_odml_indx(), read_part_of_packet(), rl2_read_header(), rm_read_dts(), rm_read_packet(), tta_read_header(), write_packet(), and wv_read_packet().

#define AVPROBE_PADDING_SIZE   32

extra allocated bytes at the end of the probe buffer

Definition at line 152 of file avformat.h.

Referenced by av_open_input_file(), and av_read_packet().

#define AVPROBE_SCORE_MAX   100

max score, half of that is used for file extension based detection

Definition at line 151 of file avformat.h.

Referenced by ac3_probe(), aiff_probe(), amr_probe(), apc_probe(), ape_probe(), asf_probe(), au_probe(), av_open_input_file(), avi_probe(), bfi_probe(), cdata_probe(), cin_probe(), dirac_probe(), dts_probe(), dxa_probe(), ea_probe(), ffm_probe(), film_probe(), flac_probe(), flic_probe(), flv_probe(), fourxm_probe(), gxf_probe(), h264_probe(), idcin_probe(), iff_probe(), image_probe(), ipmovie_probe(), lmlm4_probe(), matroska_probe(), mm_probe(), mmf_probe(), mov_probe(), mp3_read_probe(), mpc8_probe(), mpc_probe(), mpeg4video_probe(), mpegps_probe(), mpegts_probe(), mpegvideo_probe(), msnwc_tcp_probe(), mtv_probe(), mxf_probe(), nsv_probe(), nut_probe(), nuv_probe(), ogg_probe(), probe(), pva_probe(), rl2_probe(), rm_probe(), roq_probe(), rpl_probe(), rtsp_probe(), sdp_probe(), seq_probe(), siff_probe(), smacker_probe(), sol_probe(), swf_probe(), thp_probe(), txd_probe(), vc1t_probe(), vid_probe(), vmd_probe(), voc_probe(), wav_probe(), wc3_probe(), wsaud_probe(), wsvqa_probe(), wv_probe(), xa_probe(), and yuv4_probe().

#define AVSEEK_FLAG_ANY   4

seek to any frame, even non keyframes

Definition at line 827 of file avformat.h.

Referenced by av_add_index_entry(), av_index_search_timestamp(), avi_read_packet(), gxf_seek(), and matroska_read_seek().

#define AVSEEK_FLAG_BACKWARD   1

seek backward

Definition at line 825 of file avformat.h.

Referenced by av_gen_search(), av_index_search_timestamp(), av_seek_frame_binary(), avi_read_packet(), avi_read_seek(), decode_thread(), ffm_seek(), gxf_seek(), main(), nut_read_seek(), opt_input_file(), pcm_read_seek(), read_seek(), rl2_read_seek(), stream_seek(), and write_packet().

#define AVSEEK_FLAG_BYTE   2

seeking based on position in bytes

Definition at line 826 of file avformat.h.

Referenced by av_seek_frame(), and stream_seek().

#define FF_FDEBUG_TS   0x0001

Definition at line 559 of file avformat.h.

#define FFM_PACKET_SIZE   4096

Definition at line 998 of file avformat.h.

Referenced by adjust_write_index(), ffm_is_avail_data(), ffm_read_header(), ffm_seek(), ffm_seek1(), ffm_write_header(), http_receive_data(), http_start_receive_data(), open_input_stream(), and read_ffserver_streams().

#define LIBAVFORMAT_BUILD   LIBAVFORMAT_VERSION_INT

Definition at line 34 of file avformat.h.

Referenced by show_version().

#define LIBAVFORMAT_IDENT   "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)

Definition at line 36 of file avformat.h.

Referenced by http_connect(), mkv_write_header(), mov_write_ilst_tag(), ogg_build_flac_headers(), and write_globalinfo().

#define LIBAVFORMAT_VERSION

Value:

Definition at line 31 of file avformat.h.

Referenced by show_banner().

#define LIBAVFORMAT_VERSION_INT

Value:

Definition at line 28 of file avformat.h.

#define LIBAVFORMAT_VERSION_MAJOR   52

Definition at line 24 of file avformat.h.

#define LIBAVFORMAT_VERSION_MICRO   0

Definition at line 26 of file avformat.h.

#define LIBAVFORMAT_VERSION_MINOR   17

Definition at line 25 of file avformat.h.

#define MAX_REORDER_DELAY   4

Definition at line 388 of file avformat.h.

Referenced by av_new_stream().

#define MAX_STREAMS   20

Definition at line 426 of file avformat.h.

Referenced by av_find_stream_info(), decode_main_header(), ogg_interleave_per_granule(), opt_input_ts_scale(), and prepare_sdp_description().

#define PKT_FLAG_KEY   0x0001

Definition at line 73 of file avformat.h.

Referenced by asf_read_packet(), asf_read_pts(), asf_write_packet(), av_read_frame_internal(), av_seek_frame_generic(), avs_read_audio_packet(), avs_read_video_packet(), decode_frame(), do_audio_out(), do_video_out(), dv_extract_audio_info(), dv_produce_packet(), ea_read_packet(), ffm_read_packet(), ffm_write_packet(), flv_write_packet(), get_needed_flags(), http_prepare_data(), iff_read_packet(), img_read_packet(), lmlm4_read_packet(), main(), matroska_parse_block(), matroska_parse_blockgroup(), mkv_write_packet(), mov_write_packet(), mpeg_mux_write_packet(), msnwc_tcp_read_packet(), nsv_read_chunk(), nut_read_packet(), ogg_write_packet(), ogm_packet(), output_packet(), pkt_dump_internal(), put_payload_header(), read_packet(), rm_read_packet(), rm_write_audio(), rm_write_video(), rpl_read_packet(), siff_read_packet(), theora_gptopts(), vc1t_read_packet(), write_audio_frame(), write_frame(), write_packet(), and write_video_frame().


Typedef Documentation

typedef struct AVFrac attribute_deprecated

the exact value of the fractional number is: 'val + num / den'. num is assumed to be such as 0 <= num < den

Deprecated:
Use AVRational instead


Enumeration Type Documentation

enum AVStreamParseType

Enumerator:
AVSTREAM_PARSE_NONE 
AVSTREAM_PARSE_FULL  full parsing and repack
AVSTREAM_PARSE_HEADERS  only parse headers, don't repack
AVSTREAM_PARSE_TIMESTAMPS  full parsing and interpolation of timestamps for frames not starting on packet boundary

Definition at line 290 of file avformat.h.

00290                        {
00291     AVSTREAM_PARSE_NONE,
00292     AVSTREAM_PARSE_FULL,       /**< full parsing and repack */
00293     AVSTREAM_PARSE_HEADERS,    /**< only parse headers, don't repack */
00294     AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on packet boundary */
00295 };


Function Documentation

int av_add_index_entry ( AVStream st,
int64_t  pos,
int64_t  timestamp,
int  size,
int  distance,
int  flags 
)

Add a index entry into a sorted list updateing if it is already there.

Parameters:
timestamp timestamp in the timebase of the given stream

Definition at line 1150 of file libavformat/utils.c.

References av_fast_realloc(), av_index_search_timestamp(), AVSEEK_FLAG_ANY, AVIndexEntry::flags, AVStream::index_entries, AVStream::index_entries_allocated_size, AVIndexEntry::min_distance, AVStream::nb_index_entries, AVIndexEntry::pos, AVIndexEntry::size, and AVIndexEntry::timestamp.

Referenced by asf_build_simple_index(), asf_read_pts(), av_read_frame_internal(), avi_read_idx1(), clean_index(), find_and_decode_index(), flv_read_packet(), gxf_read_index(), mov_build_index(), mov_read_trun(), mpc8_parse_seektable(), mpc_read_packet(), mpegps_read_pes_header(), pva_read_header(), read_braindead_odml_indx(), read_part_of_packet(), rl2_read_header(), rm_read_dts(), rm_read_packet(), rpl_read_header(), tta_read_header(), write_packet(), and wv_read_packet().

01152 {
01153     AVIndexEntry *entries, *ie;
01154     int index;
01155 
01156     if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))
01157         return -1;
01158 
01159     entries = av_fast_realloc(st->index_entries,
01160                               &st->index_entries_allocated_size,
01161                               (st->nb_index_entries + 1) *
01162                               sizeof(AVIndexEntry));
01163     if(!entries)
01164         return -1;
01165 
01166     st->index_entries= entries;
01167 
01168     index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY);
01169 
01170     if(index<0){
01171         index= st->nb_index_entries++;
01172         ie= &entries[index];
01173         assert(index==0 || ie[-1].timestamp < timestamp);
01174     }else{
01175         ie= &entries[index];
01176         if(ie->timestamp != timestamp){
01177             if(ie->timestamp <= timestamp)
01178                 return -1;
01179             memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));
01180             st->nb_index_entries++;
01181         }else if(ie->pos == pos && distance < ie->min_distance) //do not reduce the distance
01182             distance= ie->min_distance;
01183     }
01184 
01185     ie->pos = pos;
01186     ie->timestamp = timestamp;
01187     ie->min_distance= distance;
01188     ie->size= size;
01189     ie->flags = flags;
01190 
01191     return index;
01192 }

AVFormatContext* av_alloc_format_context ( void   ) 

Allocate an AVFormatContext. Can be freed with av_free() but do not forget to free everything you explicitly allocated as well!

Definition at line 367 of file libavformat/utils.c.

References AVFormatContext::av_class, av_format_context_class, av_malloc(), and avformat_get_context_defaults().

Referenced by av_open_input_stream(), main(), opt_input_file(), opt_output_file(), prepare_sdp_description(), and rtp_new_av_stream().

00368 {
00369     AVFormatContext *ic;
00370     ic = av_malloc(sizeof(AVFormatContext));
00371     if (!ic) return ic;
00372     avformat_get_context_defaults(ic);
00373     ic->av_class = &av_format_context_class;
00374     return ic;
00375 }

void av_close_input_file ( AVFormatContext s  ) 

Close a media file (but not its codecs).

Parameters:
s media file handle

Definition at line 2237 of file libavformat/utils.c.

References av_close_input_stream(), AVFMT_NOFILE, AVInputFormat::flags, AVFormatContext::iformat, NULL, AVFormatContext::pb, and url_fclose().

Referenced by get_watermark_picture(), http_prepare_data(), and read_ffserver_streams().

02238 {
02239     ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
02240     av_close_input_stream(s);
02241     if (pb)
02242         url_fclose(pb);
02243 }

void av_close_input_stream ( AVFormatContext s  ) 

Free a AVFormatContext allocated by av_open_input_stream.

Parameters:
s context to free

Definition at line 2196 of file libavformat/utils.c.

References av_free(), av_free_packet(), av_parser_close(), AVStream::codec, AVFormatContext::cur_pkt, AVFormatContext::cur_st, AVCodecContext::extradata, AVStream::filename, AVFormatContext::iformat, AVStream::index_entries, AVFormatContext::nb_streams, AVStream::parser, AVStream::priv_data, AVInputFormat::read_close, and AVFormatContext::streams.

Referenced by av_close_input_file(), and http_receive_data().

02197 {
02198     int i;
02199     AVStream *st;
02200 
02201     /* free previous packet */
02202     if (s->cur_st && s->cur_st->parser)
02203         av_free_packet(&s->cur_pkt);
02204 
02205     if (s->iformat->read_close)
02206         s->iformat->read_close(s);
02207     for(i=0;i<s->nb_streams;i++) {
02208         /* free all data in a stream component */
02209         st = s->streams[i];
02210         if (st->parser) {
02211             av_parser_close(st->parser);
02212         }
02213         av_free(st->index_entries);
02214         av_free(st->codec->extradata);
02215         av_free(st->codec);
02216         av_free(st->filename);
02217         av_free(st->priv_data);
02218         av_free(st);
02219     }
02220     for(i=s->nb_programs-1; i>=0; i--) {
02221         av_freep(&s->programs[i]->provider_name);
02222         av_freep(&s->programs[i]->name);
02223         av_freep(&s->programs[i]->stream_index);
02224         av_freep(&s->programs[i]);
02225     }
02226     av_freep(&s->programs);
02227     flush_packet_queue(s);
02228     av_freep(&s->priv_data);
02229     while(s->nb_chapters--) {
02230         av_free(s->chapters[s->nb_chapters]->title);
02231         av_free(s->chapters[s->nb_chapters]);
02232     }
02233     av_freep(&s->chapters);
02234     av_free(s);
02235 }

enum CodecID av_codec_get_id ( const struct AVCodecTag **  tags,
unsigned int  tag 
)

codec tag <-> codec id

unsigned int av_codec_get_tag ( const struct AVCodecTag **  tags,
enum CodecID  id 
)

void av_destruct_packet ( AVPacket pkt  ) 

Default packet destructor.

Definition at line 188 of file libavformat/utils.c.

References av_free(), AVPacket::data, NULL, and AVPacket::size.

Referenced by av_dup_packet(), av_interleave_packet_per_dts(), av_new_packet(), ogg_interleave_per_granule(), output_packet(), and write_frame().

00189 {
00190     av_free(pkt->data);
00191     pkt->data = NULL; pkt->size = 0;
00192 }

void av_destruct_packet_nofree ( AVPacket pkt  ) 

Definition at line 873 of file libavformat/utils.c.

References AVPacket::data, NULL, and AVPacket::size.

Referenced by av_init_packet(), and av_read_frame_internal().

00874 {
00875     pkt->data = NULL; pkt->size = 0;
00876 }

int av_dup_packet ( AVPacket pkt  ) 

Warning:
This is a hack - the packet memory allocation stuff is broken. The packet is allocated if it was not really allocated

Definition at line 240 of file libavformat/utils.c.

References av_destruct_packet(), av_malloc(), AVERROR, AVPacket::data, AVPacket::destruct, FF_INPUT_BUFFER_PADDING_SIZE, and AVPacket::size.

Referenced by av_interleave_packet_per_dts(), ogg_interleave_per_granule(), and packet_queue_put().

00241 {
00242     if (pkt->destruct != av_destruct_packet) {
00243         uint8_t *data;
00244         /* We duplicate the packet and don't forget to add the padding again. */
00245         if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
00246             return AVERROR(ENOMEM);
00247         data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
00248         if (!data) {
00249             return AVERROR(ENOMEM);
00250         }
00251         memcpy(data, pkt->data, pkt->size);
00252         memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
00253         pkt->data = data;
00254         pkt->destruct = av_destruct_packet;
00255     }
00256     return 0;
00257 }

int av_filename_number_test ( const char *  filename  ) 

Check whether filename actually is a numbered sequence generator.

Parameters:
filename possible numbered sequence string
Returns:
1 if a valid numbered sequence string, 0 otherwise.

Definition at line 259 of file libavformat/utils.c.

References av_get_frame_filename().

Referenced by av_open_input_file(), guess_format(), image_probe(), and opt_output_file().

00260 {
00261     char buf[1024];
00262     return filename && (av_get_frame_filename(buf, sizeof(buf), filename, 1)>=0);
00263 }

int av_find_default_stream_index ( AVFormatContext s  ) 

Definition at line 1073 of file libavformat/utils.c.

References AVStream::codec, AVCodecContext::codec_type, CODEC_TYPE_AUDIO, CODEC_TYPE_VIDEO, AVFormatContext::nb_streams, and AVFormatContext::streams.

Referenced by av_seek_frame().

01074 {
01075     int first_audio_index = -1;
01076     int i;
01077     AVStream *st;
01078 
01079     if (s->nb_streams <= 0)
01080         return -1;
01081     for(i = 0; i < s->nb_streams; i++) {
01082         st = s->streams[i];
01083         if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
01084             return i;
01085         }
01086         if (first_audio_index < 0 && st->codec->codec_type == CODEC_TYPE_AUDIO)
01087             first_audio_index = i;
01088     }
01089     return first_audio_index >= 0 ? first_audio_index : 0;
01090 }

AVInputFormat* av_find_input_format ( const char *  short_name  ) 

finds AVInputFormat based on input format's short name.

Definition at line 176 of file libavformat/utils.c.

References first_iformat, AVInputFormat::name, AVInputFormat::next, and NULL.

Referenced by get_watermark_picture(), http_receive_data(), opt_format(), and parse_ffconfig().

00177 {
00178     AVInputFormat *fmt;
00179     for(fmt = first_iformat; fmt != NULL; fmt = fmt->next) {
00180         if (!strcmp(fmt->name, short_name))
00181             return fmt;
00182     }
00183     return NULL;
00184 }

int av_find_stream_info ( AVFormatContext ic  ) 

Read packets of a media file to get stream information. This is useful for file formats with no headers such as MPEG. This function also computes the real frame rate in case of mpeg2 repeat frame mode. The logical file position is not changed by this function; examined packets may be buffered for later processing.

Parameters:
ic media file handle
Returns:
>=0 if OK. AVERROR_xxx if error.

Definition at line