Hi All,

I've been writing apps using libavcodec for several years without problem.

I recently wrote an app which pulls MPEG2 packets from satellite and decodes 
them with the software MPEG2VIDEO codec (CODEC_ID_MPEG2VIDEO).

Everything works great.

So now I want to take advantage of VDPAU (mainboard chipset = NVIDIA GeForce 
8200 mGPU)


All I changed in my code was this one line:

From: gCodec = avcodec_find_decoder(CODEC_ID_MPEG2VIDEO);

To: gCodec = avcodec_find_decoder_by_name("mpegvideo_vdpau");


    avcodec_init();
    avcodec_register_all();

    // find the mpeg2 video decoder
    gCodec = avcodec_find_decoder_by_name("mpegvideo_vdpau");
    if (!gCodec) {
        fprintf(stderr, "codecInit: Codec not found: mpegvideo_vdpau\n");
        return 1;
    }

    gContext = avcodec_alloc_context();
    gPicture = avcodec_alloc_frame();

    gContext->workaround_bugs = FF_BUG_AUTODETECT;
    gContext->error_concealment = FF_EC_GUESS_MVS;
    gContext->error_recognition = FF_ER_CAREFUL;
    gContext->thread_count = 2;

    if (avcodec_open(gContext, gCodec) < 0) {
        fprintf(stderr, "codecInit: Could not open codec\n");
        return 1;
    }

    ...
    <fill "inbuf" with MPEG2 compressed>
    ...

    len = avcodec_decode_video(gContext, gPicture, &got_picture, inbuf, size);
    if (len < 0) {
        fprintf(stderr, "codecDecode: Error while decoding frame %u\n", 
frame_num);
        return 1;
    }

    if (got_picture) ...


And I get a segment fault:

Program received signal SIGSEGV, Segmentation fault.
0x081e4b55 in ff_vdpau_mpeg_picture_complete (s=0x8d78b30, buf=0x861f200 "\217",
    buf_size=13667, slice_count=0) at libavcodec/vdpauvideo.c:187
187     render = (struct vdpau_render_state*)s->current_picture_ptr->data[0];

(gdb) bt
#0  0x081e4b55 in ff_vdpau_mpeg_picture_complete (s=0x8d78b30, buf=0x861f200 
"\217",
    buf_size=13667, slice_count=0) at libavcodec/vdpauvideo.c:187
#1  0x08217b68 in decode_chunks (avctx=0x8d786c0, picture=0x8d78a50, 
data_size=0xbffff6a0,
    buf=0x861f200 "\217", buf_size=13667) at libavcodec/mpeg12.c:2317
#2  0x08218570 in mpeg_decode_frame (avctx=0x8d786c0, data=0x8d78a50, 
data_size=0xbffff6a0,
    buf=0x861f200 "\217", buf_size=13667) at libavcodec/mpeg12.c:2289
#3  0x0805529e in avcodec_decode_video (avctx=0x8d786c0, picture=0x8d78a50,
    got_picture_ptr=0xbffff6a0, buf=0x861f200 "\217", buf_size=13667) at 
libavcodec/utils.c:508
#4  0x08050e9c in codecDecode (frame_num=1, inbuf=0x861f200 "\217", size=13667) 
at tsplay.c:446
#5  0x080510d4 in frameRender (frame_num=1, inbuf=0x861f200 "\217", 
inbuf_size=13667)
    at tsplay.c:540
#6  0x08050983 in main (argc=2, argv=0xbffff804) at tsplay.c:189
(gdb) list
182                                     int buf_size, int slice_count)
183 {
184     struct vdpau_render_state * render, * last, * next;
185     int i;
186
187     render = (struct vdpau_render_state*)s->current_picture_ptr->data[0];
188     assert(render);
189
190     /* fill VdpPictureInfoMPEG1Or2 struct */
191     render->info.mpeg.picture_structure          = s->picture_structure;


So, I'm assuming that I have to do something different to use the vdpau version 
of the MPEG2 codec?

What's the magic?

Any tips or pointers would be greatly appreciated!

Thanks,
Bob
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to