Skip to content

Commit

Permalink
Merge branch 'master' of https://ThomasVolkert@github.com/Homer-Confe…
Browse files Browse the repository at this point in the history
…rencing/Homer-Conferencing.git
  • Loading branch information
ThomasVolkert committed Dec 29, 2012
2 parents e5bf981 + bbca08a commit bc4c0e6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
12 changes: 12 additions & 0 deletions HomerMultimedia/include/Header_Ffmpeg.h
Expand Up @@ -179,6 +179,18 @@ inline void HM_close_input(AVFormatContext *s)
#endif
}

inline AVStream *HM_avformat_new_stream(AVFormatContext *s, int id)
{
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 10, 0)
return av_new_stream(s, c);
#else
AVStream *st = avformat_new_stream(s, NULL);
if (st)
st->id = id;
return st;
#endif
}

#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 35, 0)
inline int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
{
Expand Down
18 changes: 17 additions & 1 deletion HomerMultimedia/src/MediaSource.cpp
Expand Up @@ -246,11 +246,19 @@ void MediaSource::LogSupportedVideoCodecs(bool pSendToLoggerOnly)
{
if (tCodec->type == AVMEDIA_TYPE_VIDEO)
{
#ifndef FF_API_OLD_ENCODE_AUDIO
bool tEncode = (tCodec->encode != NULL);
#else
bool tEncode = (tCodec->encode2 != NULL);
#endif
bool tDecode = (tCodec->decode != NULL);
if ((tNextCodec != NULL) && (strcmp(tCodec->name, tNextCodec->name) == 0))
{
#ifndef FF_API_OLD_ENCODE_AUDIO
tEncode |= (tNextCodec->encode != NULL);
#else
tEncode |= (tNextCodec->encode2 != NULL);
#endif
tDecode |= (tNextCodec->decode != NULL);
tCodec = tNextCodec;
}
Expand Down Expand Up @@ -306,11 +314,19 @@ void MediaSource::LogSupportedAudioCodecs(bool pSendToLoggerOnly)
// tNextCodec->encode ? "E" : " ",
// tNextCodec->name,
// tNextCodec->long_name ? tCodec->long_name : "");
#ifndef FF_API_OLD_ENCODE_AUDIO
bool tEncode = (tCodec->encode != NULL);
#else
bool tEncode = (tCodec->encode2 != NULL);
#endif
bool tDecode = (tCodec->decode != NULL);
if ((tNextCodec != NULL) && (strcmp(tCodec->name, tNextCodec->name) == 0))
{
#ifndef FF_API_OLD_ENCODE_AUDIO
tEncode |= (tNextCodec->encode != NULL);
#else
tEncode |= (tNextCodec->encode2 != NULL);
#endif
tDecode |= (tNextCodec->decode != NULL);
tCodec = tNextCodec;
}
Expand Down Expand Up @@ -1709,7 +1725,7 @@ bool MediaSource::StartRecording(std::string pSaveFileName, int pSaveFileQuality
sprintf(mRecorderFormatContext->filename, "%s", pSaveFileName.c_str());

// allocate new stream structure
tStream = av_new_stream(mRecorderFormatContext, 0);
tStream = HM_avformat_new_stream(mRecorderFormatContext, 0);
mRecorderCodecContext = tStream->codec;

// put sample parameters
Expand Down
4 changes: 2 additions & 2 deletions HomerMultimedia/src/MediaSourceMuxer.cpp
Expand Up @@ -442,7 +442,7 @@ bool MediaSourceMuxer::OpenVideoMuxer(int pResX, int pResY, float pFps)

// allocate new stream structure
LOG(LOG_VERBOSE, "..allocating new stream");
tStream = av_new_stream(mFormatContext, 0);
tStream = HM_avformat_new_stream(mFormatContext, 0);
mCodecContext = tStream->codec;
mCodecContext->codec_id = tFormat->video_codec;
mCodecContext->codec_type = AVMEDIA_TYPE_VIDEO;
Expand Down Expand Up @@ -737,7 +737,7 @@ bool MediaSourceMuxer::OpenAudioMuxer(int pSampleRate, int pChannels)
}

// allocate new stream structure
tStream = av_new_stream(mFormatContext, 0);
tStream = HM_avformat_new_stream(mFormatContext, 0);
mCodecContext = tStream->codec;
mCodecContext->codec_id = tFormat->audio_codec;
mCodecContext->codec_type = AVMEDIA_TYPE_AUDIO;
Expand Down
2 changes: 1 addition & 1 deletion HomerMultimedia/src/RTP.cpp
Expand Up @@ -565,7 +565,7 @@ bool RTP::OpenRtpEncoder(string pTargetHost, unsigned int pTargetPort, AVStream
// verbose timestamp debugging mRtpFormatContext->debug = FF_FDEBUG_TS;

// allocate new stream structure
tOuterStream = av_new_stream(mRtpFormatContext, 0);
tOuterStream = HM_avformat_new_stream(mRtpFormatContext, 0);
if (tOuterStream == NULL)
{
LOG(LOG_ERROR, "Memory allocation failed");
Expand Down

0 comments on commit bc4c0e6

Please sign in to comment.