~ppsspp/ppsspp/ffmpeg

« back to all changes in this revision

Viewing changes to libavcodec/vorbis_parser.c

  • Committer: Henrik Rydgård
  • Date: 2014-01-03 10:44:32 UTC
  • Revision ID: git-v1:87c6c126784b1718bfa448ecf2e6a9fef781eb4e
Update our ffmpeg snapshot to a clone of the official repository.

This is because Maxim's at3plus support has been officially merged!

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
    return 0;
202
202
}
203
203
 
204
 
int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
205
 
                              int buf_size)
 
204
int avpriv_vorbis_parse_frame_flags(VorbisParseContext *s, const uint8_t *buf,
 
205
                                    int buf_size, int *flags)
206
206
{
207
207
    int duration = 0;
208
208
 
211
211
        int previous_blocksize = s->previous_blocksize;
212
212
 
213
213
        if (buf[0] & 1) {
 
214
            /* If the user doesn't care about special packets, it's a bad one. */
 
215
            if (!flags)
 
216
                goto bad_packet;
 
217
 
 
218
            /* Set the flag for which kind of special packet it is. */
 
219
            if (buf[0] == 1)
 
220
                *flags |= VORBIS_FLAG_HEADER;
 
221
            else if (buf[0] == 3)
 
222
                *flags |= VORBIS_FLAG_COMMENT;
 
223
            else
 
224
                goto bad_packet;
 
225
 
 
226
            /* Special packets have no duration. */
 
227
            return 0;
 
228
 
 
229
bad_packet:
214
230
            av_log(s->avctx, AV_LOG_ERROR, "Invalid packet\n");
215
231
            return AVERROR_INVALIDDATA;
216
232
        }
234
250
    return duration;
235
251
}
236
252
 
 
253
int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
 
254
                              int buf_size)
 
255
{
 
256
    return avpriv_vorbis_parse_frame_flags(s, buf, buf_size, NULL);
 
257
}
 
258
 
237
259
void avpriv_vorbis_parse_reset(VorbisParseContext *s)
238
260
{
239
261
    if (s->valid_extradata)