equal
deleted
inserted
replaced
24 #include "libavformat/avformat.h" |
24 #include "libavformat/avformat.h" |
25 #include "libavutil/mathematics.h" |
25 #include "libavutil/mathematics.h" |
26 |
26 |
27 #ifndef AVIO_FLAG_WRITE |
27 #ifndef AVIO_FLAG_WRITE |
28 #define AVIO_FLAG_WRITE AVIO_WRONLY |
28 #define AVIO_FLAG_WRITE AVIO_WRONLY |
|
29 #endif |
|
30 |
|
31 #if (defined _MSC_VER) |
|
32 #define AVWRAP_DECL __declspec(dllexport) |
|
33 #elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun)) |
|
34 #define AVWRAP_DECL __attribute__((visibility("default"))) |
|
35 #else |
|
36 #define AVWRAP_DECL |
29 #endif |
37 #endif |
30 |
38 |
31 static AVFormatContext* g_pContainer; |
39 static AVFormatContext* g_pContainer; |
32 static AVOutputFormat* g_pFormat; |
40 static AVOutputFormat* g_pFormat; |
33 static AVStream* g_pAStream; |
41 static AVStream* g_pAStream; |
369 |
377 |
370 return 1; |
378 return 1; |
371 } |
379 } |
372 } |
380 } |
373 |
381 |
374 void AVWrapper_WriteFrame(uint8_t* pY, uint8_t* pCb, uint8_t* pCr) |
382 AVWRAP_DECL void AVWrapper_WriteFrame(uint8_t* pY, uint8_t* pCb, uint8_t* pCr) |
375 { |
383 { |
376 g_pVFrame->data[0] = pY; |
384 g_pVFrame->data[0] = pY; |
377 g_pVFrame->data[1] = pCb; |
385 g_pVFrame->data[1] = pCb; |
378 g_pVFrame->data[2] = pCr; |
386 g_pVFrame->data[2] = pCr; |
379 WriteFrame(g_pVFrame); |
387 WriteFrame(g_pVFrame); |
380 } |
388 } |
381 |
389 |
382 void AVWrapper_Init( |
390 AVWRAP_DECL void AVWrapper_Init( |
383 void (*pAddFileLogRaw)(const char*), |
391 void (*pAddFileLogRaw)(const char*), |
384 const char* pFilename, |
392 const char* pFilename, |
385 const char* pDesc, |
393 const char* pDesc, |
386 const char* pSoundFile, |
394 const char* pSoundFile, |
387 const char* pFormatName, |
395 const char* pFormatName, |
470 avformat_write_header(g_pContainer, NULL); |
478 avformat_write_header(g_pContainer, NULL); |
471 |
479 |
472 g_pVFrame->pts = -1; |
480 g_pVFrame->pts = -1; |
473 } |
481 } |
474 |
482 |
475 void AVWrapper_Close() |
483 AVWRAP_DECL void AVWrapper_Close() |
476 { |
484 { |
477 // output buffered frames |
485 // output buffered frames |
478 if (g_pVCodec->capabilities & CODEC_CAP_DELAY) |
486 if (g_pVCodec->capabilities & CODEC_CAP_DELAY) |
479 while( WriteFrame(NULL) ); |
487 while( WriteFrame(NULL) ); |
480 // output any remaining audio |
488 // output any remaining audio |