Lines Matching defs:buf
71 static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
87 n = avio_read(pb, buf, read_request);
91 buf += n;
250 * @param[in] buf directory buffer
256 static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size)
258 const uint8_t *buf_end = buf + buf_size;
260 while(buf + 48 <= buf_end) {
264 if (ff_guidcmp(buf, ff_dir_entry_guid)) {
266 "remaining directory entries ignored\n", FF_ARG_GUID(buf));
269 dir_length = AV_RL16(buf + 16);
270 file_length = AV_RL64(buf + 24);
271 name_size = 2 * AV_RL32(buf + 32);
282 if (48 + (int64_t)name_size > buf_end - buf) {
286 first_sector = AV_RL32(buf + 40 + name_size);
287 depth = AV_RL32(buf + 44 + name_size);
290 name = buf + 40;
296 buf += dir_length;
301 #define wtvfile_open(s, buf, buf_size, filename) \
302 wtvfile_open2(s, buf, buf_size, filename, sizeof(filename))
381 return ff_guidcmp(p->buf, ff_wtv_guid) ? 0 : AVPROBE_SCORE_MAX;
388 static int filetime_to_iso8601(char *buf, int buf_size, int64_t value)
395 if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
404 static int crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
411 if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
420 static int oledate_to_iso8601(char *buf, int buf_size, int64_t value)
427 if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
463 char *buf;
471 buf = av_malloc(buf_size);
472 if (!buf)
476 snprintf(buf, buf_size, "%u", avio_rl32(pb));
478 avio_get_str16le(pb, length, buf, buf_size);
479 if (!strlen(buf)) {
480 av_free(buf);
484 strcpy(buf, avio_rl32(pb) ? "true" : "false");
489 if (filetime_to_iso8601(buf, buf_size, num) < 0) {
490 av_free(buf);
495 if (crazytime_to_iso8601(buf, buf_size, num) < 0) {
496 av_free(buf);
500 if (oledate_to_iso8601(buf, buf_size, num) < 0 ) {
501 av_free(buf);
505 snprintf(buf, buf_size, "%f", av_int2double(num));
507 snprintf(buf, buf_size, "%"PRIi64, num);
509 snprintf(buf, buf_size, "%u", avio_rl16(pb));
513 snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid));
516 av_freep(&buf);
519 av_freep(&buf);
525 av_dict_set(&s->metadata, key, buf, 0);
526 av_freep(&buf);
843 uint8_t buf[258];
844 const uint8_t *pbuf = buf;
855 buf_size = FFMIN(len - consumed, sizeof(buf));
856 avio_read(pb, buf, buf_size);
858 ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, NULL, 0, 0, NULL);