]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/omapdrmtest.git/blobdiff - viddec3test.c
viddec3test: dce_buf_lock & unlock of OutBuf_fd
[glsdk/omapdrmtest.git] / viddec3test.c
index dc50391a1d8432e54af66bdf6a90dc9991dbe964..3788d6eef8553ba0210a0c5d39b58393d1f6b275 100644 (file)
@@ -125,10 +125,10 @@ decoder_close(struct decoder *decoder)
 static struct decoder *
 decoder_open(int argc, char **argv)
 {
-       struct decoder *decoder = NULL;
+       static struct decoder *decoder = NULL;
        char *infile = NULL;
        int i;
-       int width, height, padded_width, padded_height;
+       static int width, height, padded_width, padded_height;
        Engine_Error ec;
        XDAS_Int32 err;
 
@@ -350,6 +350,22 @@ decoder_process(struct decoder *decoder)
                                        return -1;
                                }
                                decoder->lastOutBuf = buf;
+
+                                inArgs->inputID = (XDAS_Int32)buf;
+                                outBufs->descs[0].buf = buf->fd[0];
+                                outBufs->descs[1].buf = (buf->multiplanar) ?buf->fd[1]:(XDAS_Int8 *)((outBufs->descs[0].buf));
+
+                                if(buf->multiplanar){
+                                    decoder->outBuf_fd[0] = buf->fd[0];
+                                    decoder->outBuf_fd[1] = buf->fd[1];
+                                    dce_buf_lock(2,decoder->outBuf_fd);
+                                }
+                                else{
+                                    decoder->outBuf_fd[0] = buf->fd[0];
+                                    dce_buf_lock(1,decoder->outBuf_fd);
+                                }
+                                decoder->outBufs->descs[0].bufSize.bytes =decoder->padded_width*decoder->padded_height;
+                                decoder->outBufs->descs[1].bufSize.bytes = decoder->padded_width* (decoder->padded_height/2);
                        }
                        else{
                                /*For second field decoding, send last output buffer
@@ -387,26 +403,6 @@ decoder_process(struct decoder *decoder)
                break;
        }
 
-        /*set the parameters if it is not the end of file */
-       if (!eof) {
-               inArgs->inputID = (XDAS_Int32)buf;
-               outBufs->descs[0].buf = buf->fd[0];
-               outBufs->descs[1].buf = (buf->multiplanar) ?buf->fd[1]:(XDAS_Int8 *)((outBufs->descs[0].buf));
-
-               if(decoder->outBufsInUseFlag == XDAS_FALSE){
-                       if(buf->multiplanar){
-                               decoder->outBuf_fd[0] = buf->fd[0];
-                               decoder->outBuf_fd[1] = buf->fd[1];
-                               dce_buf_lock(2,decoder->outBuf_fd);
-                       }
-                       else{
-                               decoder->outBuf_fd[0] = buf->fd[0];
-                               dce_buf_lock(1,decoder->outBuf_fd);
-                       }
-                       decoder->outBufs->descs[0].bufSize.bytes =decoder->padded_width*decoder->padded_height;
-                       decoder->outBufs->descs[1].bufSize.bytes = decoder->padded_width* (decoder->padded_height/2);
-               }
-       }
 
        do {
                if (no_process) {
@@ -463,7 +459,7 @@ decoder_process(struct decoder *decoder)
                }
 
                if(freeBufCount){
-            if(!eof)dce_buf_unlock(freeBufCount,decoder->outBuf_fd);
+                       dce_buf_unlock(freeBufCount,decoder->outBuf_fd);
                        freeBufCount =0;
                }