aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/dvenc.c
diff options
context:
space:
mode:
authorRoman Shaposhnik <roman@shaposhnik.org>2007-01-15 07:41:28 +0000
committerRoman Shaposhnik <roman@shaposhnik.org>2007-01-15 07:41:28 +0000
commite950141a58f35fc29664b4681d9d78c0773b1f34 (patch)
tree68917e0551fab0ebbbf17147098d42459c49650f /libavformat/dvenc.c
parent16ab894ecb71a413dc3bb2ba020abb21e2e01b8b (diff)
downloadffmpeg-e950141a58f35fc29664b4681d9d78c0773b1f34.tar.gz
* 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 Originally committed as revision 7531 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/dvenc.c')
-rw-r--r--libavformat/dvenc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 79cee7af69..bdac43784c 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -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 @@ static int dv_audio_frame_size(const DVprofile* sys, int frame)
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 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
(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 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
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 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
(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 @@ static void dv_inject_audio(DVMuxContext *c, int channel, uint8_t* frame_ptr)
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)