Commit d7b32138 authored by diego's avatar diego

Merge get_str() and get_str8() functions.

patch by Ronald S. Bultje, rsbultje gmail com


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@9818 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 636982e4
...@@ -22,12 +22,11 @@ ...@@ -22,12 +22,11 @@
#include "rm.h" #include "rm.h"
#include "avstring.h" #include "avstring.h"
static void get_str(ByteIOContext *pb, char *buf, int buf_size) static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len)
{ {
int len, i; int i;
char *q, r; char *q, r;
len = get_be16(pb);
q = buf; q = buf;
for(i=0;i<len;i++) { for(i=0;i<len;i++) {
r = get_byte(pb); r = get_byte(pb);
...@@ -37,19 +36,14 @@ static void get_str(ByteIOContext *pb, char *buf, int buf_size) ...@@ -37,19 +36,14 @@ static void get_str(ByteIOContext *pb, char *buf, int buf_size)
if (buf_size > 0) *q = '\0'; if (buf_size > 0) *q = '\0';
} }
static void get_str8(ByteIOContext *pb, char *buf, int buf_size) static void get_str16(ByteIOContext *pb, char *buf, int buf_size)
{ {
int len, i; get_strl(pb, buf, buf_size, get_be16(pb));
char *q, r; }
len = get_byte(pb); static void get_str8(ByteIOContext *pb, char *buf, int buf_size)
q = buf; {
for(i=0;i<len;i++) { get_strl(pb, buf, buf_size, get_byte(pb));
r = get_byte(pb);
if (i < buf_size - 1)
*q++ = r;
}
if (buf_size > 0) *q = '\0';
} }
static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st, static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
...@@ -263,10 +257,10 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -263,10 +257,10 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
flags = get_be16(pb); /* flags */ flags = get_be16(pb); /* flags */
break; break;
case MKTAG('C', 'O', 'N', 'T'): case MKTAG('C', 'O', 'N', 'T'):
get_str(pb, s->title, sizeof(s->title)); get_str16(pb, s->title, sizeof(s->title));
get_str(pb, s->author, sizeof(s->author)); get_str16(pb, s->author, sizeof(s->author));
get_str(pb, s->copyright, sizeof(s->copyright)); get_str16(pb, s->copyright, sizeof(s->copyright));
get_str(pb, s->comment, sizeof(s->comment)); get_str16(pb, s->comment, sizeof(s->comment));
break; break;
case MKTAG('M', 'D', 'P', 'R'): case MKTAG('M', 'D', 'P', 'R'):
st = av_new_stream(s, 0); st = av_new_stream(s, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment