参考:http://www.rosoo.net/a/201006/9659.html
- Decode()
- {
- FILE * inpf;
-
- int nWrite;
- int i,p;
- int nalLen;
- unsigned char* Buf;
- int got_picture, consumed_bytes;
- unsigned char *DisplayBuf;
- DisplayBuf=(unsigned char *)malloc(60000);
-
- char outfile[] = "test.pgm";
-
-
- inpf = fopen("test.264", "rb");
-
-
-
- if(!inpf)
- {
- goto Decodereturn;
- }
-
- nalLen = 0;
- Buf = (unsigned char*)calloc ( 1000000, sizeof(char));
-
-
- avcodec_init();
- avcodec_register_all();
- codec = avcodec_find_decoder(CODEC_ID_H264);
-
- if (!codec) {
- return 0;
- }
-
-
- c = avcodec_alloc_context();
-
- if(!c){
- return 0;
- }
-
-