Commit e950141a authored by Roman Shaposhnik's avatar Roman Shaposhnik

* 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
parent 16ab894e
......@@ -1229,6 +1229,10 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
static int dvvideo_close(AVCodecContext *c)
{
DVVideoContext *s = c->priv_data;
if(s->picture.data[0])
c->release_buffer(c, &s->picture);
return 0;
}
......@@ -1242,10 +1246,7 @@ AVCodec dvvideo_encoder = {
sizeof(DVVideoContext),
dvvideo_init,
dvvideo_encode_frame,
dvvideo_close,
NULL,
CODEC_CAP_DR1,
NULL
.pix_fmts = (enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, -1},
};
#endif // CONFIG_DVVIDEO_ENCODER
......
......@@ -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)
......
......@@ -25,7 +25,7 @@ f8ad5bd78f4d012a8ce9570aa395ac54 *./data/b-libav.flv
16518706f425cb537362bfc1c58b8de5 *./data/b-libav.mov
366923 ./data/b-libav.mov
./data/b-libav.mov CRC=0x45079dca
26c41db318d9aacfd6b9e734c0ea4d94 *./data/b-libav.dv
064ffe6f670678b8f944df92560e1fff *./data/b-libav.dv
3600000 ./data/b-libav.dv
./data/b-libav.dv CRC=0xa6b8b635
2b3f921fb7a01bb126cab5ee21ae3f8d *./data/b-libav.gxf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment