Skip to content

Commit

Permalink
bump ffmpeg version to 3.3, add --live, and --avdict for e.g. rstp tcp
Browse files Browse the repository at this point in the history
  • Loading branch information
rudcode committed Aug 7, 2017
1 parent cb3b3df commit 2a4ea90
Show file tree
Hide file tree
Showing 139 changed files with 469 additions and 19,512 deletions.
6 changes: 3 additions & 3 deletions BitstreamConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,15 @@ CBitstreamConverter::~CBitstreamConverter()
Close();
}

bool CBitstreamConverter::Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb)
bool CBitstreamConverter::Open(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb)
{
m_to_annexb = to_annexb;

m_codec = codec;

switch(codec)
{
case CODEC_ID_H264:
case AV_CODEC_ID_H264:
if (in_extrasize < 7 || in_extradata == NULL)
{
CLog::Log(LOGERROR, "CBitstreamConverter::Open avcC data too small or missing\n");
Expand Down Expand Up @@ -584,7 +584,7 @@ bool CBitstreamConverter::Convert(uint8_t *pData, int iSize)

if (pData)
{
if(m_codec == CODEC_ID_H264)
if(m_codec == AV_CODEC_ID_H264)
{
if(m_to_annexb)
{
Expand Down
43 changes: 0 additions & 43 deletions BitstreamConverter.d

This file was deleted.

5 changes: 2 additions & 3 deletions BitstreamConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <stdint.h>
#include "DllAvUtil.h"
#include "DllAvFormat.h"
#include "DllAvFilter.h"
#include "DllAvCodec.h"

typedef struct {
Expand Down Expand Up @@ -115,7 +114,7 @@ class CBitstreamConverter
static void skip_bits( bits_reader_t *br, int nbits );
static uint32_t get_bits( bits_reader_t *br, int nbits );

bool Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb);
bool Open(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb);
void Close(void);
bool NeedConvert(void) { return m_convert_bitstream; };
bool Convert(uint8_t *pData, int iSize);
Expand Down Expand Up @@ -164,7 +163,7 @@ class CBitstreamConverter
bool m_convert_bytestream;
DllAvUtil *m_dllAvUtil;
DllAvFormat *m_dllAvFormat;
CodecID m_codec;
AVCodecID m_codec;
};

#endif
65 changes: 31 additions & 34 deletions DllAvCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ class DllAvCodecInterface
virtual void avcodec_register_all(void)=0;
virtual void avcodec_flush_buffers(AVCodecContext *avctx)=0;
virtual int avcodec_open2_dont_call(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)=0;
virtual AVCodec *avcodec_find_decoder(enum CodecID id)=0;
virtual AVCodec *avcodec_find_encoder(enum CodecID id)=0;
virtual AVCodec *avcodec_find_decoder(enum AVCodecID id)=0;
virtual AVCodec *avcodec_find_encoder(enum AVCodecID id)=0;
virtual int avcodec_close_dont_call(AVCodecContext *avctx)=0;
virtual AVFrame *avcodec_alloc_frame(void)=0;
virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height)=0;
virtual AVFrame *av_frame_alloc(void)=0;
virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, AVPixelFormat pix_fmt, int width, int height)=0;
virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)=0;
virtual int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)=0;
virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)=0;
virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples)=0;
virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height)=0;
virtual int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)=0;
virtual int avpicture_get_size(AVPixelFormat pix_fmt, int width, int height)=0;
virtual AVCodecContext *avcodec_alloc_context3(AVCodec *codec)=0;
virtual void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)=0;
virtual void avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec)=0;
Expand All @@ -98,10 +98,9 @@ class DllAvCodecInterface
virtual void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc) =0;
virtual void avpicture_free(AVPicture *picture)=0;
virtual void av_free_packet(AVPacket *pkt)=0;
virtual int avpicture_alloc(AVPicture *picture, PixelFormat pix_fmt, int width, int height)=0;
virtual enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt)=0;
virtual int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic)=0;
virtual void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)=0;
virtual int avpicture_alloc(AVPicture *picture, AVPixelFormat pix_fmt, int width, int height)=0;
virtual enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt)=0;
virtual int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *pic, int flags)=0;
virtual AVCodec *av_codec_next(AVCodec *c)=0;
virtual int av_dup_packet(AVPacket *pkt)=0;
virtual void av_init_packet(AVPacket *pkt)=0;
Expand All @@ -125,19 +124,19 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
}
virtual int avcodec_open2_dont_call(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) { *(int *)0x0 = 0; return 0; }
virtual int avcodec_close_dont_call(AVCodecContext *avctx) { *(int *)0x0 = 0; return 0; }
virtual AVCodec *avcodec_find_decoder(enum CodecID id) { return ::avcodec_find_decoder(id); }
virtual AVCodec *avcodec_find_encoder(enum CodecID id) { return ::avcodec_find_encoder(id); }
virtual AVCodec *avcodec_find_decoder(enum AVCodecID id) { return ::avcodec_find_decoder(id); }
virtual AVCodec *avcodec_find_encoder(enum AVCodecID id) { return ::avcodec_find_encoder(id); }
virtual int avcodec_close(AVCodecContext *avctx)
{
return ::avcodec_close(avctx);
}
virtual AVFrame *avcodec_alloc_frame() { return ::avcodec_alloc_frame(); }
virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height) { return ::avpicture_fill(picture, ptr, pix_fmt, width, height); }
virtual AVFrame *av_frame_alloc() { return ::av_frame_alloc(); }
virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, AVPixelFormat pix_fmt, int width, int height) { return ::avpicture_fill(picture, ptr, pix_fmt, width, height); }
virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { return ::avcodec_decode_video2(avctx, picture, got_picture_ptr, avpkt); }
virtual int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt) { return ::avcodec_decode_audio4(avctx, frame, got_frame_ptr, avpkt); }
virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt) { return ::avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, avpkt); }
virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples) { return ::avcodec_encode_audio(avctx, buf, buf_size, samples); }
virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height) { return ::avpicture_get_size(pix_fmt, width, height); }
virtual int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { return ::avcodec_encode_audio2(avctx, avpkt, frame, got_packet_ptr); }
virtual int avpicture_get_size(AVPixelFormat pix_fmt, int width, int height) { return ::avpicture_get_size(pix_fmt, width, height); }
virtual AVCodecContext *avcodec_alloc_context3(AVCodec *codec) { return ::avcodec_alloc_context3(codec); }
virtual void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) { ::avcodec_string(buf, buf_size, enc, encode); }
virtual void avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec) { ::avcodec_get_context_defaults3(s, codec); }
Expand All @@ -160,10 +159,9 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface

virtual void avpicture_free(AVPicture *picture) { ::avpicture_free(picture); }
virtual void av_free_packet(AVPacket *pkt) { ::av_free_packet(pkt); }
virtual int avpicture_alloc(AVPicture *picture, PixelFormat pix_fmt, int width, int height) { return ::avpicture_alloc(picture, pix_fmt, width, height); }
virtual int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic) { return ::avcodec_default_get_buffer(s, pic); }
virtual void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic) { ::avcodec_default_release_buffer(s, pic); }
virtual enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt) { return ::avcodec_default_get_format(s, fmt); }
virtual int avpicture_alloc(AVPicture *picture, AVPixelFormat pix_fmt, int width, int height) { return ::avpicture_alloc(picture, pix_fmt, width, height); }
virtual int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *pic, int flags) { return ::avcodec_default_get_buffer2(s, pic, flags); }
virtual enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt) { return ::avcodec_default_get_format(s, fmt); }
virtual AVCodec *av_codec_next(AVCodec *c) { return ::av_codec_next(c); }

virtual int av_dup_packet(AVPacket *pkt) { return ::av_dup_packet(pkt); }
Expand All @@ -186,7 +184,7 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_video2, AVCodecContext*, AVFrame*, int*, AVPacket*)
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_audio4, AVCodecContext*, AVFrame*, int*, AVPacket*)
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_subtitle2, AVCodecContext*, AVSubtitle*, int*, AVPacket*)
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_encode_audio, AVCodecContext*, uint8_t*, int, const short*)
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_encode_audio2, avcodec_encode_audio2, *avctx, AVPacket *, const AVFrame *, int *)
DEFINE_FUNC_ALIGNED1(AVCodecContext*, __cdecl, avcodec_alloc_context3, AVCodec *)
DEFINE_FUNC_ALIGNED1(AVCodecParserContext*, __cdecl, av_parser_init, int)
DEFINE_FUNC_ALIGNED9(int, __cdecl, av_parser_parse2, AVCodecParserContext*,AVCodecContext*, uint8_t**, int*, const uint8_t*, int, int64_t, int64_t, int64_t)
Expand All @@ -196,12 +194,12 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
LOAD_SYMBOLS();

DEFINE_METHOD0(void, avcodec_register_all_dont_call)
DEFINE_METHOD1(AVCodec*, avcodec_find_decoder, (enum CodecID p1))
DEFINE_METHOD1(AVCodec*, avcodec_find_encoder, (enum CodecID p1))
DEFINE_METHOD1(AVCodec*, avcodec_find_decoder, (enum AVCodecID p1))
DEFINE_METHOD1(AVCodec*, avcodec_find_encoder, (enum AVCodecID p1))
DEFINE_METHOD1(int, avcodec_close_dont_call, (AVCodecContext *p1))
DEFINE_METHOD0(AVFrame*, avcodec_alloc_frame)
DEFINE_METHOD5(int, avpicture_fill, (AVPicture *p1, uint8_t *p2, PixelFormat p3, int p4, int p5))
DEFINE_METHOD3(int, avpicture_get_size, (PixelFormat p1, int p2, int p3))
DEFINE_METHOD0(AVFrame*, av_frame_alloc)
DEFINE_METHOD5(int, avpicture_fill, (AVPicture *p1, uint8_t *p2, AVPixelFormat p3, int p4, int p5))
DEFINE_METHOD3(int, avpicture_get_size, (AVPixelFormat p1, int p2, int p3))
DEFINE_METHOD4(void, avcodec_string, (char *p1, int p2, AVCodecContext *p3, int p4))
DEFINE_METHOD2(void, avcodec_get_context_defaults3, (AVCodecContext *p1, AVCodec *p2))
DEFINE_METHOD1(void, av_parser_close, (AVCodecParserContext *p1))
Expand All @@ -210,10 +208,9 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
DEFINE_METHOD8(int, av_bitstream_filter_filter, (AVBitStreamFilterContext* p1, AVCodecContext* p2, const char* p3, uint8_t** p4, int* p5, const uint8_t* p6, int p7, int p8))
DEFINE_METHOD1(void, av_bitstream_filter_close, (AVBitStreamFilterContext *p1))
DEFINE_METHOD1(void, av_free_packet, (AVPacket *p1))
DEFINE_METHOD4(int, avpicture_alloc, (AVPicture *p1, PixelFormat p2, int p3, int p4))
DEFINE_METHOD2(int, avcodec_default_get_buffer, (AVCodecContext *p1, AVFrame *p2))
DEFINE_METHOD2(void, avcodec_default_release_buffer, (AVCodecContext *p1, AVFrame *p2))
DEFINE_METHOD2(enum PixelFormat, avcodec_default_get_format, (struct AVCodecContext *p1, const enum PixelFormat *p2))
DEFINE_METHOD4(int, avpicture_alloc, (AVPicture *p1, AVPixelFormat p2, int p3, int p4))
DEFINE_METHOD2(int, avcodec_default_get_buffer2, (AVCodecContext *p1, AVFrame *p2, int flags))
DEFINE_METHOD2(enum AVPixelFormat, avcodec_default_get_format, (struct AVCodecContext *p1, const enum AVPixelFormat *p2))

DEFINE_METHOD1(AVCodec*, av_codec_next, (AVCodec *p1))
BEGIN_METHOD_RESOLVE()
Expand All @@ -222,13 +219,13 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
RESOLVE_METHOD_RENAME(avcodec_close,avcodec_close_dont_call)
RESOLVE_METHOD(avcodec_find_decoder)
RESOLVE_METHOD(avcodec_find_encoder)
RESOLVE_METHOD(avcodec_alloc_frame)
RESOLVE_METHOD(av_frame_alloc)
RESOLVE_METHOD_RENAME(avcodec_register_all, avcodec_register_all_dont_call)
RESOLVE_METHOD(avpicture_fill)
RESOLVE_METHOD(avcodec_decode_video2)
RESOLVE_METHOD(avcodec_decode_audio4)
RESOLVE_METHOD(avcodec_decode_subtitle2)
RESOLVE_METHOD(avcodec_encode_audio)
RESOLVE_METHOD(avcodec_encode_audio2)
RESOLVE_METHOD(avpicture_get_size)
RESOLVE_METHOD(avcodec_alloc_context3)
RESOLVE_METHOD(avcodec_string)
Expand All @@ -242,8 +239,7 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
RESOLVE_METHOD(avpicture_free)
RESOLVE_METHOD(avpicture_alloc)
RESOLVE_METHOD(av_free_packet)
RESOLVE_METHOD(avcodec_default_get_buffer)
RESOLVE_METHOD(avcodec_default_release_buffer)
RESOLVE_METHOD(avcodec_default_get_buffer2)
RESOLVE_METHOD(avcodec_default_get_format)
RESOLVE_METHOD(av_codec_next)
RESOLVE_METHOD(av_dup_packet)
Expand Down Expand Up @@ -276,3 +272,4 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
};

#endif

Loading

0 comments on commit 2a4ea90

Please sign in to comment.