Log in

View Full Version : read only error writing an avi stream(AVIERR_READONLY)


shin_san
17th May 2006, 06:52
I take AVI frames and filter them. I want to write each frame in the same avi file, instead of the non-filtered ones. For that I use this code:

int read_frame_avis( x264_picture_t *p_pic, hnd_t handle, int i_frame )
{
avis_input_t *h = (avis_input_t *)handle;
PAVISTREAM pStream = h->p_avi;
PGETFRAME pFrame;
p_pic->img.i_csp = X264_CSP_YV12;

if( AVIStreamRead(pStream, i_frame, 1, p_pic->img.plane[0], h->width * h->height * 3 / 2, NULL, NULL ) )
return -1;

pFrame=AVIStreamGetFrameOpen(pStream, NULL);
BYTE* frame = (BYTE*) AVIStreamGetFrame(pFrame, i_frame);

AVIStreamGetFrameClose(pFrame);

frameFiltered = filter(frame);

printf("READ only error ?:%d\n",AVIStreamWrite(pStream,i_frame,1,frameFiltered,h->width * h->height * 3 / 2,AVIIF_KEYFRAME,NULL,NULL));

return 0;
}

My problem is that AVIStreamWrite(...) generate a READONLY error
Anybody know why? Thank in advance.

squid_80
17th May 2006, 09:29
From MSDN: "The default AVI file handler supports writing only at the end of a stream."

shin_san
18th May 2006, 04:55
SORRY...
I have found an other way to code it, but it should be posted in x264 developpment...

Thanks again!