On Mon, Mar 2, 2015 at 7:17 AM, Clément Bœsch <u...@pkh.me> wrote: > On Sun, Mar 01, 2015 at 01:30:54PM -0800, Mark Reid wrote: > > --- > > libavformat/avio.h | 6 ++++++ > > libavformat/aviobuf.c | 50 > +++++++++++++++++++++++++++----------------------- > > libavformat/version.h | 2 +- > > 3 files changed, 34 insertions(+), 24 deletions(-) > > > > diff --git a/libavformat/avio.h b/libavformat/avio.h > > index b9b4017..8fc7e27 100644 > > --- a/libavformat/avio.h > > +++ b/libavformat/avio.h > > @@ -234,6 +234,12 @@ int avio_put_str(AVIOContext *s, const char *str); > > int avio_put_str16le(AVIOContext *s, const char *str); > > > > /** > > + * Convert an UTF-8 string to UTF-16BE and write it. > > + * @return number of bytes written. > > + */ > > +int avio_put_str16be(AVIOContext *s, const char *str); > > + > > +/** > > * Passing this as the "whence" parameter to a seek function causes it > to > > * return the filesize without seeking anywhere. Supporting this is > optional. > > * If it is not supported then the seek function will return <0. > > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c > > index 8fd0466..8cb77b0 100644 > > --- a/libavformat/aviobuf.c > > +++ b/libavformat/aviobuf.c > > @@ -342,29 +342,33 @@ int avio_put_str(AVIOContext *s, const char *str) > > return len; > > } > > > > -int avio_put_str16le(AVIOContext *s, const char *str) > > -{ > > - const uint8_t *q = str; > > - int ret = 0; > > - int err = 0; > > - > > - while (*q) { > > - uint32_t ch; > > - uint16_t tmp; > > - > > - GET_UTF8(ch, *q++, goto invalid;) > > - PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;) > > - continue; > > -invalid: > > - av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in > avio_put_str16le\n"); > > - err = AVERROR(EINVAL); > > - } > > - avio_wl16(s, 0); > > - if (err) > > - return err; > > - ret += 2; > > - return ret; > > -} > > +#define PUT_STR16(type, write) \ > > + int avio_put_str16 ##type(AVIOContext *s, const char *str)\ > > +{\ > > + const uint8_t *q = str;\ > > + int ret = 0;\ > > + int err = 0;\ > > + while (*q) {\ > > + uint32_t ch;\ > > + uint16_t tmp;\ > > + GET_UTF8(ch, *q++, goto invalid;)\ > > + PUT_UTF16(ch, tmp, write(s, tmp); ret += 2;)\ > > + continue;\ > > +invalid:\ > > + av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in > avio_put_str16" #type "\n");\ > > + err = AVERROR(EINVAL);\ > > + }\ > > + write(s, 0);\ > > + if (err)\ > > + return err;\ > > + ret += 2;\ > > + return ret;\ > > +}\ > > + > > +PUT_STR16(le, avio_wl16) > > +PUT_STR16(be, avio_wb16) > > + > > +#undef PUT_STR16 > > > > static inline int put_str16(AVIOContext *s, const char *str, const int be) > { > const uint8_t *q = str; > int ret = 0; > int err = 0; > > while (*q) { > uint32_t ch; > uint16_t tmp; > > GET_UTF8(ch, *q++, goto invalid;) > PUT_UTF16(ch, tmp, be ? avio_wb16(s, tmp) > : avio_wl16(s, tmp); ret += 2;) > continue; > invalid: > av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16" > #type "\n"); > err = AVERROR(EINVAL); > } > if (be) avio_wb16(s, 0); > else avio_wl16(s, 0); > if (err) > return err; > ret += 2; > return ret; > } > > #define PUT_STR16(type, big_endian) \ > int avio_put_str16 ## type(AVIOContext *s, const char *str) \ > { \ > return put_str16(s, str, big_endian); \ > } > > PUT_STR16(le, 0) > PUT_STR16(be, 1) > > [...] > > Less macro messy that way, and smaller diff (untested). > > Thats much simpler, I'll send a new patch doing that. I will also add a entry to docs/APICHANGES.
For bumping the version am I suppose to reset the micro to 100? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel