summaryrefslogtreecommitdiff
path: root/libavcodec/dv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-11 01:22:22 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-11 01:22:22 +0100
commita78f6b8cb98611a846a68f4bbb77e78fd5c175bf (patch)
tree45d4339cefc60f61310bd23b8d7cf7d0bf1f88b6 /libavcodec/dv.c
parent394d41ee30b0c4a38a8d33b65e28facfef15d465 (diff)
parentf98ede7e610da644d3e5d553fc5d7102cf1ccde7 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (38 commits) v210enc: remove redundant check for pix_fmt wavpack: allow user to disable CRC checking v210enc: Use Bytestream2 functions cafdec: Check return value of avio_seek and avoid modifying state if it fails yop: Check return value of avio_seek and avoid modifying state if it fails tta: Check return value of avio_seek and avoid modifying state if it fails tmv: Check return value of avio_seek and avoid modifying state if it fails r3d: Check return value of avio_seek and avoid modifying state if it fails nsvdec: Check return value of avio_seek and avoid modifying state if it fails mpc8: Check return value of avio_seek and avoid modifying state if it fails jvdec: Check return value of avio_seek and avoid modifying state if it fails filmstripdec: Check return value of avio_seek and avoid modifying state if it fails ffmdec: Check return value of avio_seek and avoid modifying state if it fails dv: Check return value of avio_seek and avoid modifying state if it fails bink: Check return value of avio_seek and avoid modifying state if it fails Check AVCodec.pix_fmts in avcodec_open2() svq3: Prevent illegal reads while parsing extradata. remove ParseContext1 vc1: use ff_parse_close mpegvideo parser: move specific fields into private context ... Conflicts: libavcodec/4xm.c libavcodec/aacdec.c libavcodec/h264.c libavcodec/h264.h libavcodec/h264_cabac.c libavcodec/h264_cavlc.c libavcodec/mpeg4video_parser.c libavcodec/svq3.c libavcodec/v210enc.c libavformat/cafdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dv.c')
-rw-r--r--libavcodec/dv.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 413d50fb0d..abfa5cd358 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -45,6 +45,7 @@
#include "put_bits.h"
#include "simple_idct.h"
#include "dvdata.h"
+#include "dvquant.h"
#include "dv_tablegen.h"
//#undef NDEBUG
@@ -1190,6 +1191,41 @@ static inline int dv_write_pack(enum dv_pack_type pack_id, DVVideoContext *c,
}
#if CONFIG_DVVIDEO_ENCODER
+static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,
+ uint8_t seq_num, uint8_t dif_num,
+ uint8_t* buf)
+{
+ buf[0] = (uint8_t)t; /* Section type */
+ buf[1] = (seq_num << 4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */
+ (chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */
+ 7; /* reserved -- always 1 */
+ buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */
+ return 3;
+}
+
+
+static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf)
+{
+ if (syb_num == 0 || syb_num == 6) {
+ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
+ (0 << 4) | /* AP3 (Subcode application ID) */
+ 0x0f; /* reserved -- always 1 */
+ }
+ else if (syb_num == 11) {
+ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
+ 0x7f; /* reserved -- always 1 */
+ }
+ else {
+ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
+ (0 << 4) | /* APT (Track application ID) */
+ 0x0f; /* reserved -- always 1 */
+ }
+ buf[1] = 0xf0 | /* reserved -- always 1 */
+ (syb_num & 0x0f); /* SSYB number 0 - 11 */
+ buf[2] = 0xff; /* reserved -- always 1 */
+ return 3;
+}
+
static void dv_format_frame(DVVideoContext* c, uint8_t* buf)
{
int chan, i, j, k;