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.

639 lines
20KB

  1. /*
  2. * General DV demuxer
  3. * Copyright (c) 2003 Roman Shaposhnik
  4. *
  5. * Many thanks to Dan Dennedy <dan@dennedy.org> for providing wealth
  6. * of DV technical info.
  7. *
  8. * Raw DV format
  9. * Copyright (c) 2002 Fabrice Bellard
  10. *
  11. * 50 Mbps (DVCPRO50) and 100 Mbps (DVCPRO HD) support
  12. * Copyright (c) 2006 Daniel Maas <dmaas@maasdigital.com>
  13. * Funded by BBC Research & Development
  14. *
  15. * This file is part of FFmpeg.
  16. *
  17. * FFmpeg is free software; you can redistribute it and/or
  18. * modify it under the terms of the GNU Lesser General Public
  19. * License as published by the Free Software Foundation; either
  20. * version 2.1 of the License, or (at your option) any later version.
  21. *
  22. * FFmpeg is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  25. * Lesser General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU Lesser General Public
  28. * License along with FFmpeg; if not, write to the Free Software
  29. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  30. */
  31. #include <time.h>
  32. #include "avformat.h"
  33. #include "internal.h"
  34. #include "libavcodec/dv_profile.h"
  35. #include "libavcodec/dv.h"
  36. #include "libavutil/channel_layout.h"
  37. #include "libavutil/intreadwrite.h"
  38. #include "libavutil/mathematics.h"
  39. #include "libavutil/timecode.h"
  40. #include "dv.h"
  41. #include "libavutil/avassert.h"
  42. struct DVDemuxContext {
  43. const AVDVProfile* sys; /* Current DV profile. E.g.: 525/60, 625/50 */
  44. AVFormatContext* fctx;
  45. AVStream* vst;
  46. AVStream* ast[4];
  47. AVPacket audio_pkt[4];
  48. uint8_t audio_buf[4][8192];
  49. int ach;
  50. int frames;
  51. uint64_t abytes;
  52. };
  53. static inline uint16_t dv_audio_12to16(uint16_t sample)
  54. {
  55. uint16_t shift, result;
  56. sample = (sample < 0x800) ? sample : sample | 0xf000;
  57. shift = (sample & 0xf00) >> 8;
  58. if (shift < 0x2 || shift > 0xd) {
  59. result = sample;
  60. } else if (shift < 0x8) {
  61. shift--;
  62. result = (sample - (256 * shift)) << shift;
  63. } else {
  64. shift = 0xe - shift;
  65. result = ((sample + ((256 * shift) + 1)) << shift) - 1;
  66. }
  67. return result;
  68. }
  69. static const uint8_t *dv_extract_pack(const uint8_t *frame, enum dv_pack_type t)
  70. {
  71. int offs;
  72. int c;
  73. for (c = 0; c < 10; c++) {
  74. switch (t) {
  75. case dv_audio_source:
  76. if (c&1) offs = (80 * 6 + 80 * 16 * 0 + 3 + c*12000);
  77. else offs = (80 * 6 + 80 * 16 * 3 + 3 + c*12000);
  78. break;
  79. case dv_audio_control:
  80. if (c&1) offs = (80 * 6 + 80 * 16 * 1 + 3 + c*12000);
  81. else offs = (80 * 6 + 80 * 16 * 4 + 3 + c*12000);
  82. break;
  83. case dv_video_control:
  84. if (c&1) offs = (80 * 3 + 8 + c*12000);
  85. else offs = (80 * 5 + 48 + 5 + c*12000);
  86. break;
  87. case dv_timecode:
  88. offs = (80*1 + 3 + 3);
  89. break;
  90. default:
  91. return NULL;
  92. }
  93. if (frame[offs] == t)
  94. break;
  95. }
  96. return frame[offs] == t ? &frame[offs] : NULL;
  97. }
  98. static const int dv_audio_frequency[3] = {
  99. 48000, 44100, 32000,
  100. };
  101. /*
  102. * There's a couple of assumptions being made here:
  103. * 1. By default we silence erroneous (0x8000/16-bit 0x800/12-bit) audio samples.
  104. * We can pass them upwards when libavcodec will be ready to deal with them.
  105. * 2. We don't do software emphasis.
  106. * 3. Audio is always returned as 16-bit linear samples: 12-bit nonlinear samples
  107. * are converted into 16-bit linear ones.
  108. */
  109. static int dv_extract_audio(const uint8_t *frame, uint8_t **ppcm,
  110. const AVDVProfile *sys)
  111. {
  112. int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
  113. uint16_t lc, rc;
  114. const uint8_t *as_pack;
  115. uint8_t *pcm, ipcm;
  116. as_pack = dv_extract_pack(frame, dv_audio_source);
  117. if (!as_pack) /* No audio ? */
  118. return 0;
  119. smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
  120. freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
  121. quant = as_pack[4] & 0x07; /* 0 - 16-bit linear, 1 - 12-bit nonlinear */
  122. if (quant > 1)
  123. return -1; /* unsupported quantization */
  124. if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency))
  125. return AVERROR_INVALIDDATA;
  126. size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
  127. half_ch = sys->difseg_size / 2;
  128. /* We work with 720p frames split in half, thus even frames have
  129. * channels 0,1 and odd 2,3. */
  130. ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0;
  131. if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) {
  132. av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n");
  133. return AVERROR_INVALIDDATA;
  134. }
  135. /* for each DIF channel */
  136. for (chan = 0; chan < sys->n_difchan; chan++) {
  137. av_assert0(ipcm<4);
  138. pcm = ppcm[ipcm++];
  139. if (!pcm)
  140. break;
  141. /* for each DIF segment */
  142. for (i = 0; i < sys->difseg_size; i++) {
  143. frame += 6 * 80; /* skip DIF segment header */
  144. if (quant == 1 && i == half_ch) {
  145. /* next stereo channel (12-bit mode only) */
  146. av_assert0(ipcm<4);
  147. pcm = ppcm[ipcm++];
  148. if (!pcm)
  149. break;
  150. }
  151. /* for each AV sequence */
  152. for (j = 0; j < 9; j++) {
  153. for (d = 8; d < 80; d += 2) {
  154. if (quant == 0) { /* 16-bit quantization */
  155. of = sys->audio_shuffle[i][j] +
  156. (d - 8) / 2 * sys->audio_stride;
  157. if (of * 2 >= size)
  158. continue;
  159. /* FIXME: maybe we have to admit that DV is a
  160. * big-endian PCM */
  161. pcm[of * 2] = frame[d + 1];
  162. pcm[of * 2 + 1] = frame[d];
  163. if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00)
  164. pcm[of * 2 + 1] = 0;
  165. } else { /* 12-bit quantization */
  166. lc = ((uint16_t)frame[d] << 4) |
  167. ((uint16_t)frame[d + 2] >> 4);
  168. rc = ((uint16_t)frame[d + 1] << 4) |
  169. ((uint16_t)frame[d + 2] & 0x0f);
  170. lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
  171. rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
  172. of = sys->audio_shuffle[i % half_ch][j] +
  173. (d - 8) / 3 * sys->audio_stride;
  174. if (of * 2 >= size)
  175. continue;
  176. /* FIXME: maybe we have to admit that DV is a
  177. * big-endian PCM */
  178. pcm[of * 2] = lc & 0xff;
  179. pcm[of * 2 + 1] = lc >> 8;
  180. of = sys->audio_shuffle[i % half_ch + half_ch][j] +
  181. (d - 8) / 3 * sys->audio_stride;
  182. /* FIXME: maybe we have to admit that DV is a
  183. * big-endian PCM */
  184. pcm[of * 2] = rc & 0xff;
  185. pcm[of * 2 + 1] = rc >> 8;
  186. ++d;
  187. }
  188. }
  189. frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
  190. }
  191. }
  192. }
  193. return size;
  194. }
  195. static int dv_extract_audio_info(DVDemuxContext *c, const uint8_t *frame)
  196. {
  197. const uint8_t *as_pack;
  198. int freq, stype, smpls, quant, i, ach;
  199. as_pack = dv_extract_pack(frame, dv_audio_source);
  200. if (!as_pack || !c->sys) { /* No audio ? */
  201. c->ach = 0;
  202. return 0;
  203. }
  204. smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
  205. freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
  206. stype = as_pack[3] & 0x1f; /* 0 - 2CH, 2 - 4CH, 3 - 8CH */
  207. quant = as_pack[4] & 0x07; /* 0 - 16-bit linear, 1 - 12-bit nonlinear */
  208. if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency)) {
  209. av_log(c->fctx, AV_LOG_ERROR,
  210. "Unrecognized audio sample rate index (%d)\n", freq);
  211. return 0;
  212. }
  213. if (stype > 3) {
  214. av_log(c->fctx, AV_LOG_ERROR, "stype %d is invalid\n", stype);
  215. c->ach = 0;
  216. return 0;
  217. }
  218. /* note: ach counts PAIRS of channels (i.e. stereo channels) */
  219. ach = ((int[4]) { 1, 0, 2, 4 })[stype];
  220. if (ach == 1 && quant && freq == 2)
  221. ach = 2;
  222. /* Dynamic handling of the audio streams in DV */
  223. for (i = 0; i < ach; i++) {
  224. if (!c->ast[i]) {
  225. c->ast[i] = avformat_new_stream(c->fctx, NULL);
  226. if (!c->ast[i])
  227. break;
  228. avpriv_set_pts_info(c->ast[i], 64, 1, 30000);
  229. c->ast[i]->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
  230. c->ast[i]->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
  231. av_init_packet(&c->audio_pkt[i]);
  232. c->audio_pkt[i].size = 0;
  233. c->audio_pkt[i].data = c->audio_buf[i];
  234. c->audio_pkt[i].stream_index = c->ast[i]->index;
  235. c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY;
  236. }
  237. c->ast[i]->codecpar->sample_rate = dv_audio_frequency[freq];
  238. c->ast[i]->codecpar->channels = 2;
  239. c->ast[i]->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
  240. c->ast[i]->codecpar->bit_rate = 2 * dv_audio_frequency[freq] * 16;
  241. c->ast[i]->start_time = 0;
  242. }
  243. c->ach = i;
  244. return (c->sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
  245. }
  246. static int dv_extract_video_info(DVDemuxContext *c, const uint8_t *frame)
  247. {
  248. const uint8_t *vsc_pack;
  249. AVCodecParameters *par;
  250. int apt, is16_9;
  251. par = c->vst->codecpar;
  252. avpriv_set_pts_info(c->vst, 64, c->sys->time_base.num,
  253. c->sys->time_base.den);
  254. c->vst->avg_frame_rate = av_inv_q(c->vst->time_base);
  255. /* finding out SAR is a little bit messy */
  256. vsc_pack = dv_extract_pack(frame, dv_video_control);
  257. apt = frame[4] & 0x07;
  258. is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 ||
  259. (!apt && (vsc_pack[2] & 0x07) == 0x07)));
  260. c->vst->sample_aspect_ratio = c->sys->sar[is16_9];
  261. par->bit_rate = av_rescale_q(c->sys->frame_size,
  262. (AVRational) { 8, 1 },
  263. c->sys->time_base);
  264. return c->sys->frame_size;
  265. }
  266. static int dv_extract_timecode(DVDemuxContext* c, const uint8_t* frame, char *tc)
  267. {
  268. const uint8_t *tc_pack;
  269. // For PAL systems, drop frame bit is replaced by an arbitrary
  270. // bit so its value should not be considered. Drop frame timecode
  271. // is only relevant for NTSC systems.
  272. int prevent_df = c->sys->ltc_divisor == 25 || c->sys->ltc_divisor == 50;
  273. tc_pack = dv_extract_pack(frame, dv_timecode);
  274. if (!tc_pack)
  275. return 0;
  276. av_timecode_make_smpte_tc_string(tc, AV_RB32(tc_pack + 1), prevent_df);
  277. return 1;
  278. }
  279. /* The following 3 functions constitute our interface to the world */
  280. static int dv_init_demux(AVFormatContext *s, DVDemuxContext *c)
  281. {
  282. c->vst = avformat_new_stream(s, NULL);
  283. if (!c->vst)
  284. return AVERROR(ENOMEM);
  285. c->fctx = s;
  286. c->vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
  287. c->vst->codecpar->codec_id = AV_CODEC_ID_DVVIDEO;
  288. c->vst->codecpar->bit_rate = 25000000;
  289. c->vst->start_time = 0;
  290. return 0;
  291. }
  292. DVDemuxContext *avpriv_dv_init_demux(AVFormatContext *s)
  293. {
  294. DVDemuxContext *c;
  295. c = av_mallocz(sizeof(DVDemuxContext));
  296. if (!c)
  297. return NULL;
  298. if (dv_init_demux(s, c)) {
  299. av_free(c);
  300. return NULL;
  301. }
  302. return c;
  303. }
  304. int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
  305. {
  306. int size = -1;
  307. int i;
  308. for (i = 0; i < c->ach; i++) {
  309. if (c->ast[i] && c->audio_pkt[i].size) {
  310. *pkt = c->audio_pkt[i];
  311. c->audio_pkt[i].size = 0;
  312. size = pkt->size;
  313. break;
  314. }
  315. }
  316. return size;
  317. }
  318. int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
  319. uint8_t *buf, int buf_size, int64_t pos)
  320. {
  321. int size, i;
  322. uint8_t *ppcm[5] = { 0 };
  323. if (buf_size < DV_PROFILE_BYTES ||
  324. !(c->sys = av_dv_frame_profile(c->sys, buf, buf_size)) ||
  325. buf_size < c->sys->frame_size) {
  326. return -1; /* Broken frame, or not enough data */
  327. }
  328. /* Queueing audio packet */
  329. /* FIXME: in case of no audio/bad audio we have to do something */
  330. size = dv_extract_audio_info(c, buf);
  331. for (i = 0; i < c->ach; i++) {
  332. c->audio_pkt[i].pos = pos;
  333. c->audio_pkt[i].size = size;
  334. c->audio_pkt[i].pts = c->abytes * 30000 * 8 /
  335. c->ast[i]->codecpar->bit_rate;
  336. ppcm[i] = c->audio_buf[i];
  337. }
  338. if (c->ach)
  339. dv_extract_audio(buf, ppcm, c->sys);
  340. /* We work with 720p frames split in half, thus even frames have
  341. * channels 0,1 and odd 2,3. */
  342. if (c->sys->height == 720) {
  343. if (buf[1] & 0x0C) {
  344. c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
  345. } else {
  346. c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
  347. c->abytes += size;
  348. }
  349. } else {
  350. c->abytes += size;
  351. }
  352. /* Now it's time to return video packet */
  353. size = dv_extract_video_info(c, buf);
  354. av_init_packet(pkt);
  355. pkt->data = buf;
  356. pkt->pos = pos;
  357. pkt->size = size;
  358. pkt->flags |= AV_PKT_FLAG_KEY;
  359. pkt->stream_index = c->vst->index;
  360. pkt->pts = c->frames;
  361. c->frames++;
  362. return size;
  363. }
  364. static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
  365. int64_t timestamp, int flags)
  366. {
  367. // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
  368. const int frame_size = c->sys->frame_size;
  369. int64_t offset;
  370. int64_t size = avio_size(s->pb) - s->internal->data_offset;
  371. int64_t max_offset = ((size - 1) / frame_size) * frame_size;
  372. offset = frame_size * timestamp;
  373. if (size >= 0 && offset > max_offset)
  374. offset = max_offset;
  375. else if (offset < 0)
  376. offset = 0;
  377. return offset + s->internal->data_offset;
  378. }
  379. void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
  380. {
  381. c->frames = frame_offset;
  382. if (c->ach) {
  383. if (c->sys) {
  384. c->abytes = av_rescale_q(c->frames, c->sys->time_base,
  385. (AVRational) { 8, c->ast[0]->codecpar->bit_rate });
  386. } else
  387. av_log(c->fctx, AV_LOG_ERROR, "cannot adjust audio bytes\n");
  388. }
  389. c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
  390. c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
  391. }
  392. /************************************************************
  393. * Implementation of the easiest DV storage of all -- raw DV.
  394. ************************************************************/
  395. typedef struct RawDVContext {
  396. DVDemuxContext dv_demux;
  397. uint8_t buf[DV_MAX_FRAME_SIZE];
  398. } RawDVContext;
  399. static int dv_read_timecode(AVFormatContext *s) {
  400. int ret;
  401. char timecode[AV_TIMECODE_STR_SIZE];
  402. int64_t pos = avio_tell(s->pb);
  403. // Read 3 DIF blocks: Header block and 2 Subcode blocks.
  404. #define PARTIAL_FRAME_SIZE (3 * 80)
  405. uint8_t partial_frame[PARTIAL_FRAME_SIZE];
  406. RawDVContext *c = s->priv_data;
  407. ret = avio_read(s->pb, partial_frame, PARTIAL_FRAME_SIZE);
  408. if (ret < 0)
  409. goto finish;
  410. if (ret < PARTIAL_FRAME_SIZE) {
  411. ret = -1;
  412. goto finish;
  413. }
  414. ret = dv_extract_timecode(&c->dv_demux, partial_frame, timecode);
  415. if (ret)
  416. av_dict_set(&s->metadata, "timecode", timecode, 0);
  417. else
  418. av_log(s, AV_LOG_ERROR, "Detected timecode is invalid\n");
  419. finish:
  420. avio_seek(s->pb, pos, SEEK_SET);
  421. return ret;
  422. }
  423. static int dv_read_header(AVFormatContext *s)
  424. {
  425. unsigned state, marker_pos = 0;
  426. RawDVContext *c = s->priv_data;
  427. int ret;
  428. if ((ret = dv_init_demux(s, &c->dv_demux)) < 0)
  429. return ret;
  430. state = avio_rb32(s->pb);
  431. while ((state & 0xffffff7f) != 0x1f07003f) {
  432. if (avio_feof(s->pb)) {
  433. av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
  434. return AVERROR_INVALIDDATA;
  435. }
  436. if (state == 0x003f0700 || state == 0xff3f0700)
  437. marker_pos = avio_tell(s->pb);
  438. if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) {
  439. avio_seek(s->pb, -163, SEEK_CUR);
  440. state = avio_rb32(s->pb);
  441. break;
  442. }
  443. state = (state << 8) | avio_r8(s->pb);
  444. }
  445. AV_WB32(c->buf, state);
  446. if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) != DV_PROFILE_BYTES - 4 ||
  447. avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) {
  448. return AVERROR(EIO);
  449. }
  450. c->dv_demux.sys = av_dv_frame_profile(c->dv_demux.sys,
  451. c->buf,
  452. DV_PROFILE_BYTES);
  453. if (!c->dv_demux.sys) {
  454. av_log(s, AV_LOG_ERROR,
  455. "Can't determine profile of DV input stream.\n");
  456. return AVERROR_INVALIDDATA;
  457. }
  458. s->bit_rate = av_rescale_q(c->dv_demux.sys->frame_size,
  459. (AVRational) { 8, 1 },
  460. c->dv_demux.sys->time_base);
  461. if (s->pb->seekable & AVIO_SEEKABLE_NORMAL)
  462. dv_read_timecode(s);
  463. return 0;
  464. }
  465. static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
  466. {
  467. int size;
  468. RawDVContext *c = s->priv_data;
  469. size = avpriv_dv_get_packet(&c->dv_demux, pkt);
  470. if (size < 0) {
  471. int ret;
  472. int64_t pos = avio_tell(s->pb);
  473. if (!c->dv_demux.sys)
  474. return AVERROR(EIO);
  475. size = c->dv_demux.sys->frame_size;
  476. ret = avio_read(s->pb, c->buf, size);
  477. if (ret < 0) {
  478. return ret;
  479. } else if (ret == 0) {
  480. return AVERROR(EIO);
  481. }
  482. size = avpriv_dv_produce_packet(&c->dv_demux, pkt, c->buf, size, pos);
  483. }
  484. return size;
  485. }
  486. static int dv_read_seek(AVFormatContext *s, int stream_index,
  487. int64_t timestamp, int flags)
  488. {
  489. RawDVContext *r = s->priv_data;
  490. DVDemuxContext *c = &r->dv_demux;
  491. int64_t offset = dv_frame_offset(s, c, timestamp, flags);
  492. if (avio_seek(s->pb, offset, SEEK_SET) < 0)
  493. return -1;
  494. ff_dv_offset_reset(c, offset / c->sys->frame_size);
  495. return 0;
  496. }
  497. static int dv_probe(const AVProbeData *p)
  498. {
  499. unsigned marker_pos = 0;
  500. int i;
  501. int matches = 0;
  502. int firstmatch = 0;
  503. int secondary_matches = 0;
  504. if (p->buf_size < 5)
  505. return 0;
  506. for (i = 0; i < p->buf_size-4; i++) {
  507. unsigned state = AV_RB32(p->buf+i);
  508. if ((state & 0x0007f840) == 0x00070000) {
  509. // any section header, also with seq/chan num != 0,
  510. // should appear around every 12000 bytes, at least 10 per frame
  511. if ((state & 0xff07ff7f) == 0x1f07003f) {
  512. secondary_matches++;
  513. if ((state & 0xffffff7f) == 0x1f07003f) {
  514. matches++;
  515. if (!i)
  516. firstmatch = 1;
  517. }
  518. }
  519. if (state == 0x003f0700 || state == 0xff3f0700)
  520. marker_pos = i;
  521. if (state == 0xff3f0701 && i - marker_pos == 80)
  522. matches++;
  523. }
  524. }
  525. if (matches && p->buf_size / matches < 1024 * 1024) {
  526. if (matches > 4 || firstmatch ||
  527. (secondary_matches >= 10 &&
  528. p->buf_size / secondary_matches < 24000))
  529. // not max to avoid dv in mov to match
  530. return AVPROBE_SCORE_MAX * 3 / 4;
  531. return AVPROBE_SCORE_MAX / 4;
  532. }
  533. return 0;
  534. }
  535. AVInputFormat ff_dv_demuxer = {
  536. .name = "dv",
  537. .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
  538. .priv_data_size = sizeof(RawDVContext),
  539. .read_probe = dv_probe,
  540. .read_header = dv_read_header,
  541. .read_packet = dv_read_packet,
  542. .read_seek = dv_read_seek,
  543. .extensions = "dv,dif",
  544. };