Mercurial > libavformat.hg
changeset 1656:184229324f14 libavformat
* Fixing a bug with incorrect bits set in AAUX source pack
* Making DV codec release a buffer on exit
* Flagging accepted pix_fmts for DV encoder
author | romansh |
---|---|
date | Mon, 15 Jan 2007 07:41:28 +0000 |
parents | a105c6648aa9 |
children | a472266b5d39 |
files | dvenc.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/dvenc.c Mon Jan 15 01:04:43 2007 +0000 +++ b/dvenc.c Mon Jan 15 07:41:28 2007 +0000 @@ -28,6 +28,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <time.h> +#include <stdarg.h> #include "avformat.h" #include "dvdata.h" #include "dv.h" @@ -66,11 +67,12 @@ sizeof(sys->audio_samples_dist[0]))]; } -static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* buf) +static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* buf, ...) { struct tm tc; time_t ct; int ltc_frame; + va_list ap; buf[0] = (uint8_t)pack_id; switch (pack_id) { @@ -99,7 +101,8 @@ (tc.tm_hour % 10); /* Units of hours */ break; case dv_audio_source: /* AAUX source pack */ - buf[1] = (0 << 7) | /* locked mode */ + va_start(ap, buf); + buf[1] = (1 << 7) | /* locked mode -- SMPTE only supports locked mode */ (1 << 6) | /* reserved -- always 1 */ (dv_audio_frame_size(c->sys, c->frames) - c->sys->audio_min_samples[0]); @@ -107,7 +110,7 @@ buf[2] = (0 << 7) | /* multi-stereo */ (0 << 5) | /* #of audio channels per block: 0 -- 1 channel */ (0 << 4) | /* pair bit: 0 -- one pair of channels */ - 0; /* audio mode */ + !!va_arg(ap, int); /* audio mode */ buf[3] = (1 << 7) | /* res */ (1 << 6) | /* multi-language flag */ (c->sys->dsf << 5) | /* system: 60fields/50fields */ @@ -116,6 +119,7 @@ (0 << 6) | /* emphasis time constant: 0 -- reserved */ (0 << 3) | /* frequency: 0 -- 48Khz, 1 -- 44,1Khz, 2 -- 32Khz */ 0; /* quantization: 0 -- 16bit linear, 1 -- 12bit nonlinear */ + va_end(ap); break; case dv_audio_control: buf[1] = (0 << 6) | /* copy protection: 0 -- unrestricted */ @@ -179,7 +183,7 @@ for (i = 0; i < c->sys->difseg_size; i++) { frame_ptr += 6 * 80; /* skip DIF segment header */ for (j = 0; j < 9; j++) { - dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3]); + dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3], i >= c->sys->difseg_size/2); for (d = 8; d < 80; d+=2) { of = c->sys->audio_shuffle[i][j] + (d - 8)/2 * c->sys->audio_stride; if (of*2 >= size)