MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / close_audio

Method close_audio

src/FFmpegWriter.cpp:931–959  ·  view source on GitHub ↗

Close the audio codec

Source from the content-addressed store, hash-verified

929
930// Close the audio codec
931void FFmpegWriter::close_audio(AVFormatContext *oc, AVStream *st)
932{
933 // Clear buffers
934 delete[] samples;
935 delete[] audio_outbuf;
936 delete[] audio_encoder_buffer;
937 samples = NULL;
938 audio_outbuf = NULL;
939 audio_encoder_buffer = NULL;
940
941 // Deallocate resample buffer
942 if (avr) {
943 SWR_CLOSE(avr);
944 SWR_FREE(&avr);
945 avr = NULL;
946 }
947
948 if (avr_planar) {
949 SWR_CLOSE(avr_planar);
950 SWR_FREE(&avr_planar);
951 avr_planar = NULL;
952 }
953
954 // Free any previous memory allocations
955 if (audio_codec_ctx != nullptr) {
956 AV_FREE_CONTEXT(audio_codec_ctx);
957 av_free(audio_codec_ctx);
958 }
959}
960
961// Close the writer
962void FFmpegWriter::Close() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected