mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-18 13:49:58 +01:00
sync with mjpegtools lav_io_
This commit is contained in:
@@ -683,6 +683,7 @@ int lav_write_audio(lav_file_t *lav_file, uint8_t *buff, long samps)
|
|||||||
int i, j;
|
int i, j;
|
||||||
int16_t *qt_audio = (int16_t *)buff, **qt_audion;
|
int16_t *qt_audio = (int16_t *)buff, **qt_audion;
|
||||||
int channels = lav_audio_channels(lav_file);
|
int channels = lav_audio_channels(lav_file);
|
||||||
|
int bits = lav_audio_bits(lav_file);
|
||||||
#ifdef HAVE_LIBQUICKTIME
|
#ifdef HAVE_LIBQUICKTIME
|
||||||
int res=0;
|
int res=0;
|
||||||
#endif
|
#endif
|
||||||
@@ -695,16 +696,37 @@ int lav_write_audio(lav_file_t *lav_file, uint8_t *buff, long samps)
|
|||||||
#ifdef HAVE_LIBQUICKTIME
|
#ifdef HAVE_LIBQUICKTIME
|
||||||
case 'q':
|
case 'q':
|
||||||
case 'Q':
|
case 'Q':
|
||||||
/* Deinterleave the audio into the two channels. */
|
if (bits != 16 || channels > 1)
|
||||||
for (i = 0; i < samps; i++)
|
{
|
||||||
{
|
/* Deinterleave the audio into the two channels and/or convert
|
||||||
for (j = 0; j < channels; j++)
|
* bits per sample to the required format.
|
||||||
qt_audion[j][i] = qt_audio[(channels*i) + j];
|
*/
|
||||||
}
|
qt_audion = malloc(channels * sizeof(*qt_audion));
|
||||||
res = lqt_encode_audio_track(lav_file->qt_fd, qt_audion, NULL,samps,0);
|
for (i = 0; i < channels; i++)
|
||||||
for (j = 0; j < channels; j++)
|
qt_audion[i] = malloc(samps * sizeof(**qt_audion));
|
||||||
free(qt_audion[j]);
|
|
||||||
free(qt_audion);
|
if (bits == 16)
|
||||||
|
for (i = 0; i < samps; i++)
|
||||||
|
for (j = 0; j < channels; j++)
|
||||||
|
qt_audion[j][i] = qt_audio[channels * i + j];
|
||||||
|
else if (bits == 8)
|
||||||
|
for (i = 0; i < samps; i++)
|
||||||
|
for (j = 0; j < channels; j++)
|
||||||
|
qt_audion[j][i] = ((int16_t)(buff[channels * i + j]) << 8) ^ 0x8000;
|
||||||
|
|
||||||
|
if (bits == 8 || bits == 16)
|
||||||
|
res = lqt_encode_audio_track(lav_file->qt_fd, qt_audion, NULL, samps, 0);
|
||||||
|
|
||||||
|
for (i = 0; i < channels; i++)
|
||||||
|
free(qt_audion[i]);
|
||||||
|
free(qt_audion);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qt_audion = &qt_audio;
|
||||||
|
res = lqt_encode_audio_track(lav_file->qt_fd, qt_audion, NULL, samps, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -1347,12 +1369,12 @@ lav_file_t *lav_open_input_file(char *filename, int mmap_size)
|
|||||||
* the sar values in the lav_fd structure. Hardwired (like everywhere else)
|
* the sar values in the lav_fd structure. Hardwired (like everywhere else)
|
||||||
* to only look at track 0.
|
* to only look at track 0.
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
if (lqt_get_pasp(lav_fd->qt_fd, 0, &pasp) != 0)
|
if (lqt_get_pasp(lav_fd->qt_fd, 0, &pasp) != 0)
|
||||||
{
|
{
|
||||||
lav_fd->sar_w = pasp.hSpacing;
|
lav_fd->sar_w = pasp.hSpacing;
|
||||||
lav_fd->sar_h = pasp.vSpacing;
|
lav_fd->sar_h = pasp.vSpacing;
|
||||||
}*/
|
}
|
||||||
/*
|
/*
|
||||||
* If a 'fiel' atom is present (not guaranteed) then use it to set the
|
* If a 'fiel' atom is present (not guaranteed) then use it to set the
|
||||||
* interlacing type.
|
* interlacing type.
|
||||||
|
|||||||
Reference in New Issue
Block a user