MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / parse_frame_header

Function parse_frame_header

libavcodec/dca_core.c:85–151  ·  view source on GitHub ↗

5.3.1 - Bit stream header

Source from the content-addressed store, hash-verified

83
84// 5.3.1 - Bit stream header
85static int parse_frame_header(DCACoreDecoder *s)
86{
87 DCACoreFrameHeader h = { 0 };
88 int err = ff_dca_parse_core_frame_header(&h, &s->gb);
89
90 if (err < 0) {
91 switch (err) {
92 case DCA_PARSE_ERROR_DEFICIT_SAMPLES:
93 av_log(s->avctx, AV_LOG_ERROR, "Deficit samples are not supported\n");
94 return h.normal_frame ? AVERROR_INVALIDDATA : AVERROR_PATCHWELCOME;
95
96 case DCA_PARSE_ERROR_PCM_BLOCKS:
97 av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of PCM sample blocks (%d)\n", h.npcmblocks);
98 return (h.npcmblocks < 6 || h.normal_frame) ? AVERROR_INVALIDDATA : AVERROR_PATCHWELCOME;
99
100 case DCA_PARSE_ERROR_FRAME_SIZE:
101 av_log(s->avctx, AV_LOG_ERROR, "Invalid core frame size (%d bytes)\n", h.frame_size);
102 return AVERROR_INVALIDDATA;
103
104 case DCA_PARSE_ERROR_AMODE:
105 av_log(s->avctx, AV_LOG_ERROR, "Unsupported audio channel arrangement (%d)\n", h.audio_mode);
106 return AVERROR_PATCHWELCOME;
107
108 case DCA_PARSE_ERROR_SAMPLE_RATE:
109 av_log(s->avctx, AV_LOG_ERROR, "Invalid core audio sampling frequency\n");
110 return AVERROR_INVALIDDATA;
111
112 case DCA_PARSE_ERROR_RESERVED_BIT:
113 av_log(s->avctx, AV_LOG_ERROR, "Reserved bit set\n");
114 return AVERROR_INVALIDDATA;
115
116 case DCA_PARSE_ERROR_LFE_FLAG:
117 av_log(s->avctx, AV_LOG_ERROR, "Invalid low frequency effects flag\n");
118 return AVERROR_INVALIDDATA;
119
120 case DCA_PARSE_ERROR_PCM_RES:
121 av_log(s->avctx, AV_LOG_ERROR, "Invalid source PCM resolution\n");
122 return AVERROR_INVALIDDATA;
123
124 default:
125 av_log(s->avctx, AV_LOG_ERROR, "Unknown core frame header error\n");
126 return AVERROR_INVALIDDATA;
127 }
128 }
129
130 s->crc_present = h.crc_present;
131 s->npcmblocks = h.npcmblocks;
132 s->frame_size = h.frame_size;
133 s->audio_mode = h.audio_mode;
134 s->sample_rate = ff_dca_sample_rates[h.sr_code];
135 s->bit_rate = ff_dca_bit_rates[h.br_code];
136 s->drc_present = h.drc_present;
137 s->ts_present = h.ts_present;
138 s->aux_present = h.aux_present;
139 s->ext_audio_type = h.ext_audio_type;
140 s->ext_audio_present = h.ext_audio_present;
141 s->sync_ssf = h.sync_ssf;
142 s->lfe_present = h.lfe_present;

Callers 1

ff_dca_core_parseFunction · 0.70

Calls 2

av_logFunction · 0.85

Tested by

no test coverage detected