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.

643 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/16bit 0x800/12bit) 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 16bit linear samples: 12bit nonlinear samples
  107. * are converted into 16bit 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 - 16bit linear, 1 - 12bit 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 (12bit 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) { /* 16bit 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 { /* 12bit 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 - 16bit linear, 1 - 12bit 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]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
  230. c->ast[i]->codec->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]->codec->sample_rate = dv_audio_frequency[freq];
  238. c->ast[i]->codec->channels = 2;
  239. c->ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO;
  240. c->ast[i]->codec->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. AVCodecContext *avctx;
  250. int apt, is16_9;
  251. int size = 0;
  252. if (c->sys) {
  253. avctx = c->vst->codec;
  254. avpriv_set_pts_info(c->vst, 64, c->sys->time_base.num,
  255. c->sys->time_base.den);
  256. c->vst->avg_frame_rate = av_inv_q(c->vst->time_base);
  257. /* finding out SAR is a little bit messy */
  258. vsc_pack = dv_extract_pack(frame, dv_video_control);
  259. apt = frame[4] & 0x07;
  260. is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 ||
  261. (!apt && (vsc_pack[2] & 0x07) == 0x07)));
  262. c->vst->sample_aspect_ratio = c->sys->sar[is16_9];
  263. avctx->bit_rate = av_rescale_q(c->sys->frame_size,
  264. (AVRational) { 8, 1 },
  265. c->sys->time_base);
  266. size = c->sys->frame_size;
  267. }
  268. return size;
  269. }
  270. static int dv_extract_timecode(DVDemuxContext* c, const uint8_t* frame, char *tc)
  271. {
  272. const uint8_t *tc_pack;
  273. // For PAL systems, drop frame bit is replaced by an arbitrary
  274. // bit so its value should not be considered. Drop frame timecode
  275. // is only relevant for NTSC systems.
  276. int prevent_df = c->sys->ltc_divisor == 25 || c->sys->ltc_divisor == 50;
  277. tc_pack = dv_extract_pack(frame, dv_timecode);
  278. if (!tc_pack)
  279. return 0;
  280. av_timecode_make_smpte_tc_string(tc, AV_RB32(tc_pack + 1), prevent_df);
  281. return 1;
  282. }
  283. /* The following 3 functions constitute our interface to the world */
  284. DVDemuxContext *avpriv_dv_init_demux(AVFormatContext *s)
  285. {
  286. DVDemuxContext *c;
  287. c = av_mallocz(sizeof(DVDemuxContext));
  288. if (!c)
  289. return NULL;
  290. c->vst = avformat_new_stream(s, NULL);
  291. if (!c->vst) {
  292. av_free(c);
  293. return NULL;
  294. }
  295. c->fctx = s;
  296. c->vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
  297. c->vst->codec->codec_id = AV_CODEC_ID_DVVIDEO;
  298. c->vst->codec->bit_rate = 25000000;
  299. c->vst->start_time = 0;
  300. return c;
  301. }
  302. int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
  303. {
  304. int size = -1;
  305. int i;
  306. for (i = 0; i < c->ach; i++) {
  307. if (c->ast[i] && c->audio_pkt[i].size) {
  308. *pkt = c->audio_pkt[i];
  309. c->audio_pkt[i].size = 0;
  310. size = pkt->size;
  311. break;
  312. }
  313. }
  314. return size;
  315. }
  316. int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
  317. uint8_t *buf, int buf_size, int64_t pos)
  318. {
  319. int size, i;
  320. uint8_t *ppcm[5] = { 0 };
  321. if (buf_size < DV_PROFILE_BYTES ||
  322. !(c->sys = av_dv_frame_profile(c->sys, buf, buf_size)) ||
  323. buf_size < c->sys->frame_size) {
  324. return -1; /* Broken frame, or not enough data */
  325. }
  326. /* Queueing audio packet */
  327. /* FIXME: in case of no audio/bad audio we have to do something */
  328. size = dv_extract_audio_info(c, buf);
  329. for (i = 0; i < c->ach; i++) {
  330. c->audio_pkt[i].pos = pos;
  331. c->audio_pkt[i].size = size;
  332. c->audio_pkt[i].pts = c->abytes * 30000 * 8 /
  333. c->ast[i]->codec->bit_rate;
  334. ppcm[i] = c->audio_buf[i];
  335. }
  336. if (c->ach)
  337. dv_extract_audio(buf, ppcm, c->sys);
  338. /* We work with 720p frames split in half, thus even frames have
  339. * channels 0,1 and odd 2,3. */
  340. if (c->sys->height == 720) {
  341. if (buf[1] & 0x0C) {
  342. c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
  343. } else {
  344. c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
  345. c->abytes += size;
  346. }
  347. } else {
  348. c->abytes += size;
  349. }
  350. /* Now it's time to return video packet */
  351. size = dv_extract_video_info(c, buf);
  352. av_init_packet(pkt);
  353. pkt->data = buf;
  354. pkt->pos = pos;
  355. pkt->size = size;
  356. pkt->flags |= AV_PKT_FLAG_KEY;
  357. pkt->stream_index = c->vst->index;
  358. pkt->pts = c->frames;
  359. c->frames++;
  360. return size;
  361. }
  362. static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
  363. int64_t timestamp, int flags)
  364. {
  365. // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
  366. const AVDVProfile *sys = av_dv_codec_profile2(c->vst->codec->width, c->vst->codec->height,
  367. c->vst->codec->pix_fmt, c->vst->codec->time_base);
  368. int64_t offset;
  369. int64_t size = avio_size(s->pb) - s->internal->data_offset;
  370. int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;
  371. offset = sys->frame_size * timestamp;
  372. if (size >= 0 && offset > max_offset)
  373. offset = max_offset;
  374. else if (offset < 0)
  375. offset = 0;
  376. return offset + s->internal->data_offset;
  377. }
  378. void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
  379. {
  380. c->frames = frame_offset;
  381. if (c->ach) {
  382. if (c->sys) {
  383. c->abytes = av_rescale_q(c->frames, c->sys->time_base,
  384. (AVRational) { 8, c->ast[0]->codec->bit_rate });
  385. } else
  386. av_log(c->fctx, AV_LOG_ERROR, "cannot adjust audio bytes\n");
  387. }
  388. c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
  389. c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
  390. }
  391. /************************************************************
  392. * Implementation of the easiest DV storage of all -- raw DV.
  393. ************************************************************/
  394. typedef struct RawDVContext {
  395. DVDemuxContext *dv_demux;
  396. uint8_t buf[DV_MAX_FRAME_SIZE];
  397. } RawDVContext;
  398. static int dv_read_timecode(AVFormatContext *s) {
  399. int ret;
  400. char timecode[AV_TIMECODE_STR_SIZE];
  401. int64_t pos = avio_tell(s->pb);
  402. // Read 3 DIF blocks: Header block and 2 Subcode blocks.
  403. int partial_frame_size = 3 * 80;
  404. uint8_t *partial_frame = av_mallocz(sizeof(*partial_frame) *
  405. partial_frame_size);
  406. RawDVContext *c = s->priv_data;
  407. if (!partial_frame)
  408. return AVERROR(ENOMEM);
  409. ret = avio_read(s->pb, partial_frame, partial_frame_size);
  410. if (ret < 0)
  411. goto finish;
  412. if (ret < partial_frame_size) {
  413. ret = -1;
  414. goto finish;
  415. }
  416. ret = dv_extract_timecode(c->dv_demux, partial_frame, timecode);
  417. if (ret)
  418. av_dict_set(&s->metadata, "timecode", timecode, 0);
  419. else
  420. av_log(s, AV_LOG_ERROR, "Detected timecode is invalid\n");
  421. finish:
  422. av_free(partial_frame);
  423. avio_seek(s->pb, pos, SEEK_SET);
  424. return ret;
  425. }
  426. static int dv_read_header(AVFormatContext *s)
  427. {
  428. unsigned state, marker_pos = 0;
  429. RawDVContext *c = s->priv_data;
  430. c->dv_demux = avpriv_dv_init_demux(s);
  431. if (!c->dv_demux)
  432. return -1;
  433. state = avio_rb32(s->pb);
  434. while ((state & 0xffffff7f) != 0x1f07003f) {
  435. if (avio_feof(s->pb)) {
  436. av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
  437. return -1;
  438. }
  439. if (state == 0x003f0700 || state == 0xff3f0700)
  440. marker_pos = avio_tell(s->pb);
  441. if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) {
  442. avio_seek(s->pb, -163, SEEK_CUR);
  443. state = avio_rb32(s->pb);
  444. break;
  445. }
  446. state = (state << 8) | avio_r8(s->pb);
  447. }
  448. AV_WB32(c->buf, state);
  449. if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) != DV_PROFILE_BYTES - 4 ||
  450. avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
  451. return AVERROR(EIO);
  452. c->dv_demux->sys = av_dv_frame_profile(c->dv_demux->sys,
  453. c->buf,
  454. DV_PROFILE_BYTES);
  455. if (!c->dv_demux->sys) {
  456. av_log(s, AV_LOG_ERROR,
  457. "Can't determine profile of DV input stream.\n");
  458. return -1;
  459. }
  460. s->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size,
  461. (AVRational) { 8, 1 },
  462. c->dv_demux->sys->time_base);
  463. if (s->pb->seekable)
  464. dv_read_timecode(s);
  465. return 0;
  466. }
  467. static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
  468. {
  469. int size;
  470. RawDVContext *c = s->priv_data;
  471. size = avpriv_dv_get_packet(c->dv_demux, pkt);
  472. if (size < 0) {
  473. int64_t pos = avio_tell(s->pb);
  474. if (!c->dv_demux->sys)
  475. return AVERROR(EIO);
  476. size = c->dv_demux->sys->frame_size;
  477. if (avio_read(s->pb, c->buf, size) <= 0)
  478. return AVERROR(EIO);
  479. size = avpriv_dv_produce_packet(c->dv_demux, pkt, c->buf, size, pos);
  480. }
  481. return size;
  482. }
  483. static int dv_read_seek(AVFormatContext *s, int stream_index,
  484. int64_t timestamp, int flags)
  485. {
  486. RawDVContext *r = s->priv_data;
  487. DVDemuxContext *c = r->dv_demux;
  488. int64_t offset = dv_frame_offset(s, c, timestamp, flags);
  489. if (avio_seek(s->pb, offset, SEEK_SET) < 0)
  490. return -1;
  491. ff_dv_offset_reset(c, offset / c->sys->frame_size);
  492. return 0;
  493. }
  494. static int dv_read_close(AVFormatContext *s)
  495. {
  496. RawDVContext *c = s->priv_data;
  497. av_freep(&c->dv_demux);
  498. return 0;
  499. }
  500. static int dv_probe(AVProbeData *p)
  501. {
  502. unsigned marker_pos = 0;
  503. int i;
  504. int matches = 0;
  505. int firstmatch = 0;
  506. int secondary_matches = 0;
  507. if (p->buf_size < 5)
  508. return 0;
  509. for (i = 0; i < p->buf_size-4; i++) {
  510. unsigned state = AV_RB32(p->buf+i);
  511. if ((state & 0x0007f840) == 0x00070000) {
  512. // any section header, also with seq/chan num != 0,
  513. // should appear around every 12000 bytes, at least 10 per frame
  514. if ((state & 0xff07ff7f) == 0x1f07003f) {
  515. secondary_matches++;
  516. if ((state & 0xffffff7f) == 0x1f07003f) {
  517. matches++;
  518. if (!i)
  519. firstmatch = 1;
  520. }
  521. }
  522. if (state == 0x003f0700 || state == 0xff3f0700)
  523. marker_pos = i;
  524. if (state == 0xff3f0701 && i - marker_pos == 80)
  525. matches++;
  526. }
  527. }
  528. if (matches && p->buf_size / matches < 1024 * 1024) {
  529. if (matches > 4 || firstmatch ||
  530. (secondary_matches >= 10 &&
  531. p->buf_size / secondary_matches < 24000))
  532. // not max to avoid dv in mov to match
  533. return AVPROBE_SCORE_MAX * 3 / 4;
  534. return AVPROBE_SCORE_MAX / 4;
  535. }
  536. return 0;
  537. }
  538. AVInputFormat ff_dv_demuxer = {
  539. .name = "dv",
  540. .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
  541. .priv_data_size = sizeof(RawDVContext),
  542. .read_probe = dv_probe,
  543. .read_header = dv_read_header,
  544. .read_packet = dv_read_packet,
  545. .read_close = dv_read_close,
  546. .read_seek = dv_read_seek,
  547. .extensions = "dv,dif",
  548. };