mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
Merge pull request #4107 from SpecLad:libav-compat
This commit is contained in:
commit
b7c2a46830
2
3rdparty/ffmpeg/ffmpeg_version.cmake
vendored
2
3rdparty/ffmpeg/ffmpeg_version.cmake
vendored
@ -3,9 +3,11 @@ set(HAVE_FFMPEG_CODEC 1)
|
||||
set(HAVE_FFMPEG_FORMAT 1)
|
||||
set(HAVE_FFMPEG_UTIL 1)
|
||||
set(HAVE_FFMPEG_SWSCALE 1)
|
||||
set(HAVE_FFMPEG_RESAMPLE 0)
|
||||
set(HAVE_GENTOO_FFMPEG 1)
|
||||
|
||||
set(ALIASOF_libavcodec_VERSION 55.18.102)
|
||||
set(ALIASOF_libavformat_VERSION 55.12.100)
|
||||
set(ALIASOF_libavutil_VERSION 52.38.100)
|
||||
set(ALIASOF_libswscale_VERSION 2.3.100)
|
||||
set(ALIASOF_libavresample_VERSION 1.0.1)
|
@ -889,6 +889,7 @@ if(DEFINED WITH_FFMPEG)
|
||||
status(" format:" HAVE_FFMPEG_FORMAT THEN "YES (ver ${ALIASOF_libavformat_VERSION})" ELSE NO)
|
||||
status(" util:" HAVE_FFMPEG_UTIL THEN "YES (ver ${ALIASOF_libavutil_VERSION})" ELSE NO)
|
||||
status(" swscale:" HAVE_FFMPEG_SWSCALE THEN "YES (ver ${ALIASOF_libswscale_VERSION})" ELSE NO)
|
||||
status(" resample:" HAVE_FFMPEG_RESAMPLE THEN "YES (ver ${ALIASOF_libavresample_VERSION})" ELSE NO)
|
||||
status(" gentoo-style:" HAVE_GENTOO_FFMPEG THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_FFMPEG)
|
||||
|
||||
|
@ -190,7 +190,7 @@ if(WITH_XIMEA)
|
||||
endif(WITH_XIMEA)
|
||||
|
||||
# --- FFMPEG ---
|
||||
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
|
||||
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_FFMPEG_RESAMPLE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
|
||||
if(WITH_FFMPEG)
|
||||
if(WIN32 AND NOT ARM)
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake")
|
||||
@ -199,6 +199,7 @@ if(WITH_FFMPEG)
|
||||
CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
|
||||
CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
|
||||
CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
|
||||
CHECK_MODULE(libavresample HAVE_FFMPEG_RESAMPLE)
|
||||
|
||||
CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
|
||||
CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
|
||||
|
@ -792,7 +792,9 @@ double CvCapture_FFMPEG::getProperty( int property_id )
|
||||
case CV_FFMPEG_CAP_PROP_FRAME_HEIGHT:
|
||||
return (double)frame.height;
|
||||
case CV_FFMPEG_CAP_PROP_FPS:
|
||||
#if LIBAVCODEC_BUILD > 4753
|
||||
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
|
||||
return av_q2d(video_st->avg_frame_rate);
|
||||
#elif LIBAVCODEC_BUILD > 4753
|
||||
return av_q2d(video_st->r_frame_rate);
|
||||
#else
|
||||
return (double)video_st->codec.frame_rate
|
||||
@ -840,7 +842,11 @@ int CvCapture_FFMPEG::get_bitrate()
|
||||
|
||||
double CvCapture_FFMPEG::get_fps()
|
||||
{
|
||||
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
|
||||
double fps = r2d(ic->streams[video_stream]->avg_frame_rate);
|
||||
#else
|
||||
double fps = r2d(ic->streams[video_stream]->r_frame_rate);
|
||||
#endif
|
||||
|
||||
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
|
||||
if (fps < eps_zero)
|
||||
@ -1001,6 +1007,7 @@ struct CvVideoWriter_FFMPEG
|
||||
int input_pix_fmt;
|
||||
Image_FFMPEG temp_image;
|
||||
int frame_width, frame_height;
|
||||
int frame_idx;
|
||||
bool ok;
|
||||
struct SwsContext *img_convert_ctx;
|
||||
};
|
||||
@ -1078,6 +1085,7 @@ void CvVideoWriter_FFMPEG::init()
|
||||
memset(&temp_image, 0, sizeof(temp_image));
|
||||
img_convert_ctx = 0;
|
||||
frame_width = frame_height = 0;
|
||||
frame_idx = 0;
|
||||
ok = false;
|
||||
}
|
||||
|
||||
@ -1228,15 +1236,20 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc,
|
||||
|
||||
static const int OPENCV_NO_FRAMES_WRITTEN_CODE = 1000;
|
||||
|
||||
static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, uint8_t * outbuf, uint32_t outbuf_size, AVFrame * picture )
|
||||
static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st,
|
||||
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
|
||||
uint8_t *, uint32_t,
|
||||
#else
|
||||
uint8_t * outbuf, uint32_t outbuf_size,
|
||||
#endif
|
||||
AVFrame * picture )
|
||||
{
|
||||
#if LIBAVFORMAT_BUILD > 4628
|
||||
AVCodecContext * c = video_st->codec;
|
||||
#else
|
||||
AVCodecContext * c = &(video_st->codec);
|
||||
#endif
|
||||
int out_size;
|
||||
int ret = 0;
|
||||
int ret = OPENCV_NO_FRAMES_WRITTEN_CODE;
|
||||
|
||||
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
|
||||
/* raw video case. The API will change slightly in the near
|
||||
@ -1256,12 +1269,32 @@ static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st,
|
||||
ret = av_write_frame(oc, &pkt);
|
||||
} else {
|
||||
/* encode the image */
|
||||
out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
|
||||
int got_output = 0;
|
||||
pkt.data = NULL;
|
||||
pkt.size = 0;
|
||||
ret = avcodec_encode_video2(c, &pkt, picture, &got_output);
|
||||
if (ret < 0)
|
||||
;
|
||||
else if (got_output) {
|
||||
if (pkt.pts != (int64_t)AV_NOPTS_VALUE)
|
||||
pkt.pts = av_rescale_q(pkt.pts, c->time_base, video_st->time_base);
|
||||
if (pkt.dts != (int64_t)AV_NOPTS_VALUE)
|
||||
pkt.dts = av_rescale_q(pkt.dts, c->time_base, video_st->time_base);
|
||||
if (pkt.duration)
|
||||
pkt.duration = av_rescale_q(pkt.duration, c->time_base, video_st->time_base);
|
||||
pkt.stream_index= video_st->index;
|
||||
ret = av_write_frame(oc, &pkt);
|
||||
av_free_packet(&pkt);
|
||||
}
|
||||
else
|
||||
ret = OPENCV_NO_FRAMES_WRITTEN_CODE;
|
||||
#else
|
||||
int out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
|
||||
/* if zero size, it means the image was buffered */
|
||||
if (out_size > 0) {
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
|
||||
#if LIBAVFORMAT_BUILD > 4752
|
||||
if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE)
|
||||
pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_st->time_base);
|
||||
@ -1276,9 +1309,8 @@ static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st,
|
||||
|
||||
/* write the compressed frame in the media file */
|
||||
ret = av_write_frame(oc, &pkt);
|
||||
} else {
|
||||
ret = OPENCV_NO_FRAMES_WRITTEN_CODE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1385,7 +1417,9 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int
|
||||
(PixelFormat)input_pix_fmt, width, height);
|
||||
}
|
||||
|
||||
picture->pts = frame_idx;
|
||||
ret = icv_av_write_frame_FFMPEG( oc, video_st, outbuf, outbuf_size, picture) >= 0;
|
||||
frame_idx++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1697,6 +1731,7 @@ bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc,
|
||||
}
|
||||
frame_width = width;
|
||||
frame_height = height;
|
||||
frame_idx = 0;
|
||||
ok = true;
|
||||
|
||||
return true;
|
||||
|
@ -100,160 +100,224 @@ typedef struct AVCodecTag {
|
||||
unsigned int tag;
|
||||
} AVCodecTag;
|
||||
|
||||
#if (LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(54, 51, 100))
|
||||
#define AV_CODEC_ID_H264 CODEC_ID_H264
|
||||
#define AV_CODEC_ID_H263 CODEC_ID_H263
|
||||
#define AV_CODEC_ID_H263P CODEC_ID_H263P
|
||||
#define AV_CODEC_ID_H263I CODEC_ID_H263I
|
||||
#define AV_CODEC_ID_H261 CODEC_ID_H261
|
||||
#define AV_CODEC_ID_MPEG4 CODEC_ID_MPEG4
|
||||
#define AV_CODEC_ID_MSMPEG4V3 CODEC_ID_MSMPEG4V3
|
||||
#define AV_CODEC_ID_MSMPEG4V2 CODEC_ID_MSMPEG4V2
|
||||
#define AV_CODEC_ID_MSMPEG4V1 CODEC_ID_MSMPEG4V1
|
||||
#define AV_CODEC_ID_WMV1 CODEC_ID_WMV1
|
||||
#define AV_CODEC_ID_WMV2 CODEC_ID_WMV1
|
||||
#define AV_CODEC_ID_DVVIDEO CODEC_ID_DVVIDEO
|
||||
#define AV_CODEC_ID_MPEG1VIDEO CODEC_ID_MPEG1VIDEO
|
||||
#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
|
||||
#define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG
|
||||
#define AV_CODEC_ID_LJPEG CODEC_ID_LJPEG
|
||||
#define AV_CODEC_ID_HUFFYUV CODEC_ID_HUFFYUV
|
||||
#define AV_CODEC_ID_FFVHUFF CODEC_ID_FFVHUFF
|
||||
#define AV_CODEC_ID_CYUV CODEC_ID_CYUV
|
||||
#define AV_CODEC_ID_RAWVIDEO CODEC_ID_RAWVIDEO
|
||||
#define AV_CODEC_ID_INDEO3 CODEC_ID_INDEO3
|
||||
#define AV_CODEC_ID_VP3 CODEC_ID_VP3
|
||||
#define AV_CODEC_ID_ASV1 CODEC_ID_ASV1
|
||||
#define AV_CODEC_ID_ASV2 CODEC_ID_ASV2
|
||||
#define AV_CODEC_ID_VCR1 CODEC_ID_VCR1
|
||||
#define AV_CODEC_ID_FFV1 CODEC_ID_FFV1
|
||||
#define AV_CODEC_ID_XAN_WC4 CODEC_ID_XAN_WC4
|
||||
#define AV_CODEC_ID_MSRLE CODEC_ID_MSRLE
|
||||
#define AV_CODEC_ID_MSVIDEO1 CODEC_ID_MSVIDEO1
|
||||
#define AV_CODEC_ID_CINEPAK CODEC_ID_CINEPAK
|
||||
#define AV_CODEC_ID_TRUEMOTION1 CODEC_ID_TRUEMOTION1
|
||||
#define AV_CODEC_ID_MSZH CODEC_ID_MSZH
|
||||
#define AV_CODEC_ID_ZLIB CODEC_ID_ZLIB
|
||||
#define AV_CODEC_ID_SNOW CODEC_ID_SNOW
|
||||
#define AV_CODEC_ID_4XM CODEC_ID_4XM
|
||||
#define AV_CODEC_ID_FLV1 CODEC_ID_FLV1
|
||||
#define AV_CODEC_ID_SVQ1 CODEC_ID_SVQ1
|
||||
#define AV_CODEC_ID_TSCC CODEC_ID_TSCC
|
||||
#define AV_CODEC_ID_ULTI CODEC_ID_ULTI
|
||||
#define AV_CODEC_ID_VIXL CODEC_ID_VIXL
|
||||
#define AV_CODEC_ID_QPEG CODEC_ID_QPEG
|
||||
#define AV_CODEC_ID_WMV3 CODEC_ID_WMV3
|
||||
#define AV_CODEC_ID_LOCO CODEC_ID_LOCO
|
||||
#define AV_CODEC_ID_THEORA CODEC_ID_THEORA
|
||||
#define AV_CODEC_ID_WNV1 CODEC_ID_WNV1
|
||||
#define AV_CODEC_ID_AASC CODEC_ID_AASC
|
||||
#define AV_CODEC_ID_INDEO2 CODEC_ID_INDEO2
|
||||
#define AV_CODEC_ID_FRAPS CODEC_ID_FRAPS
|
||||
#define AV_CODEC_ID_TRUEMOTION2 CODEC_ID_TRUEMOTION2
|
||||
#define AV_CODEC_ID_FLASHSV CODEC_ID_FLASHSV
|
||||
#define AV_CODEC_ID_JPEGLS CODEC_ID_JPEGLS
|
||||
#define AV_CODEC_ID_VC1 CODEC_ID_VC1
|
||||
#define AV_CODEC_ID_CSCD CODEC_ID_CSCD
|
||||
#define AV_CODEC_ID_ZMBV CODEC_ID_ZMBV
|
||||
#define AV_CODEC_ID_KMVC CODEC_ID_KMVC
|
||||
#define AV_CODEC_ID_VP5 CODEC_ID_VP5
|
||||
#define AV_CODEC_ID_VP6 CODEC_ID_VP6
|
||||
#define AV_CODEC_ID_VP6F CODEC_ID_VP6F
|
||||
#define AV_CODEC_ID_JPEG2000 CODEC_ID_JPEG2000
|
||||
#define AV_CODEC_ID_VMNC CODEC_ID_VMNC
|
||||
#define AV_CODEC_ID_TARGA CODEC_ID_TARGA
|
||||
#define AV_CODEC_ID_NONE CODEC_ID_NONE
|
||||
#endif
|
||||
|
||||
const AVCodecTag codec_bmp_tags[] = {
|
||||
{ CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
|
||||
{ CODEC_ID_H264, MKTAG('h', '2', '6', '4') },
|
||||
{ CODEC_ID_H264, MKTAG('X', '2', '6', '4') },
|
||||
{ CODEC_ID_H264, MKTAG('x', '2', '6', '4') },
|
||||
{ CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
|
||||
{ CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') },
|
||||
{ AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
|
||||
{ AV_CODEC_ID_H264, MKTAG('h', '2', '6', '4') },
|
||||
{ AV_CODEC_ID_H264, MKTAG('X', '2', '6', '4') },
|
||||
{ AV_CODEC_ID_H264, MKTAG('x', '2', '6', '4') },
|
||||
{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
|
||||
{ AV_CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') },
|
||||
|
||||
{ CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
|
||||
{ CODEC_ID_H263P, MKTAG('H', '2', '6', '3') },
|
||||
{ CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */
|
||||
{ CODEC_ID_H261, MKTAG('H', '2', '6', '1') },
|
||||
{ AV_CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
|
||||
{ AV_CODEC_ID_H263P, MKTAG('H', '2', '6', '3') },
|
||||
{ AV_CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */
|
||||
{ AV_CODEC_ID_H261, MKTAG('H', '2', '6', '1') },
|
||||
|
||||
/* added based on MPlayer */
|
||||
{ CODEC_ID_H263P, MKTAG('U', '2', '6', '3') },
|
||||
{ CODEC_ID_H263P, MKTAG('v', 'i', 'v', '1') },
|
||||
{ AV_CODEC_ID_H263P, MKTAG('U', '2', '6', '3') },
|
||||
{ AV_CODEC_ID_H263P, MKTAG('v', 'i', 'v', '1') },
|
||||
|
||||
{ CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
|
||||
{ CODEC_ID_MPEG4, MKTAG(0x04, 0, 0, 0) }, /* some broken avi use this */
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG(0x04, 0, 0, 0) }, /* some broken avi use this */
|
||||
|
||||
/* added based on MPlayer */
|
||||
{ CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') },
|
||||
{ CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') },
|
||||
|
||||
{ CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') },
|
||||
{ AV_CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') },
|
||||
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') }, /* default signature when using MSMPEG4 */
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') }, /* default signature when using MSMPEG4 */
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
|
||||
|
||||
/* added based on MPlayer */
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') },
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') },
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') },
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') },
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') },
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') },
|
||||
{ CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') },
|
||||
{ AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') },
|
||||
|
||||
{ CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') },
|
||||
{ AV_CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') },
|
||||
|
||||
/* added based on MPlayer */
|
||||
{ CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') },
|
||||
{ AV_CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') },
|
||||
|
||||
{ CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') },
|
||||
{ AV_CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') },
|
||||
|
||||
{ CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') },
|
||||
{ AV_CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') },
|
||||
|
||||
/* added based on MPlayer */
|
||||
{ CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') },
|
||||
{ CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') },
|
||||
{ CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') },
|
||||
{ CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') },
|
||||
{ CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') },
|
||||
{ CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') },
|
||||
{ CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') },
|
||||
{ CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') },
|
||||
{ CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') },
|
||||
{ CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') },
|
||||
{ CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') },
|
||||
{ CODEC_ID_MPEG1VIDEO, 0x10000001 },
|
||||
{ CODEC_ID_MPEG2VIDEO, 0x10000002 },
|
||||
{ CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') },
|
||||
{ CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') },
|
||||
{ CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
|
||||
{ CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') },
|
||||
{ CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') },
|
||||
{ CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */
|
||||
{ CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */
|
||||
{ CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') },
|
||||
{ CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') },
|
||||
{ CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') },
|
||||
{ CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') },
|
||||
{ CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') },
|
||||
{ CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') },
|
||||
{ CODEC_ID_RAWVIDEO, 0 },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') },
|
||||
{ CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },
|
||||
{ CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
|
||||
{ CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
|
||||
{ CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
|
||||
{ CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
|
||||
{ CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') },
|
||||
{ CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') },
|
||||
{ CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') },
|
||||
{ CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') },
|
||||
{ CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') },
|
||||
{ CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') },
|
||||
{ CODEC_ID_MSRLE, MKTAG(0x1, 0x0, 0x0, 0x0) },
|
||||
{ CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') },
|
||||
{ CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') },
|
||||
{ CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') },
|
||||
{ CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') },
|
||||
{ CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') },
|
||||
{ CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') },
|
||||
{ CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') },
|
||||
{ CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') },
|
||||
{ CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') },
|
||||
{ CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') },
|
||||
{ CODEC_ID_SNOW, MKTAG('S', 'N', 'O', 'W') },
|
||||
{ CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') },
|
||||
{ CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') },
|
||||
{ CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') },
|
||||
{ CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') },
|
||||
{ CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') },
|
||||
{ CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') },
|
||||
{ CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') },
|
||||
{ CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') },
|
||||
{ CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') },
|
||||
{ CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') },
|
||||
{ CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') },
|
||||
{ CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') },
|
||||
{ AV_CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') },
|
||||
{ AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') },
|
||||
{ AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') },
|
||||
{ AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') },
|
||||
{ AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') },
|
||||
{ AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') },
|
||||
{ AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') },
|
||||
{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') },
|
||||
{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') },
|
||||
{ AV_CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') },
|
||||
{ AV_CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') },
|
||||
{ AV_CODEC_ID_MPEG1VIDEO, 0x10000001 },
|
||||
{ AV_CODEC_ID_MPEG2VIDEO, 0x10000002 },
|
||||
{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') },
|
||||
{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') },
|
||||
{ AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
|
||||
{ AV_CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') },
|
||||
{ AV_CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') },
|
||||
{ AV_CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */
|
||||
{ AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */
|
||||
{ AV_CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') },
|
||||
{ AV_CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') },
|
||||
{ AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') },
|
||||
{ AV_CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') },
|
||||
{ AV_CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') },
|
||||
{ AV_CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, 0 },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') },
|
||||
{ AV_CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },
|
||||
{ AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
|
||||
{ AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
|
||||
{ AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
|
||||
{ AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
|
||||
{ AV_CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') },
|
||||
{ AV_CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') },
|
||||
{ AV_CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') },
|
||||
{ AV_CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') },
|
||||
{ AV_CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') },
|
||||
{ AV_CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') },
|
||||
{ AV_CODEC_ID_MSRLE, MKTAG(0x1, 0x0, 0x0, 0x0) },
|
||||
{ AV_CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') },
|
||||
{ AV_CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') },
|
||||
{ AV_CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') },
|
||||
{ AV_CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') },
|
||||
{ AV_CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') },
|
||||
{ AV_CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') },
|
||||
{ AV_CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') },
|
||||
{ AV_CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') },
|
||||
{ AV_CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') },
|
||||
{ AV_CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') },
|
||||
{ AV_CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') },
|
||||
{ AV_CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') },
|
||||
{ AV_CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') },
|
||||
{ AV_CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') },
|
||||
{ AV_CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') },
|
||||
{ AV_CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') },
|
||||
{ AV_CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') },
|
||||
{ AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') },
|
||||
{ AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') },
|
||||
{ AV_CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') },
|
||||
{ AV_CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') },
|
||||
{ AV_CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') },
|
||||
#if LIBAVCODEC_VERSION_INT>0x000409
|
||||
{ CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') },
|
||||
{ CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') },
|
||||
{ CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') },
|
||||
{ CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') },
|
||||
{ CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') },
|
||||
{ AV_CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') },
|
||||
{ AV_CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') },
|
||||
{ AV_CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') },
|
||||
{ AV_CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') },
|
||||
{ AV_CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') },
|
||||
#endif
|
||||
#if LIBAVCODEC_VERSION_INT>((50<<16)+(1<<8)+0)
|
||||
{ CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') },
|
||||
{ CODEC_ID_JPEGLS,MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */
|
||||
{ CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') },
|
||||
{ CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') },
|
||||
{ CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') },
|
||||
{ CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
|
||||
{ CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
|
||||
{ AV_CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') },
|
||||
{ AV_CODEC_ID_JPEGLS,MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */
|
||||
{ AV_CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') },
|
||||
{ AV_CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') },
|
||||
{ AV_CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') },
|
||||
{ AV_CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
|
||||
{ AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
|
||||
#endif
|
||||
#if LIBAVCODEC_VERSION_INT>((51<<16)+(11<<8)+0)
|
||||
{ CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
|
||||
{ CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
|
||||
{ CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
|
||||
{ CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
|
||||
{ CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') },
|
||||
{ CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
|
||||
{ CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') },
|
||||
{ AV_CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
|
||||
{ AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
|
||||
{ AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
|
||||
{ AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
|
||||
{ AV_CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') },
|
||||
{ AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
|
||||
{ AV_CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') },
|
||||
#endif
|
||||
#if LIBAVCODEC_VERSION_INT>=((51<<16)+(49<<8)+0)
|
||||
// this tag seems not to exist in older versions of FFMPEG
|
||||
{ CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
|
||||
{ AV_CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
|
||||
#endif
|
||||
{ CODEC_ID_NONE, 0 },
|
||||
{ AV_CODEC_ID_NONE, 0 },
|
||||
};
|
||||
|
@ -132,6 +132,7 @@ public:
|
||||
writer << img;
|
||||
}
|
||||
|
||||
writer.release();
|
||||
if (!created) created = true;
|
||||
else remove(filename.c_str());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user