4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: YoungHun Kim <yh8004.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include "mm_transcode.h"
22 #include "mm_transcode_internal.h"
24 int _mm_encodebin_set_venc_aenc(handle_s *handle)
26 int ret = MM_ERROR_NONE;
29 LOGE("[ERROR] - handle");
30 return MM_ERROR_INVALID_ARGUMENT;
33 if (!handle->property) {
34 LOGE("[ERROR] - handle property");
35 return MM_ERROR_TRANSCODE_INTERNAL;
38 handle->property->mux = malloc(sizeof(gchar) * ENC_BUFFER_SIZE);
39 if (handle->property->mux == NULL) {
41 return MM_ERROR_INVALID_ARGUMENT;
43 handle->property->venc = malloc(sizeof(gchar) * ENC_BUFFER_SIZE);
44 if (handle->property->venc == NULL) {
46 TRANSCODE_FREE(handle->property->mux);
47 return MM_ERROR_INVALID_ARGUMENT;
49 handle->property->aenc = malloc(sizeof(gchar) * ENC_BUFFER_SIZE);
50 if (handle->property->aenc == NULL) {
52 TRANSCODE_FREE(handle->property->mux);
53 TRANSCODE_FREE(handle->property->venc);
54 return MM_ERROR_INVALID_ARGUMENT;
57 memset(handle->property->mux, 0, ENC_BUFFER_SIZE);
58 memset(handle->property->venc, 0, ENC_BUFFER_SIZE);
59 memset(handle->property->aenc, 0, ENC_BUFFER_SIZE);
61 switch (handle->property->containerformat) {
62 case MM_CONTAINER_3GP:
63 case MM_CONTAINER_MP4:
64 if (handle->property->videoencoder == MM_VIDEOENCODER_NO_USE && handle->property->audioencoder == MM_AUDIOENCODER_AAC)
65 strncpy(handle->property->mux, MUXAAC, ENC_BUFFER_SIZE - 1);
67 strncpy(handle->property->mux, MUX3GP, ENC_BUFFER_SIZE - 1);
70 LOGE("error container value");
74 switch (handle->property->videoencoder) {
75 case MM_VIDEOENCODER_MPEG4:
76 strncpy(handle->property->venc, AVENCMPEG4, ENC_BUFFER_SIZE - 1);
77 LOGD("[FFMPEG] %s", handle->property->venc);
79 case MM_VIDEOENCODER_H263:
80 strncpy(handle->property->venc, AVENCH263, ENC_BUFFER_SIZE - 1);
81 LOGD("[FFMPEG] %s", handle->property->venc);
83 case MM_VIDEOENCODER_NO_USE:
87 LOGE("error videoencoder value");
91 switch (handle->property->audioencoder) {
92 case MM_AUDIOENCODER_AAC:
93 strncpy(handle->property->aenc, AACENC, ENC_BUFFER_SIZE - 1);
94 LOGD("[FFMPEG] %s", handle->property->aenc);
96 case MM_AUDIOENCODER_AMR:
97 strncpy(handle->property->aenc, AMRENC, ENC_BUFFER_SIZE - 1);
98 LOGD("[FFMPEG] %s", handle->property->aenc);
100 case MM_AUDIOENCODER_NO_USE:
104 LOGE("error audioencoder value");