From 2754dbb6e151732f9d27fcc483e6701f010b5451 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 28 Nov 2012 01:32:22 +0100 Subject: [PATCH] nut: put nut PCM audio tags in front of avi tags. This fixes correctly storing and identifying PCM in nut. Based on patch by Luca Barbato Found-by: durandal_1707 Signed-off-by: Michael Niedermayer --- libavformat/nut.c | 10 +++++++--- tests/ref/fate/ffprobe_compact | 2 +- tests/ref/fate/ffprobe_csv | 2 +- tests/ref/fate/ffprobe_default | 4 ++-- tests/ref/fate/ffprobe_flat | 4 ++-- tests/ref/fate/ffprobe_ini | 4 ++-- tests/ref/fate/ffprobe_json | 4 ++-- tests/ref/fate/ffprobe_xml | 2 +- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/libavformat/nut.c b/libavformat/nut.c index a670449c99..fc300fe378 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -146,9 +146,13 @@ const AVCodecTag ff_nut_video_tags[] = { { AV_CODEC_ID_NONE , 0 } }; -const AVCodecTag ff_nut_audio_tags[] = { +static const AVCodecTag nut_audio_extra_tags[] = { { AV_CODEC_ID_PCM_ALAW, MKTAG('A', 'L', 'A', 'W') }, { AV_CODEC_ID_PCM_MULAW, MKTAG('U', 'L', 'A', 'W') }, + { AV_CODEC_ID_NONE, 0 } +}; + +const AVCodecTag ff_nut_audio_tags[] = { { AV_CODEC_ID_PCM_F32BE, MKTAG(32 , 'D', 'F', 'P') }, { AV_CODEC_ID_PCM_F32LE, MKTAG('P', 'F', 'D', 32 ) }, { AV_CODEC_ID_PCM_F64BE, MKTAG(64 , 'D', 'F', 'P') }, @@ -176,8 +180,8 @@ const AVCodecTag ff_nut_audio_tags[] = { }; const AVCodecTag * const ff_nut_codec_tags[] = { - ff_nut_video_tags, ff_nut_subtitle_tags, - ff_codec_bmp_tags, ff_codec_wav_tags, ff_nut_audio_tags, ff_nut_data_tags, 0 + ff_nut_video_tags, ff_nut_audio_tags, ff_nut_subtitle_tags, + ff_codec_bmp_tags, ff_codec_wav_tags, nut_audio_extra_tags, ff_nut_data_tags, 0 }; void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){ diff --git a/tests/ref/fate/ffprobe_compact b/tests/ref/fate/ffprobe_compact index a27684865f..69ba66049c 100644 --- a/tests/ref/fate/ffprobe_compact +++ b/tests/ref/fate/ffprobe_compact @@ -26,7 +26,7 @@ packet|codec_type=video|stream_index=1|pts=6144|pts_time=0.120000|dts=6144|dts_t frame|media_type=video|key_frame=1|pkt_pts=6144|pkt_pts_time=0.120000|pkt_dts=6144|pkt_dts_time=0.120000|pkt_duration=2048|pkt_duration_time=0.040000|pkt_pos=794307|width=320|height=240|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|reference=0 packet|codec_type=video|stream_index=2|pts=6144|pts_time=0.120000|dts=6144|dts_time=0.120000|duration=2048|duration_time=0.040000|convergence_duration=N/A|convergence_duration_time=N/A|size=30000|pos=1024731|flags=K frame|media_type=video|key_frame=1|pkt_pts=6144|pkt_pts_time=0.120000|pkt_dts=6144|pkt_dts_time=0.120000|pkt_duration=2048|pkt_duration_time=0.040000|pkt_pos=1024731|width=100|height=100|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|reference=0 -stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_time_base=1/44100|codec_tag_string=[1][0][0][0]|codec_tag=0x0001|sample_fmt=s16|sample_rate=44100|channels=1|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=527406|duration=11.959320|bit_rate=705600|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:E=mc² +stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_time_base=1/44100|codec_tag_string=PSD[16]|codec_tag=0x10445350|sample_fmt=s16|sample_rate=44100|channels=1|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=527406|duration=11.959320|bit_rate=705600|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:E=mc² stream|index=1|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/51200|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=320|height=240|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=4:3|pix_fmt=rgb24|level=-99|timecode=N/A|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.000000|duration_ts=612317|duration=11.959316|bit_rate=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:title=foobar|tag:duration_ts=field-and-tags-conflict-attempt stream|index=2|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/51200|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=100|height=100|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=1:1|pix_fmt=rgb24|level=-99|timecode=N/A|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.000000|duration_ts=612317|duration=11.959316|bit_rate=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0 format|filename=tests/data/ffprobe-test.nut|nb_streams=3|format_name=nut|start_time=0.000000|duration=11.959320|size=1054812|bit_rate=705599|tag:title=ffprobe test file|tag:comment='A comment with CSV, XML & JSON special chars': |tag:comment2=I ♥ Üñîçød€ diff --git a/tests/ref/fate/ffprobe_csv b/tests/ref/fate/ffprobe_csv index 7a09d65284..d3a1fb94c0 100644 --- a/tests/ref/fate/ffprobe_csv +++ b/tests/ref/fate/ffprobe_csv @@ -26,7 +26,7 @@ packet,video,1,6144,0.120000,6144,0.120000,2048,0.040000,N/A,N/A,230400,794307,K frame,video,1,6144,0.120000,6144,0.120000,2048,0.040000,794307,320,240,rgb24,1:1,I,0,0,0,0,0,0 packet,video,2,6144,0.120000,6144,0.120000,2048,0.040000,N/A,N/A,30000,1024731,K frame,video,1,6144,0.120000,6144,0.120000,2048,0.040000,1024731,100,100,rgb24,1:1,I,0,0,0,0,0,0 -stream,0,pcm_s16le,unknown,audio,1/44100,[1][0][0][0],0x0001,s16,44100,1,16,N/A,0/0,0/0,1/44100,0,0.000000,527406,11.959320,705600,N/A,6,6,0,0,0,0,0,0,0,0,0,0,0,mc² +stream,0,pcm_s16le,unknown,audio,1/44100,PSD[16],0x10445350,s16,44100,1,16,N/A,0/0,0/0,1/44100,0,0.000000,527406,11.959320,705600,N/A,6,6,0,0,0,0,0,0,0,0,0,0,0,mc² stream,1,rawvideo,unknown,video,1/51200,RGB[24],0x18424752,320,240,0,1:1,4:3,rgb24,-99,N/A,N/A,25/1,25/1,1/51200,0,0.000000,612317,11.959316,N/A,N/A,4,4,0,0,0,0,0,0,0,0,0,0,0,foobar,field-and-tags-conflict-attempt stream,2,rawvideo,unknown,video,1/51200,RGB[24],0x18424752,100,100,0,1:1,1:1,rgb24,-99,N/A,N/A,25/1,25/1,1/51200,0,0.000000,612317,11.959316,N/A,N/A,4,4,0,0,0,0,0,0,0,0,0,0,0 format,tests/data/ffprobe-test.nut,3,nut,0.000000,11.959320,1054812,705599,ffprobe test file,"'A comment with CSV, XML & JSON special chars': ",I ♥ Üñîçød€ diff --git a/tests/ref/fate/ffprobe_default b/tests/ref/fate/ffprobe_default index 585f340ce5..c30f1fbcc2 100644 --- a/tests/ref/fate/ffprobe_default +++ b/tests/ref/fate/ffprobe_default @@ -480,8 +480,8 @@ codec_name=pcm_s16le profile=unknown codec_type=audio codec_time_base=1/44100 -codec_tag_string=[1][0][0][0] -codec_tag=0x0001 +codec_tag_string=PSD[16] +codec_tag=0x10445350 sample_fmt=s16 sample_rate=44100 channels=1 diff --git a/tests/ref/fate/ffprobe_flat b/tests/ref/fate/ffprobe_flat index 010f669a02..43dcabdd64 100644 --- a/tests/ref/fate/ffprobe_flat +++ b/tests/ref/fate/ffprobe_flat @@ -423,8 +423,8 @@ streams.stream.0.codec_name="pcm_s16le" streams.stream.0.profile="unknown" streams.stream.0.codec_type="audio" streams.stream.0.codec_time_base="1/44100" -streams.stream.0.codec_tag_string="[1][0][0][0]" -streams.stream.0.codec_tag="0x0001" +streams.stream.0.codec_tag_string="PSD[16]" +streams.stream.0.codec_tag="0x10445350" streams.stream.0.sample_fmt="s16" streams.stream.0.sample_rate="44100" streams.stream.0.channels=1 diff --git a/tests/ref/fate/ffprobe_ini b/tests/ref/fate/ffprobe_ini index af38129a4f..abaf3e1e3c 100644 --- a/tests/ref/fate/ffprobe_ini +++ b/tests/ref/fate/ffprobe_ini @@ -482,8 +482,8 @@ codec_name=pcm_s16le profile=unknown codec_type=audio codec_time_base=1/44100 -codec_tag_string=[1][0][0][0] -codec_tag=0x0001 +codec_tag_string=PSD[16] +codec_tag=0x10445350 sample_fmt=s16 sample_rate=44100 channels=1 diff --git a/tests/ref/fate/ffprobe_json b/tests/ref/fate/ffprobe_json index 37e2e51b9d..6b55d92234 100644 --- a/tests/ref/fate/ffprobe_json +++ b/tests/ref/fate/ffprobe_json @@ -477,8 +477,8 @@ "codec_name": "pcm_s16le", "codec_type": "audio", "codec_time_base": "1/44100", - "codec_tag_string": "[1][0][0][0]", - "codec_tag": "0x0001", + "codec_tag_string": "PSD[16]", + "codec_tag": "0x10445350", "sample_fmt": "s16", "sample_rate": "44100", "channels": 1, diff --git a/tests/ref/fate/ffprobe_xml b/tests/ref/fate/ffprobe_xml index f428f9d1f2..ca0908ef7d 100644 --- a/tests/ref/fate/ffprobe_xml +++ b/tests/ref/fate/ffprobe_xml @@ -32,7 +32,7 @@ - +