mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 03:59:43 +00:00
Use common macro PUT_UTF8 in asf.c
Patch by Zuxy Meng, % zuxy P meng A gmail P com % date: Nov 5, 2006 9:56 AM subject: [Ffmpeg-devel] PUT_UTF8 & asf format enhancement Originally committed as revision 7059 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
f32554fa62
commit
db5c43b4c7
@ -22,6 +22,7 @@
|
||||
#include "riff.h"
|
||||
#include "mpegaudio.h"
|
||||
#include "asf.h"
|
||||
#include "common.h"
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
@ -107,15 +108,11 @@ static void get_str16(ByteIOContext *pb, char *buf, int buf_size)
|
||||
|
||||
static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size)
|
||||
{
|
||||
int c;
|
||||
char *q;
|
||||
|
||||
q = buf;
|
||||
while (len > 0) {
|
||||
c = get_le16(pb);
|
||||
if ((q - buf) < buf_size - 1)
|
||||
*q++ = c;
|
||||
len-=2;
|
||||
char* q = buf;
|
||||
len /= 2;
|
||||
while (len--) {
|
||||
uint8_t tmp;
|
||||
PUT_UTF8(get_le16(pb), tmp, if (q - buf < buf_size - 1) *q++ = tmp;)
|
||||
}
|
||||
*q = '\0';
|
||||
}
|
||||
@ -361,14 +358,15 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
char *name, *value;
|
||||
|
||||
name_len = get_le16(pb);
|
||||
name = (char *)av_mallocz(name_len);
|
||||
get_str16_nolen(pb, name_len, name, name_len);
|
||||
name = (char *)av_malloc(name_len * 2);
|
||||
get_str16_nolen(pb, name_len, name, name_len * 2);
|
||||
value_type = get_le16(pb);
|
||||
value_len = get_le16(pb);
|
||||
if ((value_type == 0) || (value_type == 1)) // unicode or byte
|
||||
{
|
||||
value = (char *)av_mallocz(value_len);
|
||||
get_str16_nolen(pb, value_len, value, value_len);
|
||||
value = (char *)av_malloc(value_len * 2);
|
||||
get_str16_nolen(pb, value_len, value,
|
||||
value_len * 2);
|
||||
if (strcmp(name,"WM/AlbumTitle")==0) { pstrcpy(s->album, sizeof(s->album), value); }
|
||||
av_free(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user