You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

615 lines
18KB

  1. /*
  2. * MP3 demuxer
  3. * Copyright (c) 2003 Fabrice Bellard
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "libavutil/opt.h"
  22. #include "libavutil/avstring.h"
  23. #include "libavutil/intreadwrite.h"
  24. #include "libavutil/crc.h"
  25. #include "libavutil/dict.h"
  26. #include "libavutil/mathematics.h"
  27. #include "avformat.h"
  28. #include "internal.h"
  29. #include "avio_internal.h"
  30. #include "id3v2.h"
  31. #include "id3v1.h"
  32. #include "replaygain.h"
  33. #include "libavcodec/avcodec.h"
  34. #include "libavcodec/mpegaudiodecheader.h"
  35. #define XING_FLAG_FRAMES 0x01
  36. #define XING_FLAG_SIZE 0x02
  37. #define XING_FLAG_TOC 0x04
  38. #define XING_FLAC_QSCALE 0x08
  39. #define XING_TOC_COUNT 100
  40. typedef struct {
  41. AVClass *class;
  42. int64_t filesize;
  43. int xing_toc;
  44. int start_pad;
  45. int end_pad;
  46. int usetoc;
  47. unsigned frames; /* Total number of frames in file */
  48. unsigned header_filesize; /* Total number of bytes in the stream */
  49. int is_cbr;
  50. } MP3DecContext;
  51. enum CheckRet {
  52. CHECK_WRONG_HEADER = -1,
  53. CHECK_SEEK_FAILED = -2,
  54. };
  55. static int check(AVIOContext *pb, int64_t pos, uint32_t *header);
  56. /* mp3 read */
  57. static int mp3_read_probe(const AVProbeData *p)
  58. {
  59. int max_frames, first_frames = 0;
  60. int whole_used = 0;
  61. int frames, ret;
  62. int framesizes, max_framesizes;
  63. uint32_t header;
  64. const uint8_t *buf, *buf0, *buf2, *buf3, *end;
  65. buf0 = p->buf;
  66. end = p->buf + p->buf_size - sizeof(uint32_t);
  67. while (buf0 < end && !*buf0)
  68. buf0++;
  69. max_frames = 0;
  70. max_framesizes = 0;
  71. buf = buf0;
  72. for (; buf < end; buf = buf2+1) {
  73. buf2 = buf;
  74. for (framesizes = frames = 0; buf2 < end; frames++) {
  75. MPADecodeHeader h;
  76. int header_emu = 0;
  77. header = AV_RB32(buf2);
  78. ret = avpriv_mpegaudio_decode_header(&h, header);
  79. if (ret != 0 || end - buf2 < h.frame_size)
  80. break;
  81. for (buf3 = buf2 + 4; buf3 < buf2 + h.frame_size; buf3++) {
  82. uint32_t next_sync = AV_RB32(buf3);
  83. header_emu += (next_sync & MP3_MASK) == (header & MP3_MASK);
  84. }
  85. if (header_emu > 2)
  86. break;
  87. buf2 += h.frame_size;
  88. framesizes += h.frame_size;
  89. }
  90. max_frames = FFMAX(max_frames, frames);
  91. max_framesizes = FFMAX(max_framesizes, framesizes);
  92. if (buf == buf0) {
  93. first_frames= frames;
  94. if (buf2 == end + sizeof(uint32_t))
  95. whole_used = 1;
  96. }
  97. }
  98. // keep this in sync with ac3 probe, both need to avoid
  99. // issues with MPEG-files!
  100. if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
  101. else if (max_frames>200 && p->buf_size < 2*max_framesizes)return AVPROBE_SCORE_EXTENSION;
  102. else if (max_frames>=4 && p->buf_size < 2*max_framesizes) return AVPROBE_SCORE_EXTENSION / 2;
  103. else if (ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size)
  104. return p->buf_size < PROBE_BUF_MAX ? AVPROBE_SCORE_EXTENSION / 4 : AVPROBE_SCORE_EXTENSION - 2;
  105. else if (first_frames > 1 && whole_used) return 5;
  106. else if (max_frames>=1 && p->buf_size < 10*max_framesizes) return 1;
  107. else return 0;
  108. //mpegps_mp3_unrecognized_format.mpg has max_frames=3
  109. }
  110. static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration)
  111. {
  112. int i;
  113. MP3DecContext *mp3 = s->priv_data;
  114. int fast_seek = s->flags & AVFMT_FLAG_FAST_SEEK;
  115. int fill_index = (mp3->usetoc || fast_seek) && duration > 0;
  116. if (!filesize &&
  117. !(filesize = avio_size(s->pb))) {
  118. av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n");
  119. fill_index = 0;
  120. }
  121. for (i = 0; i < XING_TOC_COUNT; i++) {
  122. uint8_t b = avio_r8(s->pb);
  123. if (fill_index)
  124. av_add_index_entry(s->streams[0],
  125. av_rescale(b, filesize, 256),
  126. av_rescale(i, duration, XING_TOC_COUNT),
  127. 0, 0, AVINDEX_KEYFRAME);
  128. }
  129. if (fill_index)
  130. mp3->xing_toc = 1;
  131. }
  132. static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
  133. MPADecodeHeader *c, uint32_t spf)
  134. {
  135. #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1))
  136. #define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m) + 1))
  137. uint16_t crc;
  138. uint32_t v;
  139. char version[10];
  140. uint32_t peak = 0;
  141. int32_t r_gain = INT32_MIN, a_gain = INT32_MIN;
  142. MP3DecContext *mp3 = s->priv_data;
  143. static const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
  144. uint64_t fsize = avio_size(s->pb);
  145. fsize = fsize >= avio_tell(s->pb) ? fsize - avio_tell(s->pb) : 0;
  146. /* Check for Xing / Info tag */
  147. avio_skip(s->pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]);
  148. v = avio_rb32(s->pb);
  149. mp3->is_cbr = v == MKBETAG('I', 'n', 'f', 'o');
  150. if (v != MKBETAG('X', 'i', 'n', 'g') && !mp3->is_cbr)
  151. return;
  152. v = avio_rb32(s->pb);
  153. if (v & XING_FLAG_FRAMES)
  154. mp3->frames = avio_rb32(s->pb);
  155. if (v & XING_FLAG_SIZE)
  156. mp3->header_filesize = avio_rb32(s->pb);
  157. if (fsize && mp3->header_filesize) {
  158. uint64_t min, delta;
  159. min = FFMIN(fsize, mp3->header_filesize);
  160. delta = FFMAX(fsize, mp3->header_filesize) - min;
  161. if (fsize > mp3->header_filesize && delta > min >> 4) {
  162. mp3->frames = 0;
  163. av_log(s, AV_LOG_WARNING,
  164. "invalid concatenated file detected - using bitrate for duration\n");
  165. } else if (delta > min >> 4) {
  166. av_log(s, AV_LOG_WARNING,
  167. "filesize and duration do not match (growing file?)\n");
  168. }
  169. }
  170. if (v & XING_FLAG_TOC)
  171. read_xing_toc(s, mp3->header_filesize, av_rescale_q(mp3->frames,
  172. (AVRational){spf, c->sample_rate},
  173. st->time_base));
  174. /* VBR quality */
  175. if (v & XING_FLAC_QSCALE)
  176. avio_rb32(s->pb);
  177. /* Encoder short version string */
  178. memset(version, 0, sizeof(version));
  179. avio_read(s->pb, version, 9);
  180. /* Info Tag revision + VBR method */
  181. avio_r8(s->pb);
  182. /* Lowpass filter value */
  183. avio_r8(s->pb);
  184. /* ReplayGain peak */
  185. v = avio_rb32(s->pb);
  186. peak = av_rescale(v, 100000, 1 << 23);
  187. /* Radio ReplayGain */
  188. v = avio_rb16(s->pb);
  189. if (MIDDLE_BITS(v, 13, 15) == 1) {
  190. r_gain = MIDDLE_BITS(v, 0, 8) * 10000;
  191. if (v & (1 << 9))
  192. r_gain *= -1;
  193. }
  194. /* Audiophile ReplayGain */
  195. v = avio_rb16(s->pb);
  196. if (MIDDLE_BITS(v, 13, 15) == 2) {
  197. a_gain = MIDDLE_BITS(v, 0, 8) * 10000;
  198. if (v & (1 << 9))
  199. a_gain *= -1;
  200. }
  201. /* Encoding flags + ATH Type */
  202. avio_r8(s->pb);
  203. /* if ABR {specified bitrate} else {minimal bitrate} */
  204. avio_r8(s->pb);
  205. /* Encoder delays */
  206. v = avio_rb24(s->pb);
  207. if (AV_RB32(version) == MKBETAG('L', 'A', 'M', 'E')
  208. || AV_RB32(version) == MKBETAG('L', 'a', 'v', 'f')
  209. || AV_RB32(version) == MKBETAG('L', 'a', 'v', 'c')
  210. ) {
  211. mp3->start_pad = v>>12;
  212. mp3-> end_pad = v&4095;
  213. st->start_skip_samples = mp3->start_pad + 528 + 1;
  214. if (mp3->frames) {
  215. st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf;
  216. st->last_discard_sample = mp3->frames * (int64_t)spf;
  217. }
  218. if (!st->start_time)
  219. st->start_time = av_rescale_q(st->start_skip_samples,
  220. (AVRational){1, c->sample_rate},
  221. st->time_base);
  222. av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad);
  223. }
  224. /* Misc */
  225. avio_r8(s->pb);
  226. /* MP3 gain */
  227. avio_r8(s->pb);
  228. /* Preset and surround info */
  229. avio_rb16(s->pb);
  230. /* Music length */
  231. avio_rb32(s->pb);
  232. /* Music CRC */
  233. avio_rb16(s->pb);
  234. /* Info Tag CRC */
  235. crc = ffio_get_checksum(s->pb);
  236. v = avio_rb16(s->pb);
  237. if (v == crc) {
  238. ff_replaygain_export_raw(st, r_gain, peak, a_gain, 0);
  239. av_dict_set(&st->metadata, "encoder", version, 0);
  240. }
  241. }
  242. static void mp3_parse_vbri_tag(AVFormatContext *s, AVStream *st, int64_t base)
  243. {
  244. uint32_t v;
  245. MP3DecContext *mp3 = s->priv_data;
  246. /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
  247. avio_seek(s->pb, base + 4 + 32, SEEK_SET);
  248. v = avio_rb32(s->pb);
  249. if (v == MKBETAG('V', 'B', 'R', 'I')) {
  250. /* Check tag version */
  251. if (avio_rb16(s->pb) == 1) {
  252. /* skip delay and quality */
  253. avio_skip(s->pb, 4);
  254. mp3->header_filesize = avio_rb32(s->pb);
  255. mp3->frames = avio_rb32(s->pb);
  256. }
  257. }
  258. }
  259. /**
  260. * Try to find Xing/Info/VBRI tags and compute duration from info therein
  261. */
  262. static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
  263. {
  264. uint32_t v, spf;
  265. MPADecodeHeader c;
  266. int vbrtag_size = 0;
  267. MP3DecContext *mp3 = s->priv_data;
  268. int ret;
  269. ffio_init_checksum(s->pb, ff_crcA001_update, 0);
  270. v = avio_rb32(s->pb);
  271. ret = avpriv_mpegaudio_decode_header(&c, v);
  272. if (ret < 0)
  273. return ret;
  274. else if (ret == 0)
  275. vbrtag_size = c.frame_size;
  276. if (c.layer != 3)
  277. return -1;
  278. spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
  279. mp3->frames = 0;
  280. mp3->header_filesize = 0;
  281. mp3_parse_info_tag(s, st, &c, spf);
  282. mp3_parse_vbri_tag(s, st, base);
  283. if (!mp3->frames && !mp3->header_filesize)
  284. return -1;
  285. /* Skip the vbr tag frame */
  286. avio_seek(s->pb, base + vbrtag_size, SEEK_SET);
  287. if (mp3->frames)
  288. st->duration = av_rescale_q(mp3->frames, (AVRational){spf, c.sample_rate},
  289. st->time_base);
  290. if (mp3->header_filesize && mp3->frames && !mp3->is_cbr)
  291. st->codecpar->bit_rate = av_rescale(mp3->header_filesize, 8 * c.sample_rate, mp3->frames * (int64_t)spf);
  292. return 0;
  293. }
  294. static int mp3_read_header(AVFormatContext *s)
  295. {
  296. MP3DecContext *mp3 = s->priv_data;
  297. AVStream *st;
  298. int64_t off;
  299. int ret;
  300. int i;
  301. s->metadata = s->internal->id3v2_meta;
  302. s->internal->id3v2_meta = NULL;
  303. st = avformat_new_stream(s, NULL);
  304. if (!st)
  305. return AVERROR(ENOMEM);
  306. st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
  307. st->codecpar->codec_id = AV_CODEC_ID_MP3;
  308. st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
  309. st->start_time = 0;
  310. // lcm of all mp3 sample rates
  311. avpriv_set_pts_info(st, 64, 1, 14112000);
  312. s->pb->maxsize = -1;
  313. off = avio_tell(s->pb);
  314. if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
  315. ff_id3v1_read(s);
  316. if (s->pb->seekable & AVIO_SEEKABLE_NORMAL)
  317. mp3->filesize = avio_size(s->pb);
  318. if (mp3_parse_vbr_tags(s, st, off) < 0)
  319. avio_seek(s->pb, off, SEEK_SET);
  320. ret = ff_replaygain_export(st, s->metadata);
  321. if (ret < 0)
  322. return ret;
  323. off = avio_tell(s->pb);
  324. for (i = 0; i < 64 * 1024; i++) {
  325. uint32_t header, header2;
  326. int frame_size;
  327. if (!(i&1023))
  328. ffio_ensure_seekback(s->pb, i + 1024 + 4);
  329. frame_size = check(s->pb, off + i, &header);
  330. if (frame_size > 0) {
  331. ret = avio_seek(s->pb, off, SEEK_SET);
  332. if (ret < 0)
  333. return ret;
  334. ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4);
  335. ret = check(s->pb, off + i + frame_size, &header2);
  336. if (ret >= 0 &&
  337. (header & MP3_MASK) == (header2 & MP3_MASK))
  338. {
  339. av_log(s, i > 0 ? AV_LOG_INFO : AV_LOG_VERBOSE, "Skipping %d bytes of junk at %"PRId64".\n", i, off);
  340. ret = avio_seek(s->pb, off + i, SEEK_SET);
  341. if (ret < 0)
  342. return ret;
  343. break;
  344. } else if (ret == CHECK_SEEK_FAILED) {
  345. av_log(s, AV_LOG_ERROR, "Invalid frame size (%d): Could not seek to %"PRId64".\n", frame_size, off + i + frame_size);
  346. return AVERROR(EINVAL);
  347. }
  348. } else if (frame_size == CHECK_SEEK_FAILED) {
  349. av_log(s, AV_LOG_ERROR, "Failed to read frame size: Could not seek to %"PRId64".\n", (int64_t) (i + 1024 + frame_size + 4));
  350. return AVERROR(EINVAL);
  351. }
  352. ret = avio_seek(s->pb, off, SEEK_SET);
  353. if (ret < 0)
  354. return ret;
  355. }
  356. // the seek index is relative to the end of the xing vbr headers
  357. for (i = 0; i < st->nb_index_entries; i++)
  358. st->index_entries[i].pos += avio_tell(s->pb);
  359. /* the parameters will be extracted from the compressed bitstream */
  360. return 0;
  361. }
  362. #define MP3_PACKET_SIZE 1024
  363. static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
  364. {
  365. MP3DecContext *mp3 = s->priv_data;
  366. int ret, size;
  367. int64_t pos;
  368. size = MP3_PACKET_SIZE;
  369. pos = avio_tell(s->pb);
  370. if (mp3->filesize > ID3v1_TAG_SIZE && pos < mp3->filesize)
  371. size= FFMIN(size, mp3->filesize - pos);
  372. ret = av_get_packet(s->pb, pkt, size);
  373. if (ret <= 0) {
  374. if(ret<0)
  375. return ret;
  376. return AVERROR_EOF;
  377. }
  378. pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
  379. pkt->stream_index = 0;
  380. return ret;
  381. }
  382. #define SEEK_WINDOW 4096
  383. static int check(AVIOContext *pb, int64_t pos, uint32_t *ret_header)
  384. {
  385. int64_t ret = avio_seek(pb, pos, SEEK_SET);
  386. uint8_t header_buf[4];
  387. unsigned header;
  388. MPADecodeHeader sd;
  389. if (ret < 0)
  390. return CHECK_SEEK_FAILED;
  391. ret = avio_read(pb, &header_buf[0], 4);
  392. /* We should always find four bytes for a valid mpa header. */
  393. if (ret < 4)
  394. return CHECK_SEEK_FAILED;
  395. header = AV_RB32(&header_buf[0]);
  396. if (ff_mpa_check_header(header) < 0)
  397. return CHECK_WRONG_HEADER;
  398. if (avpriv_mpegaudio_decode_header(&sd, header) == 1)
  399. return CHECK_WRONG_HEADER;
  400. if (ret_header)
  401. *ret_header = header;
  402. return sd.frame_size;
  403. }
  404. static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags)
  405. {
  406. int dir = (flags&AVSEEK_FLAG_BACKWARD) ? -1 : 1;
  407. int64_t best_pos;
  408. int best_score, i, j;
  409. int64_t ret;
  410. avio_seek(s->pb, FFMAX(target_pos - SEEK_WINDOW, 0), SEEK_SET);
  411. ret = avio_seek(s->pb, target_pos, SEEK_SET);
  412. if (ret < 0)
  413. return ret;
  414. #define MIN_VALID 3
  415. best_pos = target_pos;
  416. best_score = 999;
  417. for (i = 0; i < SEEK_WINDOW; i++) {
  418. int64_t pos = target_pos + (dir > 0 ? i - SEEK_WINDOW/4 : -i);
  419. int64_t candidate = -1;
  420. int score = 999;
  421. if (pos < 0)
  422. continue;
  423. for (j = 0; j < MIN_VALID; j++) {
  424. ret = check(s->pb, pos, NULL);
  425. if (ret < 0) {
  426. if (ret == CHECK_WRONG_HEADER) {
  427. break;
  428. } else if (ret == CHECK_SEEK_FAILED) {
  429. av_log(s, AV_LOG_ERROR, "Could not seek to %"PRId64".\n", pos);
  430. return AVERROR(EINVAL);
  431. }
  432. }
  433. if ((target_pos - pos)*dir <= 0 && FFABS(MIN_VALID/2-j) < score) {
  434. candidate = pos;
  435. score = FFABS(MIN_VALID/2-j);
  436. }
  437. pos += ret;
  438. }
  439. if (best_score > score && j == MIN_VALID) {
  440. best_pos = candidate;
  441. best_score = score;
  442. if(score == 0)
  443. break;
  444. }
  445. }
  446. return avio_seek(s->pb, best_pos, SEEK_SET);
  447. }
  448. static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
  449. int flags)
  450. {
  451. MP3DecContext *mp3 = s->priv_data;
  452. AVIndexEntry *ie, ie1;
  453. AVStream *st = s->streams[0];
  454. int64_t best_pos;
  455. int fast_seek = s->flags & AVFMT_FLAG_FAST_SEEK;
  456. int64_t filesize = mp3->header_filesize;
  457. if (filesize <= 0) {
  458. int64_t size = avio_size(s->pb);
  459. if (size > 0 && size > s->internal->data_offset)
  460. filesize = size - s->internal->data_offset;
  461. }
  462. if (mp3->xing_toc && (mp3->usetoc || (fast_seek && !mp3->is_cbr))) {
  463. int64_t ret = av_index_search_timestamp(st, timestamp, flags);
  464. // NOTE: The MP3 TOC is not a precise lookup table. Accuracy is worse
  465. // for bigger files.
  466. av_log(s, AV_LOG_WARNING, "Using MP3 TOC to seek; may be imprecise.\n");
  467. if (ret < 0)
  468. return ret;
  469. ie = &st->index_entries[ret];
  470. } else if (fast_seek && st->duration > 0 && filesize > 0) {
  471. if (!mp3->is_cbr)
  472. av_log(s, AV_LOG_WARNING, "Using scaling to seek VBR MP3; may be imprecise.\n");
  473. ie = &ie1;
  474. timestamp = av_clip64(timestamp, 0, st->duration);
  475. ie->timestamp = timestamp;
  476. ie->pos = av_rescale(timestamp, filesize, st->duration) + s->internal->data_offset;
  477. } else {
  478. return -1; // generic index code
  479. }
  480. best_pos = mp3_sync(s, ie->pos, flags);
  481. if (best_pos < 0)
  482. return best_pos;
  483. if (mp3->is_cbr && ie == &ie1 && mp3->frames) {
  484. int frame_duration = av_rescale(st->duration, 1, mp3->frames);
  485. ie1.timestamp = frame_duration * av_rescale(best_pos - s->internal->data_offset, mp3->frames, mp3->header_filesize);
  486. }
  487. ff_update_cur_dts(s, st, ie->timestamp);
  488. return 0;
  489. }
  490. static const AVOption options[] = {
  491. { "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM},
  492. { NULL },
  493. };
  494. static const AVClass demuxer_class = {
  495. .class_name = "mp3",
  496. .item_name = av_default_item_name,
  497. .option = options,
  498. .version = LIBAVUTIL_VERSION_INT,
  499. .category = AV_CLASS_CATEGORY_DEMUXER,
  500. };
  501. AVInputFormat ff_mp3_demuxer = {
  502. .name = "mp3",
  503. .long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"),
  504. .read_probe = mp3_read_probe,
  505. .read_header = mp3_read_header,
  506. .read_packet = mp3_read_packet,
  507. .read_seek = mp3_seek,
  508. .priv_data_size = sizeof(MP3DecContext),
  509. .flags = AVFMT_GENERIC_INDEX,
  510. .extensions = "mp2,mp3,m2a,mpa", /* XXX: use probe */
  511. .priv_class = &demuxer_class,
  512. };