HMD
HMD

Reputation: 2226

ffmpeg - Access elements of AVCodecContext

I want to access some members of my AVCodecContext *av_ctx in my program. It is fine when I compile it in 32bit version, But when I change it to 64bit this elements act like they been shifted.

For example, I want to get av_ctx->coded_width and av_ctx->coded_height (sometimes they are different from av_ctx->width and av_ctx->height) and store them in some variables. Now when I debug this program in 32bit version it's Ok, but in 64bit version this values are wrong and when I check my structure I can see the next two elements (av_ctx->gop_size and av_ctx->pix_fmt) has the values that I want.

I checked AVCodecContext declaration on avcodec.h and it (in comments above structure declaration) says:

Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user applications.

I think this might be the right way to get these elements but I don't know what is this AVOptions, I searched it but couldn't find what is it exactly and how can I use it.

Upvotes: 2

Views: 464

Answers (1)

C.yixian
C.yixian

Reputation: 49

int64_t cheight = 0; 
av_opt_set_int(av_ctx,"coded_height", 400, 0); 
av_opt_get_int(av_ctx,"coded_height", 0, &cheight);

maybe you can try this.

Upvotes: 0

Related Questions