mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat/argo_asf: strip file extension from name
Only when the user hasn't manually specified one. Matches the original files more closely. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
This commit is contained in:
parent
a3a4591868
commit
d2f42b9be1
@ -329,10 +329,24 @@ static int argo_asf_write_header(AVFormatContext *s)
|
||||
fhdr.version_minor = (uint16_t)ctx->version_minor;
|
||||
fhdr.num_chunks = 1;
|
||||
fhdr.chunk_offset = ASF_FILE_HEADER_SIZE;
|
||||
if (ctx->name)
|
||||
/*
|
||||
* If the user specified a name, use it as is. Otherwise take the
|
||||
* basename and lop off the extension (if any).
|
||||
*/
|
||||
if (ctx->name) {
|
||||
strncpy(fhdr.name, ctx->name, sizeof(fhdr.name));
|
||||
} else {
|
||||
const char *start = av_basename(s->url);
|
||||
const char *end = strrchr(start, '.');
|
||||
size_t len;
|
||||
|
||||
if(end)
|
||||
len = end - start;
|
||||
else
|
||||
strncpy(fhdr.name, av_basename(s->url), sizeof(fhdr.name));
|
||||
len = strlen(start);
|
||||
|
||||
memcpy(fhdr.name, start, FFMIN(len, sizeof(fhdr.name)));
|
||||
}
|
||||
|
||||
chdr.num_blocks = 0;
|
||||
chdr.num_samples = ASF_SAMPLE_COUNT;
|
||||
|
Loading…
Reference in New Issue
Block a user