Originally committed as revision 19364 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | +#include "libavutil/avstring.h" | |
| 27 | 28 | #include "libavcodec/bytestream.h" |
| 28 | 29 | #include "libavcodec/mpeg4audio.h" |
| 29 | 30 | #include "avformat.h" |
| @@ -218,11 +219,16 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst · 188 unmodified lines | ||
| 218 | 219 | vcodec = vstream ? vstream->codec : NULL; |
| 219 | 220 | |
| 220 | 221 | if(amf_type == AMF_DATA_TYPE_BOOL) { |
| 222 | + av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val)); | |
| 223 | + av_metadata_set(&s->metadata, key, str_val); | |
| 221 | 224 | } else if(amf_type == AMF_DATA_TYPE_NUMBER) { |
| 225 | + snprintf(str_val, sizeof(str_val), "%.f", num_val); | |
| 226 | + av_metadata_set(&s->metadata, key, str_val); | |
| 222 | 227 | if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE; |
| 223 | 228 | else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0)) |
| 224 | 229 | vcodec->bit_rate = num_val * 1024.0; |
| 225 | − } | |
| 230 | + } else if (amf_type == AMF_DATA_TYPE_STRING) | |
| 231 | + av_metadata_set(&s->metadata, key, str_val); | |
| 226 | 232 | } |
| 227 | 233 | |
| 228 | 234 | return 0; |