| 41 | #include "replaygain.h" |
| 42 | |
| 43 | static int ogm_chapter(AVFormatContext *as, const uint8_t *key, const uint8_t *val) |
| 44 | { |
| 45 | int i, cnum, h, m, s, ms, keylen = strlen(key); |
| 46 | AVChapter *chapter = NULL; |
| 47 | |
| 48 | if (keylen < 9 || av_strncasecmp(key, "CHAPTER", 7) || sscanf(key+7, "%03d", &cnum) != 1) |
| 49 | return 0; |
| 50 | |
| 51 | if (keylen <= 10) { |
| 52 | if (sscanf(val, "%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4) |
| 53 | return 0; |
| 54 | |
| 55 | avpriv_new_chapter(as, cnum, (AVRational) { 1, 1000 }, |
| 56 | ms + 1000 * (s + 60 * (m + 60 * h)), |
| 57 | AV_NOPTS_VALUE, NULL); |
| 58 | } else if (!av_strcasecmp(key + keylen - 4, "NAME")) { |
| 59 | for (i = 0; i < as->nb_chapters; i++) |
| 60 | if (as->chapters[i]->id == cnum) { |
| 61 | chapter = as->chapters[i]; |
| 62 | break; |
| 63 | } |
| 64 | if (!chapter) |
| 65 | return 0; |
| 66 | |
| 67 | av_dict_set(&chapter->metadata, "title", val, 0); |
| 68 | } else |
| 69 | return 0; |
| 70 | |
| 71 | return 1; |
| 72 | } |
| 73 | |
| 74 | int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st, |
| 75 | const uint8_t *buf, int size) |
no test coverage detected