FFmpeg
Loading...
Searching...
No Matches
oggparsevorbis.c File Reference
#include <stdlib.h>
#include "libavutil/avstring.h"
#include "libavutil/base64.h"
#include "libavutil/dict.h"
#include "libavutil/mem.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/vorbis_parser.h"
#include "avformat.h"
#include "demux.h"
#include "flac_picture.h"
#include "internal.h"
#include "oggdec.h"
#include "vorbiscomment.h"
#include "replaygain.h"

Go to the source code of this file.

Data Structures

struct  oggvorbis_private
 

Enumerations

enum  VorbisPacketType {
  VORBIS_PACKET_DATA , VORBIS_PACKET_ID , VORBIS_PACKET_COMMENT , VORBIS_PACKET_SETUP ,
  VORBIS_PACKET_RESERVED
}
 

Functions

static int ogm_chapter (AVFormatContext *as, const uint8_t *key, const uint8_t *val)
 
int ff_vorbis_stream_comment (AVFormatContext *as, AVStream *st, const uint8_t *buf, int size)
 Parse Vorbis comments and add metadata to an AVStream.
 
static int vorbis_parse_single_comment (AVFormatContext *as, AVDictionary **m, const uint8_t *buf, uint32_t size, int *updates, int parse_picture)
 This function temporarily modifies the (const qualified) input buffer and reverts its changes before return.
 
int ff_vorbis_comment (AVFormatContext *as, AVDictionary **m, const uint8_t *buf, int size, int parse_picture)
 Parse Vorbis comments.
 
static int fixup_vorbis_headers (AVFormatContext *as, struct oggvorbis_private *priv, uint8_t **buf)
 
static void vorbis_cleanup (AVFormatContext *s, int idx)
 
int ff_vorbis_update_metadata (AVFormatContext *s, AVStream *st, const uint8_t *buf, int size)
 Parse Vorbis comments, add metadata to an AVStream.
 
static int vorbis_parse_header (AVFormatContext *s, AVStream *st, const uint8_t *p, unsigned int psize)
 
static int vorbis_update_metadata (AVFormatContext *s, int idx)
 
static int vorbis_header (AVFormatContext *s, int idx)
 
static int vorbis_check_packet_order (AVFormatContext *s, struct oggvorbis_private *priv, enum VorbisPacketType type)
 Check that a packet follows the identification, comment, setup order of a chained stream's headers, and record it as the last packet.
 
static int vorbis_packet (AVFormatContext *s, int idx)
 

Variables

const struct ogg_codec ff_vorbis_codec
 

Enumeration Type Documentation

◆ VorbisPacketType

Enumerator
VORBIS_PACKET_DATA 
VORBIS_PACKET_ID 
VORBIS_PACKET_COMMENT 
VORBIS_PACKET_SETUP 
VORBIS_PACKET_RESERVED 

Definition at line 212 of file oggparsevorbis.c.

Function Documentation

◆ ogm_chapter()

static int ogm_chapter ( AVFormatContext * as,
const uint8_t * key,
const uint8_t * val )
static

Definition at line 43 of file oggparsevorbis.c.

Referenced by vorbis_parse_single_comment().

◆ ff_vorbis_stream_comment()

int ff_vorbis_stream_comment ( AVFormatContext * as,
AVStream * st,
const uint8_t * buf,
int size )

Parse Vorbis comments and add metadata to an AVStream.

Note
The buffer will be temporarily modified by this function, so it needs to be writable. Furthermore it must be padded by a single byte (not counted in size). All changes will have been reverted upon return.

Definition at line 74 of file oggparsevorbis.c.

Referenced by ff_vorbis_update_metadata(), flac_header(), ogm_header(), opus_header(), speex_header(), theora_header(), and vp8_header().

◆ vorbis_parse_single_comment()

static int vorbis_parse_single_comment ( AVFormatContext * as,
AVDictionary ** m,
const uint8_t * buf,
uint32_t size,
int * updates,
int parse_picture )
static

This function temporarily modifies the (const qualified) input buffer and reverts its changes before return.

The input buffer needs to have at least one byte of padding.

Definition at line 91 of file oggparsevorbis.c.

Referenced by ff_vorbis_comment().

◆ ff_vorbis_comment()

int ff_vorbis_comment ( AVFormatContext * ms,
AVDictionary ** m,
const uint8_t * buf,
int size,
int parse_picture )

Parse Vorbis comments.

Note
The buffer will be temporarily modified by this function, so it needs to be writable. Furthermore it must be padded by a single byte (not counted in size). All changes will have been reverted upon return.

Definition at line 149 of file oggparsevorbis.c.

Referenced by ff_vorbis_stream_comment(), and flac_read_header().

◆ fixup_vorbis_headers()

static int fixup_vorbis_headers ( AVFormatContext * as,
struct oggvorbis_private * priv,
uint8_t ** buf )
static

Definition at line 231 of file oggparsevorbis.c.

Referenced by vorbis_header(), and vorbis_packet().

◆ vorbis_cleanup()

static void vorbis_cleanup ( AVFormatContext * s,
int idx )
static

Definition at line 269 of file oggparsevorbis.c.

◆ ff_vorbis_update_metadata()

int ff_vorbis_update_metadata ( AVFormatContext * s,
AVStream * st,
const uint8_t * buf,
int size )

Parse Vorbis comments, add metadata to an AVStream.

This function also attaches the metadata to the next decoded packet as AV_PKT_DATA_STRINGS_METADATA

Note
The buffer will be temporarily modified by this function, so it needs to be writable. Furthermore it must be padded by a single byte (not counted in size). All changes will have been reverted upon return.

Definition at line 282 of file oggparsevorbis.c.

Referenced by flac_packet(), opus_packet(), and vorbis_update_metadata().

◆ vorbis_parse_header()

static int vorbis_parse_header ( AVFormatContext * s,
AVStream * st,
const uint8_t * p,
unsigned int psize )
static

Definition at line 308 of file oggparsevorbis.c.

Referenced by vorbis_header(), and vorbis_packet().

◆ vorbis_update_metadata()

static int vorbis_update_metadata ( AVFormatContext * s,
int idx )
static

Definition at line 364 of file oggparsevorbis.c.

Referenced by vorbis_header(), and vorbis_packet().

◆ vorbis_header()

static int vorbis_header ( AVFormatContext * s,
int idx )
static

Definition at line 377 of file oggparsevorbis.c.

◆ vorbis_check_packet_order()

static int vorbis_check_packet_order ( AVFormatContext * s,
struct oggvorbis_private * priv,
enum VorbisPacketType type )
static

Check that a packet follows the identification, comment, setup order of a chained stream's headers, and record it as the last packet.

An identification header starts a new set. A misplaced packet discards the buffered headers, so an incomplete or misordered set is never packed. Reserved packet types are ignored, per Vorbis I ยง1.3.2.

Returns
0 if the packet is in order, AVERROR_INVALIDDATA otherwise

Definition at line 467 of file oggparsevorbis.c.

Referenced by vorbis_packet().

◆ vorbis_packet()

static int vorbis_packet ( AVFormatContext * s,
int idx )
static

Definition at line 507 of file oggparsevorbis.c.

Variable Documentation

◆ ff_vorbis_codec

const struct ogg_codec ff_vorbis_codec
Initial value:
= {
.magic = "\001vorbis",
.magicsize = 7,
.header = vorbis_header,
.packet = vorbis_packet,
.cleanup = vorbis_cleanup,
.nb_header = 3,
}
static void vorbis_cleanup(AVFormatContext *s, int idx)
static int vorbis_packet(AVFormatContext *s, int idx)
static int vorbis_header(AVFormatContext *s, int idx)

Definition at line 694 of file oggparsevorbis.c.