FFmpeg
dsfdec.c
Go to the documentation of this file.
1 /*
2  * DSD Stream File (DSF) demuxer
3  * Copyright (c) 2014 Peter Ross
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/intreadwrite.h"
23 #include "avformat.h"
24 #include "internal.h"
25 #include "id3v2.h"
26 
27 typedef struct {
28  uint64_t data_end;
29  uint64_t audio_size;
30  uint64_t data_size;
31 } DSFContext;
32 
33 static int dsf_probe(const AVProbeData *p)
34 {
35  if (p->buf_size < 12 || memcmp(p->buf, "DSD ", 4) || AV_RL64(p->buf + 4) != 28)
36  return 0;
37  return AVPROBE_SCORE_MAX;
38 }
39 
40 static const uint64_t dsf_channel_layout[] = {
41  0,
49 };
50 
51 static void read_id3(AVFormatContext *s, uint64_t id3pos)
52 {
53  ID3v2ExtraMeta *id3v2_extra_meta = NULL;
54  if (avio_seek(s->pb, id3pos, SEEK_SET) < 0)
55  return;
56 
57  ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, 0);
58  if (id3v2_extra_meta) {
59  ff_id3v2_parse_apic(s, &id3v2_extra_meta);
60  ff_id3v2_parse_chapters(s, &id3v2_extra_meta);
61  }
62  ff_id3v2_free_extra_meta(&id3v2_extra_meta);
63 }
64 
66 {
67  DSFContext *dsf = s->priv_data;
68  AVIOContext *pb = s->pb;
69  AVStream *st;
70  uint64_t id3pos;
71  unsigned int channel_type;
72 
73  avio_skip(pb, 4);
74  if (avio_rl64(pb) != 28)
75  return AVERROR_INVALIDDATA;
76 
77  /* create primary stream before any id3 coverart streams */
78  st = avformat_new_stream(s, NULL);
79  if (!st)
80  return AVERROR(ENOMEM);
81 
82  avio_skip(pb, 8);
83  id3pos = avio_rl64(pb);
84  if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
85  read_id3(s, id3pos);
86  avio_seek(pb, 28, SEEK_SET);
87  }
88 
89  /* fmt chunk */
90 
91  if (avio_rl32(pb) != MKTAG('f', 'm', 't', ' ') || avio_rl64(pb) != 52)
92  return AVERROR_INVALIDDATA;
93 
94  if (avio_rl32(pb) != 1) {
95  avpriv_request_sample(s, "unknown format version");
96  return AVERROR_INVALIDDATA;
97  }
98 
99  if (avio_rl32(pb)) {
100  avpriv_request_sample(s, "unknown format id");
101  return AVERROR_INVALIDDATA;
102  }
103 
104  channel_type = avio_rl32(pb);
105  if (channel_type < FF_ARRAY_ELEMS(dsf_channel_layout))
106  st->codecpar->channel_layout = dsf_channel_layout[channel_type];
107  if (!st->codecpar->channel_layout)
108  avpriv_request_sample(s, "channel type %i", channel_type);
109 
111  st->codecpar->channels = avio_rl32(pb);
112  st->codecpar->sample_rate = avio_rl32(pb) / 8;
113 
114  if (st->codecpar->channels <= 0)
115  return AVERROR_INVALIDDATA;
116 
117  switch(avio_rl32(pb)) {
118  case 1: st->codecpar->codec_id = AV_CODEC_ID_DSD_LSBF_PLANAR; break;
119  case 8: st->codecpar->codec_id = AV_CODEC_ID_DSD_MSBF_PLANAR; break;
120  default:
121  avpriv_request_sample(s, "unknown most significant bit");
122  return AVERROR_INVALIDDATA;
123  }
124 
125  dsf->audio_size = avio_rl64(pb) / 8 * st->codecpar->channels;
126  st->codecpar->block_align = avio_rl32(pb);
127  if (st->codecpar->block_align > INT_MAX / st->codecpar->channels || st->codecpar->block_align <= 0) {
128  avpriv_request_sample(s, "block_align invalid");
129  return AVERROR_INVALIDDATA;
130  }
131  st->codecpar->block_align *= st->codecpar->channels;
132  st->codecpar->bit_rate = st->codecpar->channels * st->codecpar->sample_rate * 8LL;
133  avio_skip(pb, 4);
134 
135  /* data chunk */
136 
137  dsf->data_end = avio_tell(pb);
138  if (avio_rl32(pb) != MKTAG('d', 'a', 't', 'a'))
139  return AVERROR_INVALIDDATA;
140  dsf->data_size = avio_rl64(pb) - 12;
141  dsf->data_end += dsf->data_size + 12;
142  s->internal->data_offset = avio_tell(pb);
143 
144  return 0;
145 }
146 
148 {
149  DSFContext *dsf = s->priv_data;
150  AVIOContext *pb = s->pb;
151  AVStream *st = s->streams[0];
152  int64_t pos = avio_tell(pb);
153 
154  if (pos >= dsf->data_end)
155  return AVERROR_EOF;
156 
157  pkt->stream_index = 0;
158  if (dsf->data_size > dsf->audio_size) {
159  int last_packet = pos == (dsf->data_end - st->codecpar->block_align);
160 
161  if (last_packet) {
162  int64_t data_pos = pos - s->internal->data_offset;
163  int64_t packet_size = dsf->audio_size - data_pos;
164  int64_t skip_size = dsf->data_size - data_pos - packet_size;
165  uint8_t *dst;
166  int ch, ret;
167 
168  if (packet_size <= 0 || skip_size <= 0)
169  return AVERROR_INVALIDDATA;
170 
171  if (av_new_packet(pkt, packet_size) < 0)
172  return AVERROR(ENOMEM);
173  dst = pkt->data;
174  for (ch = 0; ch < st->codecpar->channels; ch++) {
175  ret = avio_read(pb, dst, packet_size / st->codecpar->channels);
176  if (ret < packet_size / st->codecpar->channels)
177  return AVERROR_EOF;
178 
179  dst += ret;
180  avio_skip(pb, skip_size / st->codecpar->channels);
181  }
182 
183  return 0;
184  }
185  }
186  return av_get_packet(pb, pkt, FFMIN(dsf->data_end - pos, st->codecpar->block_align));
187 }
188 
190  .name = "dsf",
191  .long_name = NULL_IF_CONFIG_SMALL("DSD Stream File (DSF)"),
192  .priv_data_size = sizeof(DSFContext),
197 };
AV_CH_LAYOUT_5POINT0_BACK
#define AV_CH_LAYOUT_5POINT0_BACK
Definition: channel_layout.h:97
AVFMT_NO_BYTE_SEEK
#define AVFMT_NO_BYTE_SEEK
Format does not allow seeking by bytes.
Definition: avformat.h:475
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:4480
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3953
AV_RL64
uint64_t_TMPL AV_RL64
Definition: bytestream.h:87
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:55
MKTAG
#define MKTAG(a, b, c, d)
Definition: common.h:366
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:85
ch
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
id3v2.h
AVPacket::data
uint8_t * data
Definition: avcodec.h:1477
ff_id3v2_read
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta, unsigned int max_search_size)
Read an ID3v2 tag, including supported extra metadata.
Definition: id3v2.c:1131
AVProbeData::buf_size
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:449
AV_CODEC_ID_DSD_MSBF_PLANAR
@ AV_CODEC_ID_DSD_MSBF_PLANAR
Definition: avcodec.h:641
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:458
AVCodecParameters::channels
int channels
Audio only.
Definition: avcodec.h:4063
ff_id3v2_parse_apic
int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
Create a stream for each APIC (attached picture) extracted from the ID3v2 header.
Definition: id3v2.c:1153
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:557
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:468
DSFContext::audio_size
uint64_t audio_size
Definition: dsfdec.c:29
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:86
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:94
DSFContext::data_size
uint64_t data_size
Definition: dsfdec.c:30
AVInputFormat
Definition: avformat.h:640
ID3v2ExtraMeta
Definition: id3v2.h:57
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:257
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:86
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:645
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:448
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
dsf_read_packet
static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: dsfdec.c:147
AVFormatContext
Format I/O context.
Definition: avformat.h:1342
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1017
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:530
NULL
#define NULL
Definition: coverity.c:32
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:446
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: avcodec.h:4067
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:769
AVIOContext
Bytestream IO Context.
Definition: avio.h:161
read_id3
static void read_id3(AVFormatContext *s, uint64_t id3pos)
Definition: dsfdec.c:51
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
AVIOContext::seekable
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:260
ID3v2_DEFAULT_MAGIC
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
Definition: id3v2.h:35
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:98
DSFContext
Definition: dsfdec.c:27
AVCodecParameters::block_align
int block_align
Audio only.
Definition: avcodec.h:4074
AV_CODEC_ID_DSD_LSBF_PLANAR
@ AV_CODEC_ID_DSD_LSBF_PLANAR
Definition: avcodec.h:640
uint8_t
uint8_t
Definition: audio_convert.c:194
av_get_packet
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:313
ret
ret
Definition: filter_design.txt:187
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
AVStream
Stream structure.
Definition: avformat.h:870
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:246
AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_SURROUND
Definition: channel_layout.h:89
avformat.h
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen_template.c:38
pkt
static AVPacket pkt
Definition: demuxing_decoding.c:54
AVIO_SEEKABLE_NORMAL
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
Definition: avio.h:40
DSFContext::data_end
uint64_t data_end
Definition: dsfdec.c:28
dsf_read_header
static int dsf_read_header(AVFormatContext *s)
Definition: dsfdec.c:65
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:647
AVPacket::stream_index
int stream_index
Definition: avcodec.h:1479
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:331
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:39
ff_dsf_demuxer
AVInputFormat ff_dsf_demuxer
Definition: dsfdec.c:189
dsf_probe
static int dsf_probe(const AVProbeData *p)
Definition: dsfdec.c:33
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: avcodec.h:3957
AVPacket
This structure stores compressed data.
Definition: avcodec.h:1454
ff_id3v2_free_extra_meta
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata.
Definition: id3v2.c:1137
AVCodecParameters::channel_layout
uint64_t channel_layout
Audio only.
Definition: avcodec.h:4059
avio_rl64
uint64_t avio_rl64(AVIOContext *s)
Definition: aviobuf.c:777
AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_4POINT0
Definition: channel_layout.h:91
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: avcodec.h:3986
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
ff_id3v2_parse_chapters
int ff_id3v2_parse_chapters(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
Create chapters for all CHAP tags found in the ID3v2 header.
Definition: id3v2.c:1193
dsf_channel_layout
static const uint64_t dsf_channel_layout[]
Definition: dsfdec.c:40