71 |
71 |
{
|
72 |
72 |
int stream_idx;
|
73 |
73 |
AVStream * stream;
|
74 |
|
AVCodec * codec;
|
|
74 |
const AVCodec * codec;
|
75 |
75 |
}
|
76 |
76 |
CodecInfo;
|
77 |
77 |
|
... | ... | |
267 |
267 |
return f ? * f : nullptr;
|
268 |
268 |
}
|
269 |
269 |
|
270 |
|
static AVInputFormat * get_format_by_content (const char * name, VFSFile & file)
|
|
270 |
static const AVInputFormat * get_format_by_content (const char * name, VFSFile & file)
|
271 |
271 |
{
|
272 |
272 |
AUDDBG ("Probing content: %s\n", name);
|
273 |
273 |
|
274 |
|
AVInputFormat * f = nullptr;
|
|
274 |
const AVInputFormat * f = nullptr;
|
275 |
275 |
|
276 |
276 |
unsigned char buf[16384 + AVPROBE_PADDING_SIZE];
|
277 |
277 |
int size = 16;
|
... | ... | |
311 |
311 |
return f;
|
312 |
312 |
}
|
313 |
313 |
|
314 |
|
static AVInputFormat * get_format (const char * name, VFSFile & file)
|
|
314 |
static const AVInputFormat * get_format (const char * name, VFSFile & file)
|
315 |
315 |
{
|
316 |
|
AVInputFormat * f = get_format_by_extension (name);
|
|
316 |
const AVInputFormat * f = get_format_by_extension (name);
|
317 |
317 |
return f ? f : get_format_by_content (name, file);
|
318 |
318 |
}
|
319 |
319 |
|
320 |
320 |
static AVFormatContext * open_input_file (const char * name, VFSFile & file)
|
321 |
321 |
{
|
322 |
|
AVInputFormat * f = get_format (name, file);
|
|
322 |
const AVInputFormat * f = get_format (name, file);
|
323 |
323 |
|
324 |
324 |
if (! f)
|
325 |
325 |
{
|
... | ... | |
331 |
331 |
AVIOContext * io = io_context_new (file);
|
332 |
332 |
c->pb = io;
|
333 |
333 |
|
334 |
|
if (LOG (avformat_open_input, & c, name, f, nullptr) < 0)
|
|
334 |
if (LOG (avformat_open_input, & c, name, (AVInputFormat *) f, nullptr) < 0)
|
335 |
335 |
{
|
336 |
336 |
io_context_free (io);
|
337 |
337 |
return nullptr;
|
... | ... | |
361 |
361 |
#endif
|
362 |
362 |
if (stream && stream->codecpar && stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
363 |
363 |
{
|
364 |
|
AVCodec * codec = avcodec_find_decoder (stream->codecpar->codec_id);
|
|
364 |
const AVCodec * codec = avcodec_find_decoder (stream->codecpar->codec_id);
|
365 |
365 |
|
366 |
366 |
if (codec)
|
367 |
367 |
{
|