[ffmpeg] kill unused AVCodecParameters

This commit is contained in:
nick black 2021-11-20 16:52:34 -05:00
parent 3b950fc208
commit 10739673b2

View File

@ -25,9 +25,8 @@ typedef struct ncvisual_details {
struct AVFormatContext* fmtctx; struct AVFormatContext* fmtctx;
struct AVCodecContext* codecctx; // video codec context struct AVCodecContext* codecctx; // video codec context
struct AVCodecContext* subtcodecctx; // subtitle codec context struct AVCodecContext* subtcodecctx; // subtitle codec context
struct AVFrame* frame; // frame as read struct AVFrame* frame; // frame as read/loaded/converted
struct AVCodec* codec; struct AVCodec* codec;
struct AVCodecParameters* cparams;
struct AVCodec* subtcodec; struct AVCodec* subtcodec;
struct AVPacket* packet; struct AVPacket* packet;
struct SwsContext* swsctx; struct SwsContext* swsctx;
@ -377,7 +376,6 @@ ncvisual* ffmpeg_create(){
} }
ncvisual* ffmpeg_from_file(const char* filename){ ncvisual* ffmpeg_from_file(const char* filename){
AVStream* st;
ncvisual* ncv = ffmpeg_create(); ncvisual* ncv = ffmpeg_create();
if(ncv == NULL){ if(ncv == NULL){
// fprintf(stderr, "Couldn't create %s (%s)\n", filename, strerror(errno)); // fprintf(stderr, "Couldn't create %s (%s)\n", filename, strerror(errno));
@ -433,7 +431,7 @@ ncvisual* ffmpeg_from_file(const char* filename){
//fprintf(stderr, "Couldn't find decoder for %s\n", filename); //fprintf(stderr, "Couldn't find decoder for %s\n", filename);
goto err; goto err;
} }
st = ncv->details->fmtctx->streams[ncv->details->stream_index]; AVStream* st = ncv->details->fmtctx->streams[ncv->details->stream_index];
if((ncv->details->codecctx = avcodec_alloc_context3(ncv->details->codec)) == NULL){ if((ncv->details->codecctx = avcodec_alloc_context3(ncv->details->codec)) == NULL){
//fprintf(stderr, "Couldn't allocate decoder for %s\n", filename); //fprintf(stderr, "Couldn't allocate decoder for %s\n", filename);
goto err; goto err;
@ -445,14 +443,6 @@ ncvisual* ffmpeg_from_file(const char* filename){
//fprintf(stderr, "Couldn't open codec for %s (%s)\n", filename, av_err2str(*averr)); //fprintf(stderr, "Couldn't open codec for %s (%s)\n", filename, av_err2str(*averr));
goto err; goto err;
} }
/*if((ncv->cparams = avcodec_parameters_alloc()) == NULL){
//fprintf(stderr, "Couldn't allocate codec params for %s\n", filename);
goto err;
}
if((*averr = avcodec_parameters_from_context(ncv->cparams, ncv->details->codecctx)) < 0){
//fprintf(stderr, "Couldn't get codec params for %s (%s)\n", filename, av_err2str(*averr));
goto err;
}*/
//fprintf(stderr, "FRAME FRAME: %p\n", ncv->details->frame); //fprintf(stderr, "FRAME FRAME: %p\n", ncv->details->frame);
// frame is set up in prep_details(), so that format can be set there, as // frame is set up in prep_details(), so that format can be set there, as
// is necessary when it is prepared from inputs other than files. // is necessary when it is prepared from inputs other than files.
@ -694,7 +684,6 @@ void ffmpeg_details_destroy(ncvisual_details* deets){
avcodec_free_context(&deets->subtcodecctx); avcodec_free_context(&deets->subtcodecctx);
avcodec_free_context(&deets->codecctx); avcodec_free_context(&deets->codecctx);
av_frame_free(&deets->frame); av_frame_free(&deets->frame);
//avcodec_parameters_free(&ncv->cparams);
sws_freeContext(deets->rgbactx); sws_freeContext(deets->rgbactx);
sws_freeContext(deets->swsctx); sws_freeContext(deets->swsctx);
av_packet_free(&deets->packet); av_packet_free(&deets->packet);