Lines 36-42
Link Here
|
36 |
#endif |
36 |
#endif |
37 |
|
37 |
|
38 |
#ifdef HAVE_LIBQUICKTIME |
38 |
#ifdef HAVE_LIBQUICKTIME |
39 |
#include <quicktime.h> |
39 |
#include <quicktime/quicktime.h> |
|
|
40 |
#include <quicktime/lqt.h> |
40 |
#endif |
41 |
#endif |
41 |
|
42 |
|
42 |
extern int AVI_errno; |
43 |
extern int AVI_errno; |
Lines 524-533
Link Here
|
524 |
int lav_write_audio(lav_file_t *lav_file, uint8_t *buff, long samps) |
525 |
int lav_write_audio(lav_file_t *lav_file, uint8_t *buff, long samps) |
525 |
{ |
526 |
{ |
526 |
int res; |
527 |
int res; |
527 |
#ifdef HAVE_LIBQUICKTIME |
|
|
528 |
int n, nb; |
529 |
uint8_t *hbuff; |
530 |
#endif |
531 |
|
528 |
|
532 |
video_format = lav_file->format; internal_error = 0; /* for error messages */ |
529 |
video_format = lav_file->format; internal_error = 0; /* for error messages */ |
533 |
|
530 |
|
Lines 539-556
Link Here
|
539 |
break; |
536 |
break; |
540 |
#ifdef HAVE_LIBQUICKTIME |
537 |
#ifdef HAVE_LIBQUICKTIME |
541 |
case 'q': |
538 |
case 'q': |
542 |
if(lav_audio_bits(lav_file)==16) |
539 |
res = lqt_encode_audio_track(lav_file->qt_fd, (int16_t **)&buff, NULL, samps, 0); |
543 |
{ |
|
|
544 |
nb = samps*2*lav_audio_channels(lav_file); |
545 |
hbuff = (uint8_t *) malloc(nb); |
546 |
if(!hbuff) { internal_error=ERROR_MALLOC; return -1; } |
547 |
for(n=0;n<nb;n+=2) |
548 |
{ hbuff[n] = buff[n+1]; hbuff[n+1] = buff[n]; } |
549 |
res = quicktime_write_audio( lav_file->qt_fd, (char*)hbuff, samps, 0 ); |
550 |
free(hbuff); |
551 |
} |
552 |
else |
553 |
res = quicktime_write_audio( lav_file->qt_fd, (char*)buff, samps, 0 ); |
554 |
break; |
540 |
break; |
555 |
#endif |
541 |
#endif |
556 |
default: |
542 |
default: |
Lines 818-830
Link Here
|
818 |
long lav_read_audio(lav_file_t *lav_file, uint8_t *audbuf, long samps) |
804 |
long lav_read_audio(lav_file_t *lav_file, uint8_t *audbuf, long samps) |
819 |
{ |
805 |
{ |
820 |
#ifdef HAVE_LIBQUICKTIME |
806 |
#ifdef HAVE_LIBQUICKTIME |
821 |
long res, n, t; |
807 |
int64_t last_pos, start_pos; |
|
|
808 |
int res; |
822 |
#endif |
809 |
#endif |
823 |
|
810 |
|
824 |
if(!lav_file->has_audio) |
811 |
if(!lav_file->has_audio) |
825 |
{ |
812 |
{ |
826 |
internal_error = ERROR_NOAUDIO; |
813 |
internal_error = ERROR_NOAUDIO; |
827 |
return -1; |
814 |
return(-1); |
828 |
} |
815 |
} |
829 |
video_format = lav_file->format; internal_error = 0; /* for error messages */ |
816 |
video_format = lav_file->format; internal_error = 0; /* for error messages */ |
830 |
switch(lav_file->format) |
817 |
switch(lav_file->format) |
Lines 834-851
Link Here
|
834 |
return AVI_read_audio(lav_file->avi_fd,audbuf,samps*lav_file->bps)/lav_file->bps; |
821 |
return AVI_read_audio(lav_file->avi_fd,audbuf,samps*lav_file->bps)/lav_file->bps; |
835 |
#ifdef HAVE_LIBQUICKTIME |
822 |
#ifdef HAVE_LIBQUICKTIME |
836 |
case 'q': |
823 |
case 'q': |
837 |
res = quicktime_read_audio(lav_file->qt_fd,(char*)audbuf,samps,0)/lav_file->bps; |
824 |
start_pos = quicktime_audio_position(lav_file->qt_fd, 0); |
838 |
if(res<=0) return res; |
825 |
res = lqt_decode_audio_track(lav_file->qt_fd, (int16_t **)audbuf, NULL, samps, 0); |
839 |
if(lav_audio_bits(lav_file)==16) |
826 |
if (res <= 0) |
840 |
{ |
827 |
return(res); |
841 |
for(n=0;n<res*2*lav_audio_channels(lav_file);n+=2) |
828 |
last_pos = lqt_last_audio_position(lav_file->qt_fd, 0); |
842 |
{ |
829 |
res = last_pos - start_pos; |
843 |
t = audbuf[n]; |
830 |
res /= lav_file->bps; /* XXX */ |
844 |
audbuf[n] = audbuf[n+1]; |
831 |
return(res); |
845 |
audbuf[n+1] = t; |
|
|
846 |
} |
847 |
} |
848 |
return res; |
849 |
#endif |
832 |
#endif |
850 |
} |
833 |
} |
851 |
return -1; |
834 |
return -1; |
Lines 878-885
Link Here
|
878 |
lav_fd->qt_fd = 0; |
861 |
lav_fd->qt_fd = 0; |
879 |
lav_fd->format = 0; |
862 |
lav_fd->format = 0; |
880 |
lav_fd->interlacing = LAV_INTER_UNKNOWN; |
863 |
lav_fd->interlacing = LAV_INTER_UNKNOWN; |
881 |
lav_fd->sar_w = 0; /* (0,0) == unknown */ |
864 |
lav_fd->sar_w = 1; /* unknown - assume square pixels */ |
882 |
lav_fd->sar_h = 0; |
865 |
lav_fd->sar_h = 1; |
883 |
lav_fd->has_audio = 0; |
866 |
lav_fd->has_audio = 0; |
884 |
lav_fd->bps = 0; |
867 |
lav_fd->bps = 0; |
885 |
lav_fd->is_MJPG = 0; |
868 |
lav_fd->is_MJPG = 0; |