Hi,
I'm using J6 EVM (REV H), which is running in QNX.
I'm trying to encode a YUV file to H.264 file.
Encoder library Initialization, Encode Instance Creation is success.
After starting the encoder, when i tried to read the frame using "enc_read_frame", i'm not able to read any frame.
I have attached my source code for your reference.
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <stdint.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> #include <errno.h> #include <time.h> #include <sys/mman.h> #include <semaphore.h> #include <pthread.h> #include <sched.h> #include "libdce.h" #include "dce_enc.h" //#define PRINT_DEBUG //#define PRINT_INFO #define ERROR(FMT, ...) printf("%s:%d:\t%s\terror: " FMT "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) // enable below to print debug information #ifdef PRINT_DEBUG #define DEBUG(FMT, ...) printf("%s:%d:\t%s\tdebug: " FMT "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) #else #define DEBUG(FMT, ...) #endif #ifdef PRINT_INFO #define INFO(FMT, ...) printf("%s:%d:\t%s\tinfo: " FMT "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) #else #define INFO(FMT, ...) #endif #define NUM_CHANNELS 2 #define ENC_STACK_SIZE 32768 void main() { handle_t EncHdl; /**< Used to store the handle of an encoder instance */ enc_props_t NavCfg; char *payload; unsigned int len; payload = (char*)malloc(720*1280); if(payload == NULL) { printf("Unable to allocate memory\n"); } int l_i32Return= 0; if(-1 == enc_init()) { printf("Failed to initialize the encoder library" ); } else { printf("Encoder library Initialization - Success\n" ); {/*Navigation Configuration*/ NavCfg.height = 720; NavCfg.width = 1280; NavCfg.output_height = 720; NavCfg.output_width = 1280; NavCfg.level = 50; NavCfg.framerate = 30; NavCfg.enc_th_priority = 35; NavCfg.scr_cap_th_priority = 35; strcpy(NavCfg.profile,"high"); NavCfg.input_source = ENC_SOURCE_FILE; NavCfg.in_file ="/tmp/sfish_p1280x720_30fps_420pl_60fr_nv12_720p.yuv"; NavCfg.output_sink = ENC_SINK_FILE; NavCfg.out_file = "/tmp/OutEnc3.h264"; } if(-1 == enc_create(&EncHdl, &NavCfg)) { printf("Unable to create an encoder instance\n"); } else { printf("create an encoder instance - Success\n"); if(-1 == enc_start(EncHdl)) { printf("Unable to start the encoder instance\n"); } else { printf("successfully started the encoder instance\n"); while(1) { l_i32Return = enc_read_frame(EncHdl, payload, &len, 125); if(l_i32Return == 0 && len>0) { printf( "Read from the encoder -Success\n"); } else { printf( "Unable to read from the encoder %d - %d\n",len, l_i32Return); break; } } } } } }
Kindly let me know, whether the input parameters what i'm setting is fine or not.
While debugging the source code of video encoder, it is getting failed while reading from "get_list_head" in enc_read_frame function (File : bsp-TI-DRA74x-OMAP5-SDP6.6\bsp-TI-DRA74x-OMAP5-SDP6.6\src\utils\videolib\videnc\dce_enc.c)
Kindly do the needful to resolve the issue.