Skip to content

Commit 57c3c09

Browse files
authored
fix #103, codec_name is not required since data stream won't have cod… (#104)
* fix #103, codec_name is not required since data stream won't have codec name * update snapshot * update snapshot
1 parent bf08f93 commit 57c3c09

13 files changed

+76
-9
lines changed

src/ffmpeg_media_type/info.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def detect(uri: str | Path) -> MediaInfo:
6363

6464
# NOTE: handle ffmpeg's image compatibility
6565
if format_name == "image2":
66+
assert info.streams[0].codec_name
6667
format_name = info.streams[0].codec_name
6768

6869
# NOTE: detect file extension

src/ffmpeg_media_type/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ class FFProbeStream:
151151
"""
152152
The stream codec type.
153153
"""
154-
codec_name: str
154+
codec_name: str | None = None
155155
"""
156-
The stream codec name.
156+
The stream codec name. If the stream is a data stream, this field will be set to None
157157
"""
158158
codec_long_name: str | None = None
159159
"""
Binary file not shown.

src/ffmpeg_media_type/tests/__snapshots__/test_info/test_detect[188794898-eeb81e4b-b33a-4bdf-85a8-3b4b8460b88a.png].json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"duration": null,
2+
"duration": 0,
33
"format": "png_pipe",
44
"height": 259,
55
"size": 47210,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"duration": 89.6,
3+
"format": "mov,mp4,m4a,3gp,3g2,mj2",
4+
"height": 1080,
5+
"size": 15080282,
6+
"suggest_ext": "mp4",
7+
"type": "video",
8+
"width": 1920
9+
}

src/ffmpeg_media_type/tests/__snapshots__/test_info/test_detect[9c7ee468-24a3-4930-9832-73f0f6001ab1.webp].json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"duration": null,
2+
"duration": 0,
33
"format": "webp_pipe",
44
"height": 787,
55
"size": 55242,

src/ffmpeg_media_type/tests/__snapshots__/test_info/test_detect[animated-webp.webp].json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"duration": null,
2+
"duration": 0,
33
"format": "webp_pipe",
44
"height": 225,
55
"size": 4242,

src/ffmpeg_media_type/tests/__snapshots__/test_info/test_detect[cd89b1bf161582d55161f5ba94d03cc7728825c2.jpe].json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"duration": null,
2+
"duration": 0,
33
"format": "jpeg_pipe",
44
"height": 3144,
55
"size": 12642182,

src/ffmpeg_media_type/tests/__snapshots__/test_info/test_detect[lionic_vp8x_1109.webp].json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"duration": null,
2+
"duration": 0,
33
"format": "webp_pipe",
44
"height": 520,
55
"size": 344360,

src/ffmpeg_media_type/tests/__snapshots__/test_info/test_detect[maxresdefault.jpg-sdafdeagwdsadf].json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"duration": null,
2+
"duration": 0,
33
"format": "jpeg_pipe",
44
"height": 720,
55
"size": 99802,

0 commit comments

Comments
 (0)