2

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.

HMD
  • 2,202
  • 6
  • 24
  • 37

1 Answers1

0
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.

C.yixian
  • 49
  • 5
  • 1
    Thanks for your response, I tested it and `av_opt_get_int` returns -1 on this elements. I can get some elements of `AVCodecContext` with this method but not this one. – HMD Apr 09 '18 at 08:05