diff options
Diffstat (limited to 'codecs/ffmpeg')
-rwxr-xr-x | codecs/ffmpeg/Makefile.am | 24 | ||||
-rwxr-xr-x | codecs/ffmpeg/include/mm_file_codec_dummy.h | 37 | ||||
-rwxr-xr-x | codecs/ffmpeg/include/mm_file_codec_private.h | 41 | ||||
-rwxr-xr-x | codecs/ffmpeg/mm_file_codec_dummy.c | 69 | ||||
-rwxr-xr-x | codecs/ffmpeg/mm_file_codecs.c | 133 |
5 files changed, 304 insertions, 0 deletions
diff --git a/codecs/ffmpeg/Makefile.am b/codecs/ffmpeg/Makefile.am new file mode 100755 index 0000000..8fbbb10 --- /dev/null +++ b/codecs/ffmpeg/Makefile.am @@ -0,0 +1,24 @@ +lib_LTLIBRARIES = libmmfile_codecs.la + +libmmfile_codecs_la_DEPENDENCIES = $(top_builddir)/utils/libmmfile_utils.la + +noinst_HEADERS = include/mm_file_codec_dummy.h \ + include/mm_file_codec_private.h + + +libmmfile_codecs_la_SOURCES = mm_file_codecs.c \ + mm_file_codec_dummy.c + + +libmmfile_codecs_la_CFLAGS = -I$(srcdir)/include \ + $(MMCOMMON_CFLAGS) \ + -I$(srcdir)/../../include \ + -I$(srcdir)/../../utils/include \ + -D_LARGEFILE64_SOURCE \ + -D_FILE_OFFSET_BITS=64 + +libmmfile_codecs_la_LIBADD = $(MMCOMMON_LIBS) \ + $(top_builddir)/utils/libmmfile_utils.la + +libmmfile_codecs_la_CFLAGS += $(MMLOG_CFLAGS) -DMMF_LOG_OWNER=0x040 -DMMF_DEBUG_PREFIX=\"MMF-FILE-CODEC-FFMPEG\" +libmmfile_codecs_la_LIBADD += $(MMLOG_LIBS) diff --git a/codecs/ffmpeg/include/mm_file_codec_dummy.h b/codecs/ffmpeg/include/mm_file_codec_dummy.h new file mode 100755 index 0000000..49ed937 --- /dev/null +++ b/codecs/ffmpeg/include/mm_file_codec_dummy.h @@ -0,0 +1,37 @@ +/* + * libmm-fileinfo + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Haejeong Kim <backto.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __MM_CODEC_PLUGIN_DUMMY_H__ +#define __MM_CODEC_PLUGIN_DUMMY_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif /*__MM_CODEC_PLUGIN_DUMMY_H__*/ + diff --git a/codecs/ffmpeg/include/mm_file_codec_private.h b/codecs/ffmpeg/include/mm_file_codec_private.h new file mode 100755 index 0000000..8ba471d --- /dev/null +++ b/codecs/ffmpeg/include/mm_file_codec_private.h @@ -0,0 +1,41 @@ +/* + * libmm-fileinfo + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Haejeong Kim <backto.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef _MMFILE_CODEC_PRIVATE_H_ +#define _MMFILE_CODEC_PRIVATE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <mm_types.h> +#include "mm_file_codecs.h" + +/* open functions list */ +int mmfile_codec_open_dummy (MMFileCodecContext *codecContext, MMFileCodecFrame *input); + + +#ifdef __cplusplus +} +#endif + +#endif /* _MMFILE_CODEC_PRIVATE_H_ */ + diff --git a/codecs/ffmpeg/mm_file_codec_dummy.c b/codecs/ffmpeg/mm_file_codec_dummy.c new file mode 100755 index 0000000..989084d --- /dev/null +++ b/codecs/ffmpeg/mm_file_codec_dummy.c @@ -0,0 +1,69 @@ +/* + * libmm-fileinfo + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Haejeong Kim <backto.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <string.h> /*memcmp*/ +#include <stdlib.h> /*malloc*/ + +#include <mm_error.h> + +#include "mm_debug.h" + +#include "mm_file_codec_private.h" +#include "mm_file_codec_dummy.h" + + +/* internal functions */ + + +/* plugin manadatory API */ +int mmfile_codec_decode_dummy (MMFileCodecContext *codecContext, MMFileCodecFrame *output); +int mmfile_codec_close_dummy (MMFileCodecContext *codecContext); + + +EXPORT_API +int mmfile_codec_open_dummy (MMFileCodecContext *codecContext, MMFileCodecFrame *input) +{ + debug_warning ("called mmfile_codec_open_dummy\n"); + + codecContext->Decode = mmfile_codec_decode_dummy; + codecContext->Close = mmfile_codec_close_dummy; + + return MMFILE_CODEC_SUCCESS; +} + +EXPORT_API +int mmfile_codec_decode_dummy (MMFileCodecContext *codecContext, MMFileCodecFrame *output) +{ + debug_warning ("called mmfile_codec_decode_dummy\n"); + return MMFILE_CODEC_SUCCESS; +} + +EXPORT_API +int mmfile_codec_close_dummy (MMFileCodecContext *codecContext) +{ + debug_warning ("called mmfile_codec_close_dummy\n"); + + codecContext->Decode = NULL; + codecContext->Close = NULL; + + return MMFILE_CODEC_SUCCESS; +} + diff --git a/codecs/ffmpeg/mm_file_codecs.c b/codecs/ffmpeg/mm_file_codecs.c new file mode 100755 index 0000000..dc9cc89 --- /dev/null +++ b/codecs/ffmpeg/mm_file_codecs.c @@ -0,0 +1,133 @@ +/* + * libmm-fileinfo + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Haejeong Kim <backto.kim@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <string.h> +#include <stdlib.h> + +#include "mm_debug.h" +#include "mm_file_utils.h" +#include "mm_file_codec_private.h" + +int (*OpenVideoCodecFunc[MM_VIDEO_CODEC_NUM]) (MMFileCodecContext *codecContext, MMFileCodecFrame *input) = { + mmfile_codec_open_dummy, /* NONE */ + mmfile_codec_open_dummy, /* WMV */ + mmfile_codec_open_dummy, /* H261 */ + mmfile_codec_open_dummy, /* H262 */ + mmfile_codec_open_dummy, /* H263 */ + mmfile_codec_open_dummy, /* H263V2 */ + mmfile_codec_open_dummy, /* H263V3 */ + mmfile_codec_open_dummy, /* H264 */ + mmfile_codec_open_dummy, /* H26L */ + mmfile_codec_open_dummy, /* MJPEG */ + mmfile_codec_open_dummy, /* MPEG1 */ + mmfile_codec_open_dummy, /* MPEG2 */ + mmfile_codec_open_dummy, /* MPEG4 */ + mmfile_codec_open_dummy, /* MPEG4_SIMPLE */ + mmfile_codec_open_dummy, /* MPEG4_ADV_SIMPE */ + mmfile_codec_open_dummy, /* MPEG4_MAIN */ + mmfile_codec_open_dummy, /* MPEG4_CORE */ + mmfile_codec_open_dummy, /* MPEG4_ACE */ + mmfile_codec_open_dummy, /* MPEG4_ARTS */ + mmfile_codec_open_dummy, /* MPEG4_AVC */ + mmfile_codec_open_dummy, /* REAL */ + mmfile_codec_open_dummy, /* VC1 */ + mmfile_codec_open_dummy, /* AVS */ + mmfile_codec_open_dummy, /* CINEPAK */ + mmfile_codec_open_dummy, /* INDEO */ + mmfile_codec_open_dummy, /* THEORA */ + mmfile_codec_open_dummy, /* DIVX */ + mmfile_codec_open_dummy, /* XVID */ +}; + +EXPORT_API +int mmfile_codec_open (MMFileCodecContext **codecContext, int codecType, int codecId, MMFileCodecFrame *input) +{ + MMFileCodecContext *codecObject = NULL; + int ret = 0; + + if (codecId <= MM_VIDEO_CODEC_NONE || codecId >= MM_VIDEO_CODEC_NUM || MMFILE_VIDEO_DECODE != codecType || NULL == input) + { + debug_error ("error: invalid params\n"); + return MMFILE_CODEC_FAIL; + } + + if (NULL == OpenVideoCodecFunc[codecId]) + { + debug_error ("error: Not implemented \n"); + return MMFILE_CODEC_FAIL; + } + + codecObject = mmfile_malloc (sizeof (MMFileCodecContext)); + if (NULL == codecObject) + { + debug_error ("error: mmfile_malloc fail for codecObject\n"); + return MMFILE_CODEC_FAIL; + } + + *codecContext = codecObject; + + ret = OpenVideoCodecFunc[codecId](codecObject, input); + if (MMFILE_CODEC_FAIL == ret) + { + debug_error ("error: init fail about video codec\n"); + ret = MMFILE_CODEC_FAIL; + goto exception; + } + + return MMFILE_CODEC_SUCCESS; + +exception: + if (codecObject) mmfile_free(codecObject); + + return ret; +} + +EXPORT_API +int mmfile_codec_decode (MMFileCodecContext *codecContext, MMFileCodecFrame *output) +{ + if (NULL == codecContext || NULL == codecContext->Decode ) + { + debug_error ("error: invalid params\n"); + return MMFILE_CODEC_FAIL; + } + + return codecContext->Decode (codecContext, output); +} + +EXPORT_API +int mmfile_codec_close (MMFileCodecContext *codecContext) +{ + if (NULL == codecContext || NULL == codecContext->Close) + { + debug_error ("error: invalid params\n"); + return MMFILE_CODEC_FAIL; + } + + codecContext->Close (codecContext); + + if (codecContext->Decode) codecContext->Decode = NULL; + if (codecContext->Close) codecContext->Close = NULL; + if (codecContext->privateData) mmfile_free(codecContext->privateData); + mmfile_free (codecContext); + + return MMFILE_CODEC_SUCCESS; +} + |