|
|
|
@ -684,6 +684,10 @@ static void do_audio_out(AVFormatContext *s, |
|
|
|
|
|
|
|
|
|
ret = avcodec_encode_audio(enc, audio_out, audio_out_size, |
|
|
|
|
(short *)audio_buf); |
|
|
|
|
if (ret < 0) { |
|
|
|
|
fprintf(stderr, "Audio encoding failed\n"); |
|
|
|
|
av_exit(1); |
|
|
|
|
} |
|
|
|
|
audio_size += ret; |
|
|
|
|
pkt.stream_index= ost->index; |
|
|
|
|
pkt.data= audio_out; |
|
|
|
@ -711,6 +715,10 @@ static void do_audio_out(AVFormatContext *s, |
|
|
|
|
//FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio()
|
|
|
|
|
ret = avcodec_encode_audio(enc, audio_out, size_out, |
|
|
|
|
(short *)buftmp); |
|
|
|
|
if (ret < 0) { |
|
|
|
|
fprintf(stderr, "Audio encoding failed\n"); |
|
|
|
|
av_exit(1); |
|
|
|
|
} |
|
|
|
|
audio_size += ret; |
|
|
|
|
pkt.stream_index= ost->index; |
|
|
|
|
pkt.data= audio_out; |
|
|
|
@ -1456,11 +1464,19 @@ static int output_packet(AVInputStream *ist, int ist_index, |
|
|
|
|
if(ret <= 0) { |
|
|
|
|
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL); |
|
|
|
|
} |
|
|
|
|
if (ret < 0) { |
|
|
|
|
fprintf(stderr, "Audio encoding failed\n"); |
|
|
|
|
av_exit(1); |
|
|
|
|
} |
|
|
|
|
audio_size += ret; |
|
|
|
|
pkt.flags |= PKT_FLAG_KEY; |
|
|
|
|
break; |
|
|
|
|
case CODEC_TYPE_VIDEO: |
|
|
|
|
ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL); |
|
|
|
|
if (ret < 0) { |
|
|
|
|
fprintf(stderr, "Video encoding failed\n"); |
|
|
|
|
av_exit(1); |
|
|
|
|
} |
|
|
|
|
video_size += ret; |
|
|
|
|
if(enc->coded_frame && enc->coded_frame->key_frame) |
|
|
|
|
pkt.flags |= PKT_FLAG_KEY; |
|
|
|
|