FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
spdifenc.c File Reference

IEC-61937 encapsulation of various formats, used by S/PDIF. More...

#include <inttypes.h>
#include "avformat.h"
#include "avio_internal.h"
#include "spdif.h"
#include "libavcodec/ac3.h"
#include "libavcodec/dca.h"
#include "libavcodec/aacadtsdec.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  IEC61937Context
 

Macros

#define SPDIF_FLAG_BIGENDIAN   0x01
 
#define MAT_FRAME_SIZE   61424
 
#define TRUEHD_FRAME_OFFSET   2560
 
#define MAT_MIDDLE_CODE_OFFSET   -4
 

Functions

static int spdif_header_ac3 (AVFormatContext *s, AVPacket *pkt)
 
static int spdif_header_eac3 (AVFormatContext *s, AVPacket *pkt)
 
static int spdif_dts4_subtype (int period)
 
static int spdif_header_dts4 (AVFormatContext *s, AVPacket *pkt, int core_size, int sample_rate, int blocks)
 
static int spdif_header_dts (AVFormatContext *s, AVPacket *pkt)
 
static int spdif_header_mpeg (AVFormatContext *s, AVPacket *pkt)
 
static int spdif_header_aac (AVFormatContext *s, AVPacket *pkt)
 
static int spdif_header_truehd (AVFormatContext *s, AVPacket *pkt)
 
static int spdif_write_header (AVFormatContext *s)
 
static int spdif_write_trailer (AVFormatContext *s)
 
static av_always_inline void spdif_put_16 (IEC61937Context *ctx, AVIOContext *pb, unsigned int val)
 
static int spdif_write_packet (struct AVFormatContext *s, AVPacket *pkt)
 

Variables

static const AVOption options []
 
static const AVClass spdif_class
 
static enum IEC61937DataType mpeg_data_type [2][3]
 
AVOutputFormat ff_spdif_muxer
 

Detailed Description

IEC-61937 encapsulation of various formats, used by S/PDIF.

Author
Bartlomiej Wolowiec
Anssi Hannula
Carl Eugen Hoyos

Definition in file spdifenc.c.

Macro Definition Documentation

#define SPDIF_FLAG_BIGENDIAN   0x01

Definition at line 81 of file spdifenc.c.

Referenced by spdif_put_16(), and spdif_write_packet().

#define MAT_FRAME_SIZE   61424

Definition at line 392 of file spdifenc.c.

Referenced by spdif_header_truehd(), and spdif_write_header().

#define TRUEHD_FRAME_OFFSET   2560

Definition at line 393 of file spdifenc.c.

Referenced by spdif_header_truehd().

#define MAT_MIDDLE_CODE_OFFSET   -4

Definition at line 394 of file spdifenc.c.

Referenced by spdif_header_truehd().

Function Documentation

static int spdif_header_ac3 ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 104 of file spdifenc.c.

Referenced by spdif_write_header().

static int spdif_header_eac3 ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 114 of file spdifenc.c.

Referenced by spdif_write_header().

static int spdif_dts4_subtype ( int  period)
static

Definition at line 152 of file spdifenc.c.

Referenced by spdif_header_dts4().

static int spdif_header_dts4 ( AVFormatContext s,
AVPacket pkt,
int  core_size,
int  sample_rate,
int  blocks 
)
static

Definition at line 165 of file spdifenc.c.

Referenced by spdif_header_dts().

static int spdif_header_dts ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 242 of file spdifenc.c.

Referenced by spdif_write_header().

static int spdif_header_mpeg ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 325 of file spdifenc.c.

Referenced by spdif_write_header().

static int spdif_header_aac ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 348 of file spdifenc.c.

Referenced by spdif_write_header().

static int spdif_header_truehd ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 396 of file spdifenc.c.

Referenced by spdif_write_header().

static int spdif_write_header ( AVFormatContext s)
static

Definition at line 442 of file spdifenc.c.

static int spdif_write_trailer ( AVFormatContext s)
static

Definition at line 477 of file spdifenc.c.

static av_always_inline void spdif_put_16 ( IEC61937Context ctx,
AVIOContext pb,
unsigned int  val 
)
static

Definition at line 485 of file spdifenc.c.

Referenced by spdif_write_packet().

static int spdif_write_packet ( struct AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 494 of file spdifenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ "spdif_flags", "IEC 61937 encapsulation flags", 0x42, AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" },
{ "be", "output in big-endian format (for use as s16be)", 0, AV_OPT_TYPE_CONST, {.i64 = SPDIF_FLAG_BIGENDIAN}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" },
{ "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 rate (in Hz, default 0=disabled)", 0x42, AV_OPT_TYPE_INT, {.i64 = 0}, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM },
{ "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till the end, default 60)", 0x42, AV_OPT_TYPE_INT, {.i64 = 60}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
}

Definition at line 89 of file spdifenc.c.

const AVClass spdif_class
static
Initial value:
= {
.class_name = "spdif",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 97 of file spdifenc.c.

enum IEC61937DataType mpeg_data_type[2][3]
static
Initial value:

Definition at line 319 of file spdifenc.c.

Referenced by spdif_header_mpeg().

AVOutputFormat ff_spdif_muxer
Initial value:
= {
.name = "spdif",
.long_name = NULL_IF_CONFIG_SMALL("IEC 61937 (used on S/PDIF - IEC958)"),
.extensions = "spdif",
.priv_data_size = sizeof(IEC61937Context),
.audio_codec = AV_CODEC_ID_AC3,
.video_codec = AV_CODEC_ID_NONE,
.priv_class = &spdif_class,
}

Definition at line 546 of file spdifenc.c.