comparison dvdata.h @ 3671:18113845d891 libavcodec

* Restructuring the division of labor between DV codec and DV format [ Based on a patch by Brian Brice (bbrice at newtek dot com) ]
author romansh
date Mon, 04 Sep 2006 03:33:11 +0000
parents 312b86bc4202
children c8c591fe26f8
comparison
equal deleted inserted replaced
3670:48ea0e1a4fdb 3671:18113845d891
2622 .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, 2622 .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
2623 .audio_shuffle = dv_audio_shuffle625, 2623 .audio_shuffle = dv_audio_shuffle625,
2624 } 2624 }
2625 }; 2625 };
2626 2626
2627 enum dv_section_type {
2628 dv_sect_header = 0x1f,
2629 dv_sect_subcode = 0x3f,
2630 dv_sect_vaux = 0x56,
2631 dv_sect_audio = 0x76,
2632 dv_sect_video = 0x96,
2633 };
2634
2635 enum dv_pack_type {
2636 dv_header525 = 0x3f, /* see dv_write_pack for important details on */
2637 dv_header625 = 0xbf, /* these two packs */
2638 dv_timecode = 0x13,
2639 dv_audio_source = 0x50,
2640 dv_audio_control = 0x51,
2641 dv_audio_recdate = 0x52,
2642 dv_audio_rectime = 0x53,
2643 dv_video_source = 0x60,
2644 dv_video_control = 0x61,
2645 dv_video_recdate = 0x62,
2646 dv_video_rectime = 0x63,
2647 dv_unknown_pack = 0xff,
2648 };
2649
2627 /* minimum number of bytes to read from a DV stream in order to determine the profile */ 2650 /* minimum number of bytes to read from a DV stream in order to determine the profile */
2628 #define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */ 2651 #define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */
2629 2652
2630 /* largest possible DV frame, in bytes (PAL 50Mbps) */ 2653 /* largest possible DV frame, in bytes (PAL 50Mbps) */
2631 #define DV_MAX_FRAME_SIZE 288000 2654 #define DV_MAX_FRAME_SIZE 288000
2661 if (codec->height == dv_profiles[i].height && codec->pix_fmt == dv_profiles[i].pix_fmt) 2684 if (codec->height == dv_profiles[i].height && codec->pix_fmt == dv_profiles[i].pix_fmt)
2662 return &dv_profiles[i]; 2685 return &dv_profiles[i];
2663 2686
2664 return NULL; 2687 return NULL;
2665 } 2688 }
2689
2690 static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num, uint8_t seq_num,
2691 uint8_t dif_num, uint8_t* buf)
2692 {
2693 buf[0] = (uint8_t)t; /* Section type */
2694 buf[1] = (seq_num<<4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */
2695 (chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */
2696 7; /* reserved -- always 1 */
2697 buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */
2698 return 3;
2699 }
2700
2701
2702 static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf)
2703 {
2704 if (syb_num == 0 || syb_num == 6) {
2705 buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */
2706 (0<<4) | /* AP3 (Subcode application ID) */
2707 0x0f; /* reserved -- always 1 */
2708 }
2709 else if (syb_num == 11) {
2710 buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */
2711 0x7f; /* reserved -- always 1 */
2712 }
2713 else {
2714 buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */
2715 (0<<4) | /* APT (Track application ID) */
2716 0x0f; /* reserved -- always 1 */
2717 }
2718 buf[1] = 0xf0 | /* reserved -- always 1 */
2719 (syb_num & 0x0f); /* SSYB number 0 - 11 */
2720 buf[2] = 0xff; /* reserved -- always 1 */
2721 return 3;
2722 }