Guest User

Untitled

a guest
Sep 7th, 2014
202
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static int load_textfile(AVFilterContext *ctx)
  2. {
  3.     DrawTextContext *s = ctx->priv;
  4.     int err;
  5.     uint8_t *textbuf;
  6.     uint8_t *tmp;
  7.     size_t textbuf_size;
  8.  
  9.     if ((err = av_file_map(s->textfile, &textbuf, &textbuf_size, 0, ctx)) < 0) {
  10.         av_log(ctx, AV_LOG_ERROR,
  11.                "The text file '%s' could not be read or is empty\n",
  12.                s->textfile);
  13.         return err;
  14.     }
  15.  
  16.     if (!(tmp = av_realloc(s->text, textbuf_size + 1))) {
  17.         av_file_unmap(textbuf, textbuf_size);
  18.         return AVERROR(ENOMEM);
  19.     }
  20.     s->text = tmp;
  21.     memcpy(s->text, textbuf, textbuf_size);
  22.     s->text[textbuf_size] = 0;
  23.     av_file_unmap(textbuf, textbuf_size);
  24.  
  25.     return 0;
  26. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×