Skip to content

Commit

Permalink
build and crash fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tony2001 committed Aug 2, 2012
1 parent 716551d commit f3ae0c6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ffmpeg-php.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ PHP_MINFO_FUNCTION(ffmpeg)
}

m_codec_list = realloc(m_codec_list, m_codec_list_len+1);
m_codec_list[m_codec_list_len] = (char)NULL;
m_codec_list[m_codec_list_len] = '\0';

//give the user a list of available codecs
//should really add (dec/enc) on the end of each to show each is capable of
Expand Down
1 change: 1 addition & 0 deletions ffmpeg_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ static int _php_avframe_to_gd_image(AVFrame *frame, gdImage *dest, int width,
}
src += width;
}
return 0;
}
/* }}} */

Expand Down
36 changes: 34 additions & 2 deletions ffmpeg_movie.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ FFMPEG_PHP_CONSTRUCTOR(ffmpeg_movie, __construct)
}

if (persistent) {
list_entry *le;
zend_rsrc_list_entry *le;
/* resolve the fully-qualified path name to use as the hash key */
fullpath = expand_filepath(filename, NULL TSRMLS_CC);

Expand Down Expand Up @@ -350,7 +350,7 @@ FFMPEG_PHP_CONSTRUCTOR(ffmpeg_movie, __construct)
}

} else { /* no existing persistant movie, create one */
list_entry new_le;
zend_rsrc_list_entry new_le;
ffmovie_ctx = _php_alloc_ffmovie_ctx(1);

if (_php_open_movie_file(ffmovie_ctx, filename)) {
Expand Down Expand Up @@ -537,6 +537,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getComment)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "comment", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand All @@ -553,6 +557,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getTitle)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "title", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand All @@ -569,6 +577,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAuthor)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "author", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand All @@ -584,6 +596,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getCopyright)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "copyright", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand All @@ -600,6 +616,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAlbum)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "album", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand All @@ -615,6 +635,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getGenre)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "genre", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand All @@ -631,6 +655,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getTrackNumber)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "track", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand All @@ -646,6 +674,10 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getYear)

AVDictionaryEntry *m_entry = av_dict_get(ffmovie_ctx->fmt_ctx->metadata, "year", NULL, 0);

if (!m_entry) {
RETURN_FALSE;
}

RETURN_STRINGL(m_entry->value, strlen(m_entry->value), 1);
}
/* }}} */
Expand Down

0 comments on commit f3ae0c6

Please sign in to comment.