Libav
Data Structures | Macros | Functions | Variables
mov.c File Reference
#include <limits.h>
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavcodec/ac3tab.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
#include "riff.h"
#include "isom.h"
#include "libavcodec/get_bits.h"
#include "id3v1.h"
#include "mov_chan.h"
#include "qtpalette.h"
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  MOVParseTableEntry
 

Macros

#define MIN_DATA_ENTRY_BOX_SIZE   12
 

Functions

static int mov_read_default (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_metadata_track_or_disc_number (MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
 
static int mov_metadata_int8_bypass_padding (MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
 
static int mov_metadata_int8_no_padding (MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
 
static int mov_metadata_gnre (MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
 
static int mov_read_mac_string (MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen)
 
static int mov_read_covr (MOVContext *c, AVIOContext *pb, int type, int len)
 
static int mov_read_udta_string (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_chpl (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_dref (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_hdlr (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
int ff_mov_read_esds (AVFormatContext *fc, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_esds (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_dac3 (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_dec3 (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_chan (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_wfex (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_pasp (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_mdat (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_ftyp (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_moov (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_moof (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static void mov_metadata_creation_time (AVDictionary **metadata, time_t time)
 
static int mov_read_mdhd (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_mvhd (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_smi (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_enda (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_fiel (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_extradata (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_wave (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_glbl (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 This function reads atom content and puts data in extradata without tag nor size unlike mov_read_extradata. More...
 
static int mov_read_dvc1 (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_strf (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 An strf atom is a BITMAPINFOHEADER struct. More...
 
static int mov_read_stco (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
enum AVCodecID ff_mov_get_lpcm_codec_id (int bps, int flags)
 Compute codec id for 'lpcm' tag. More...
 
static int mov_codec_id (AVStream *st, uint32_t format)
 
static void mov_parse_stsd_video (MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
 
static void mov_parse_stsd_audio (MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
 
static void mov_parse_stsd_subtitle (MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int size)
 
static int mov_parse_stsd_data (MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int size)
 
static int mov_finalize_stsd_codec (MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
 
static int mov_skip_multiple_stsd (MOVContext *c, AVIOContext *pb, int codec_tag, int format, int size)
 
int ff_mov_read_stsd_entries (MOVContext *c, AVIOContext *pb, int entries)
 
static int mov_read_stsd (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_stsc (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_stps (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_stss (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_stsz (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_stts (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_ctts (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_sbgp (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static void mov_build_index (MOVContext *mov, AVStream *st)
 
static int mov_open_dref (AVIOContext **pb, char *src, MOVDref *ref, AVIOInterruptCB *int_cb)
 
static int mov_read_trak (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_ilst (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_meta (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_tkhd (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_tfhd (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_chap (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_trex (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_trun (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_wide (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_cmov (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_read_elst (MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
static int mov_probe (AVProbeData *p)
 
static void mov_read_chapters (AVFormatContext *s)
 
static int mov_read_close (AVFormatContext *s)
 
static int mov_read_header (AVFormatContext *s)
 
static AVIndexEntrymov_find_next_sample (AVFormatContext *s, AVStream **st)
 
static int mov_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int mov_seek_stream (AVFormatContext *s, AVStream *st, int64_t timestamp, int flags)
 
static int mov_read_seek (AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
 

Variables

static const uint32_t mac_to_unicode [128]
 
static const MOVParseTableEntry mov_default_parse_table []
 
AVInputFormat ff_mov_demuxer
 

Macro Definition Documentation

#define MIN_DATA_ENTRY_BOX_SIZE   12

Definition at line 352 of file mov.c.

Referenced by mov_read_dref().

Function Documentation

static int mov_read_default ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static
static int mov_metadata_track_or_disc_number ( MOVContext c,
AVIOContext pb,
unsigned  len,
const char *  key 
)
static

Definition at line 67 of file mov.c.

Referenced by mov_read_udta_string().

static int mov_metadata_int8_bypass_padding ( MOVContext c,
AVIOContext pb,
unsigned  len,
const char *  key 
)
static

Definition at line 86 of file mov.c.

Referenced by mov_read_udta_string().

static int mov_metadata_int8_no_padding ( MOVContext c,
AVIOContext pb,
unsigned  len,
const char *  key 
)
static

Definition at line 102 of file mov.c.

Referenced by mov_read_udta_string().

static int mov_metadata_gnre ( MOVContext c,
AVIOContext pb,
unsigned  len,
const char *  key 
)
static

Definition at line 113 of file mov.c.

Referenced by mov_read_udta_string().

static int mov_read_mac_string ( MOVContext c,
AVIOContext pb,
int  len,
char *  dst,
int  dstlen 
)
static

Definition at line 149 of file mov.c.

Referenced by mov_parse_stsd_video(), and mov_read_udta_string().

static int mov_read_covr ( MOVContext c,
AVIOContext pb,
int  type,
int  len 
)
static

Definition at line 167 of file mov.c.

Referenced by mov_read_udta_string().

static int mov_read_udta_string ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 209 of file mov.c.

Referenced by mov_read_default().

static int mov_read_chpl ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 320 of file mov.c.

static int mov_read_dref ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 353 of file mov.c.

static int mov_read_hdlr ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 461 of file mov.c.

int ff_mov_read_esds ( AVFormatContext fc,
AVIOContext pb,
MOVAtom  atom 
)

Definition at line 498 of file mov.c.

Referenced by mov_read_esds(), and read_kuki_chunk().

static int mov_read_esds ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 520 of file mov.c.

static int mov_read_dac3 ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 525 of file mov.c.

static int mov_read_dec3 ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 549 of file mov.c.

static int mov_read_chan ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 577 of file mov.c.

static int mov_read_wfex ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 593 of file mov.c.

static int mov_read_pasp ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 606 of file mov.c.

static int mov_read_mdat ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 630 of file mov.c.

Referenced by mov_read_wide().

static int mov_read_ftyp ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 639 of file mov.c.

static int mov_read_moov ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 671 of file mov.c.

static int mov_read_moof ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 683 of file mov.c.

static void mov_metadata_creation_time ( AVDictionary **  metadata,
time_t  time 
)
static

Definition at line 690 of file mov.c.

Referenced by mov_read_mdhd(), and mov_read_mvhd().

static int mov_read_mdhd ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 703 of file mov.c.

static int mov_read_mvhd ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 748 of file mov.c.

static int mov_read_smi ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 786 of file mov.c.

static int mov_read_enda ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 810 of file mov.c.

static int mov_read_fiel ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 842 of file mov.c.

static int mov_read_extradata ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 877 of file mov.c.

static int mov_read_wave ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 902 of file mov.c.

static int mov_read_glbl ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

This function reads atom content and puts data in extradata without tag nor size unlike mov_read_extradata.

Definition at line 934 of file mov.c.

Referenced by mov_parse_stsd_subtitle().

static int mov_read_dvc1 ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 963 of file mov.c.

static int mov_read_strf ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

An strf atom is a BITMAPINFOHEADER struct.

This struct is 40 bytes itself, but can have extradata appended at the end after the 40 bytes belonging to the struct.

Definition at line 994 of file mov.c.

static int mov_read_stco ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1017 of file mov.c.

enum AVCodecID ff_mov_get_lpcm_codec_id ( int  bps,
int  flags 
)

Compute codec id for 'lpcm' tag.

See CoreAudioTypes and AudioStreamBasicDescription at Apple.

Definition at line 1064 of file mov.c.

Referenced by mov_parse_stsd_audio(), and read_desc_chunk().

static int mov_codec_id ( AVStream st,
uint32_t  format 
)
static

Definition at line 1074 of file mov.c.

Referenced by ff_mov_read_stsd_entries().

static void mov_parse_stsd_video ( MOVContext c,
AVIOContext pb,
AVStream st,
MOVStreamContext sc 
)
static

Definition at line 1105 of file mov.c.

Referenced by ff_mov_read_stsd_entries().

static void mov_parse_stsd_audio ( MOVContext c,
AVIOContext pb,
AVStream st,
MOVStreamContext sc 
)
static

Definition at line 1211 of file mov.c.

Referenced by ff_mov_read_stsd_entries().

static void mov_parse_stsd_subtitle ( MOVContext c,
AVIOContext pb,
AVStream st,
MOVStreamContext sc,
int  size 
)
static

Definition at line 1297 of file mov.c.

Referenced by ff_mov_read_stsd_entries().

static int mov_parse_stsd_data ( MOVContext c,
AVIOContext pb,
AVStream st,
MOVStreamContext sc,
int  size 
)
static

Definition at line 1311 of file mov.c.

Referenced by ff_mov_read_stsd_entries().

static int mov_finalize_stsd_codec ( MOVContext c,
AVIOContext pb,
AVStream st,
MOVStreamContext sc 
)
static

Definition at line 1328 of file mov.c.

Referenced by ff_mov_read_stsd_entries().

static int mov_skip_multiple_stsd ( MOVContext c,
AVIOContext pb,
int  codec_tag,
int  format,
int  size 
)
static

Definition at line 1392 of file mov.c.

Referenced by ff_mov_read_stsd_entries().

int ff_mov_read_stsd_entries ( MOVContext c,
AVIOContext pb,
int  entries 
)

Definition at line 1417 of file mov.c.

Referenced by mov_read_stsd(), and qt_rtp_parse_packet().

static int mov_read_stsd ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1492 of file mov.c.

static int mov_read_stsc ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1503 of file mov.c.

static int mov_read_stps ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1543 of file mov.c.

static int mov_read_stss ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1576 of file mov.c.

static int mov_read_stsz ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1619 of file mov.c.

static int mov_read_stts ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1696 of file mov.c.

static int mov_read_ctts ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1758 of file mov.c.

static int mov_read_sbgp ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 1803 of file mov.c.

static void mov_build_index ( MOVContext mov,
AVStream st 
)
static

Definition at line 1843 of file mov.c.

Referenced by mov_read_trak().

static int mov_open_dref ( AVIOContext **  pb,
char *  src,
MOVDref ref,
AVIOInterruptCB int_cb 
)
static

Definition at line 2043 of file mov.c.

Referenced by mov_read_trak().

static int mov_read_trak ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2087 of file mov.c.

static int mov_read_ilst ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2179 of file mov.c.

static int mov_read_meta ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2188 of file mov.c.

static int mov_read_tkhd ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2202 of file mov.c.

static int mov_read_tfhd ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2281 of file mov.c.

static int mov_read_chap ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2318 of file mov.c.

static int mov_read_trex ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2324 of file mov.c.

static int mov_read_trun ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2347 of file mov.c.

static int mov_read_wide ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2449 of file mov.c.

static int mov_read_cmov ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2469 of file mov.c.

static int mov_read_elst ( MOVContext c,
AVIOContext pb,
MOVAtom  atom 
)
static

Definition at line 2518 of file mov.c.

static int mov_probe ( AVProbeData p)
static

Definition at line 2699 of file mov.c.

static void mov_read_chapters ( AVFormatContext s)
static

Definition at line 2744 of file mov.c.

Referenced by mov_read_header().

static int mov_read_close ( AVFormatContext s)
static

Definition at line 2813 of file mov.c.

Referenced by mov_read_header().

static int mov_read_header ( AVFormatContext s)
static

Definition at line 2854 of file mov.c.

static AVIndexEntry* mov_find_next_sample ( AVFormatContext s,
AVStream **  st 
)
static

Definition at line 2897 of file mov.c.

Referenced by mov_read_packet().

static int mov_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 2923 of file mov.c.

static int mov_seek_stream ( AVFormatContext s,
AVStream st,
int64_t  timestamp,
int  flags 
)
static

Definition at line 3008 of file mov.c.

Referenced by mov_read_seek().

static int mov_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  sample_time,
int  flags 
)
static

Definition at line 3038 of file mov.c.

Variable Documentation

const uint32_t mac_to_unicode[128]
static
Initial value:
= {
0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
}

Definition at line 130 of file mov.c.

Referenced by mov_read_mac_string().

const MOVParseTableEntry mov_default_parse_table[]
static

Definition at line 2558 of file mov.c.

AVInputFormat ff_mov_demuxer
Initial value:
= {
.name = "mov,mp4,m4a,3gp,3g2,mj2",
.long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
.priv_data_size = sizeof(MOVContext),
}

Definition at line 3069 of file mov.c.