Mercurial > libavformat.hg
changeset 5630:ebd8a1cc25e0 libavformat
Support strn tag in avidec.
author | michael |
---|---|
date | Fri, 05 Feb 2010 12:16:59 +0000 |
parents | 4dc2cb60c431 |
children | 5f128b4359e7 |
files | avidec.c |
diffstat | 1 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/avidec.c Fri Feb 05 11:50:44 2010 +0000 +++ b/avidec.c Fri Feb 05 12:16:59 2010 +0000 @@ -227,7 +227,7 @@ } } -static int avi_read_tag(AVFormatContext *s, const char *key, unsigned int size) +static int avi_read_tag(AVFormatContext *s, AVStream *st, const char *key, unsigned int size) { ByteIOContext *pb = s->pb; char *value; @@ -239,8 +239,13 @@ value = av_malloc(size+1); if (!value) return -1; - get_strz(pb, value, size); + get_buffer(pb, value, size); + value[size]=0; + if(st) + return av_metadata_set2(&st->metadata, key, value, + AV_METADATA_DONT_STRDUP_VAL); + else return av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); } @@ -602,26 +607,31 @@ url_fseek(pb, size, SEEK_CUR); break; case MKTAG('I', 'N', 'A', 'M'): - avi_read_tag(s, "Title", size); + avi_read_tag(s, NULL, "Title", size); break; case MKTAG('I', 'A', 'R', 'T'): - avi_read_tag(s, "Artist", size); + avi_read_tag(s, NULL, "Artist", size); break; case MKTAG('I', 'C', 'O', 'P'): - avi_read_tag(s, "Copyright", size); + avi_read_tag(s, NULL, "Copyright", size); break; case MKTAG('I', 'C', 'M', 'T'): - avi_read_tag(s, "Comment", size); + avi_read_tag(s, NULL, "Comment", size); break; case MKTAG('I', 'G', 'N', 'R'): - avi_read_tag(s, "Genre", size); + avi_read_tag(s, NULL, "Genre", size); break; case MKTAG('I', 'P', 'R', 'D'): - avi_read_tag(s, "Album", size); + avi_read_tag(s, NULL, "Album", size); break; case MKTAG('I', 'P', 'R', 'T'): - avi_read_tag(s, "Track", size); + avi_read_tag(s, NULL, "Track", size); break; + case MKTAG('s', 't', 'r', 'n'): + if(s->nb_streams){ + avi_read_tag(s, s->streams[s->nb_streams-1], "Title", size); + break; + } default: if(size > 1000000){ av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "